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: Created Feb. 28, 2018, 3:08 p.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[internal].dispatchEvent(
17 ext.onMessage,
18 message, {}, sendResponse
19 ).includes(true);
15 }); 20 });
16 } 21 }
17 22
18 { 23 {
19 let port = null; 24 let port = null;
20 25
21 ext.onExtensionUnloaded = { 26 ext.onExtensionUnloaded = {
22 addListener(listener) 27 addListener(listener)
23 { 28 {
24 if (!port) 29 if (!port)
(...skipping 11 matching lines...) Expand all
36 41
37 if (!port.onDisconnect.hasListeners()) 42 if (!port.onDisconnect.hasListeners())
38 { 43 {
39 port.disconnect(); 44 port.disconnect();
40 port = null; 45 port = null;
41 } 46 }
42 } 47 }
43 } 48 }
44 }; 49 };
45 } 50 }
OLDNEW

Powered by Google App Engine
This is Rietveld