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

Delta Between Two Patch Sets: ext/content.js

Issue 29711592: Issue 6424 - Use internal symbol in ext namespace (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Left Patch Set: Add base.js Created Feb. 28, 2018, 3:24 p.m.
Right 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 /* global internal */ 1 /* global internal */
2 2
3 "use strict"; 3 "use strict";
4 4
5 // Firefox 55 erroneously sends messages from the content script to the 5 // Firefox 55 erroneously sends messages from the content script to the
6 // devtools panel: 6 // devtools panel:
7 // https://bugzilla.mozilla.org/show_bug.cgi?id=1383310 7 // https://bugzilla.mozilla.org/show_bug.cgi?id=1383310
8 // 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.
9 // Note that Firefox processes API access lazily, so browser.devtools will 9 // Note that Firefox processes API access lazily, so browser.devtools will
10 // 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.
11 if (!browser.devtools) 11 if (!browser.devtools)
12 { 12 {
13 // Listen for messages from the background page. 13 // Listen for messages from the background page.
14 browser.runtime.onMessage.addListener((message, sender, sendResponse) => 14 browser.runtime.onMessage.addListener((message, sender, sendResponse) =>
15 { 15 {
16 return ext[internal].dispatchEvent( 16 return ext.onMessage[internal].dispatch(
17 ext.onMessage,
18 message, {}, sendResponse 17 message, {}, sendResponse
19 ).includes(true); 18 ).includes(true);
20 }); 19 });
21 } 20 }
22 21
23 { 22 {
24 let port = null; 23 let port = null;
25 24
26 ext.onExtensionUnloaded = { 25 ext.onExtensionUnloaded = {
27 addListener(listener) 26 addListener(listener)
(...skipping 13 matching lines...) Expand all
41 40
42 if (!port.onDisconnect.hasListeners()) 41 if (!port.onDisconnect.hasListeners())
43 { 42 {
44 port.disconnect(); 43 port.disconnect();
45 port = null; 44 port = null;
46 } 45 }
47 } 46 }
48 } 47 }
49 }; 48 };
50 } 49 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld