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

Delta Between Two Patch Sets: ext/content.js

Issue 29482663: Issue 5386 - Ignore messages from content scripts in devtools panel (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Left Patch Set: Use consistent style for checking for availability of API Created Aug. 16, 2017, 9:24 a.m.
Right Patch Set: Use includes instead of indexOf Created Aug. 16, 2017, 10:29 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
« no previous file with change/comment | « no previous file | 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 "use strict"; 1 "use strict";
2 2
3 // Firefox 55 erroneously sends messages from the content script to the 3 // Firefox 55 erroneously sends messages from the content script to the
4 // devtools panel: 4 // devtools panel:
5 // https://bugzilla.mozilla.org/show_bug.cgi?id=1383310 5 // https://bugzilla.mozilla.org/show_bug.cgi?id=1383310
6 // As a workaround, listen for messages only if this isn't the devtools panel. 6 // As a workaround, listen for messages only if this isn't the devtools panel.
7 if (!("devtools" in chrome)) 7 if (!("devtools" in chrome))
8 { 8 {
9 // Listen for messages from the background page. 9 // Listen for messages from the background page.
10 chrome.runtime.onMessage.addListener((message, sender, sendResponse) => 10 chrome.runtime.onMessage.addListener((message, sender, sendResponse) =>
11 { 11 {
12 return ext.onMessage._dispatch(message, {}, sendResponse).indexOf(true) != 12 return ext.onMessage._dispatch(message, {}, sendResponse).includes(true);
Sebastian Noack 2017/08/16 10:15:00 While changing this code anyway, you might want to
Manish Jethani 2017/08/16 10:30:36 I'm assuming you meant `.includes(true)` Done.
Sebastian Noack 2017/08/16 10:34:56 Sure, that is what I meant, sorry.
13 -1;
14 }); 13 });
15 } 14 }
16 15
17 (function() 16 (function()
18 { 17 {
19 let port = null; 18 let port = null;
20 19
21 ext.onExtensionUnloaded = { 20 ext.onExtensionUnloaded = {
22 addListener(listener) 21 addListener(listener)
23 { 22 {
(...skipping 12 matching lines...) Expand all
36 35
37 if (!port.onDisconnect.hasListeners()) 36 if (!port.onDisconnect.hasListeners())
38 { 37 {
39 port.disconnect(); 38 port.disconnect();
40 port = null; 39 port = null;
41 } 40 }
42 } 41 }
43 } 42 }
44 }; 43 };
45 }()); 44 }());
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld