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

Side by Side Diff: ext/content.js

Issue 29711592: Issue 6424 - Use internal symbol in ext namespace (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Switch to internal methods everywhere Created March 1, 2018, 11:58 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* global internal */
2
1 "use strict"; 3 "use strict";
2 4
3 // Firefox 55 erroneously sends messages from the content script to the 5 // Firefox 55 erroneously sends messages from the content script to the
4 // devtools panel: 6 // devtools panel:
5 // https://bugzilla.mozilla.org/show_bug.cgi?id=1383310 7 // https://bugzilla.mozilla.org/show_bug.cgi?id=1383310
6 // As a workaround, listen for messages only if this isn't the devtools panel. 8 // As a workaround, listen for messages only if this isn't the devtools panel.
7 // Note that Firefox processes API access lazily, so browser.devtools will 9 // Note that Firefox processes API access lazily, so browser.devtools will
8 // always exist but will have undefined as its value on other pages. 10 // always exist but will have undefined as its value on other pages.
9 if (!browser.devtools) 11 if (!browser.devtools)
10 { 12 {
11 // Listen for messages from the background page. 13 // Listen for messages from the background page.
12 browser.runtime.onMessage.addListener((message, sender, sendResponse) => 14 browser.runtime.onMessage.addListener((message, sender, sendResponse) =>
13 { 15 {
14 return ext.onMessage._dispatch(message, {}, sendResponse).includes(true); 16 return ext.onMessage[internal].dispatch(
17 message, {}, sendResponse
18 ).includes(true);
15 }); 19 });
16 } 20 }
17 21
18 { 22 {
19 let port = null; 23 let port = null;
20 24
21 ext.onExtensionUnloaded = { 25 ext.onExtensionUnloaded = {
22 addListener(listener) 26 addListener(listener)
23 { 27 {
24 if (!port) 28 if (!port)
(...skipping 11 matching lines...) Expand all
36 40
37 if (!port.onDisconnect.hasListeners()) 41 if (!port.onDisconnect.hasListeners())
38 { 42 {
39 port.disconnect(); 43 port.disconnect();
40 port = null; 44 port = null;
41 } 45 }
42 } 46 }
43 } 47 }
44 }; 48 };
45 } 49 }
OLDNEW
« ext/background.js ('K') | « ext/common.js ('k') | lib/requestBlocker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld