Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: chrome/common.js

Issue 6273189772525568: Fixed regression: Clickhide functionality broken (Closed)
Left Patch Set: Created Nov. 19, 2013, 12:02 p.m.
Right Patch Set: Made it work with sendMessage/onMessage Created Nov. 19, 2013, 12:21 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « background.js ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 this._target.removeListener(this._wrappedListeners[idx]); 49 this._target.removeListener(this._wrappedListeners[idx]);
50 50
51 this._listeners.splice(idx, 1); 51 this._listeners.splice(idx, 1);
52 this._wrappedListeners.splice(idx, 1); 52 this._wrappedListeners.splice(idx, 1);
53 } 53 }
54 } 54 }
55 }; 55 };
56 56
57 var MessageEventTarget = function() 57 var MessageEventTarget = function()
58 { 58 {
59 WrappedEventTarget.call(this, chrome.extension.onRequest); 59 WrappedEventTarget.call(this, (chrome.runtime || {}).onMessage || chrome.ext ension.onRequest);
60 }; 60 };
61 MessageEventTarget.prototype = { 61 MessageEventTarget.prototype = {
62 __proto__: WrappedEventTarget.prototype, 62 __proto__: WrappedEventTarget.prototype,
63 _wrapListener: function(listener) { 63 _wrapListener: function(listener) {
64 return function(message, sender, sendResponse) 64 return function(message, sender, sendResponse)
65 { 65 {
66 listener(message, {tab: sender.tab && new Tab(sender.tab)}, sendResponse ); 66 return listener(message, {tab: sender.tab && new Tab(sender.tab)}, sendR esponse);
67 }; 67 };
68 } 68 }
69 }; 69 };
70 70
71 71
72 /* API */ 72 /* API */
73 73
74 ext = { 74 ext = {
75 backgroundPage: { 75 backgroundPage: {
76 sendMessage: chrome.extension.sendRequest, 76 sendMessage: (chrome.runtime || {}).sendMessage || chrome.extension.sendRe quest,
77 getWindow: chrome.extension.getBackgroundPage 77 getWindow: chrome.extension.getBackgroundPage
78 }, 78 },
79 getURL: chrome.extension.getURL, 79 getURL: chrome.extension.getURL,
80 onMessage: new MessageEventTarget(), 80 onMessage: new MessageEventTarget(),
81 i18n: chrome.i18n 81 i18n: chrome.i18n
82 }; 82 };
83 })(); 83 })();
LEFTRIGHT

Powered by Google App Engine
This is Rietveld