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

Unified Diff: lib/contentFiltering.js

Issue 29850574: Issue 6841 - Avoid passing frameId of 0 to tabs.executeScript (Closed)
Patch Set: Created Aug. 8, 2018, 2:49 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/contentFiltering.js
diff --git a/lib/contentFiltering.js b/lib/contentFiltering.js
index e8ea25075a19ed203cc92c22f126c2776b9f6aa1..228ef00183ca4ccb18d0715324f157710ebd5b91 100644
--- a/lib/contentFiltering.js
+++ b/lib/contentFiltering.js
@@ -180,12 +180,18 @@ function executeScript(script, tabId, frameId)
{
try
{
- browser.tabs.executeScript(tabId, {
+ let details = {
code: getExecutableCode(script),
- frameId,
matchAboutBlank: true,
runAt: "document_start"
- })
+ };
+
+ // Chrome <50 throws an exception if chrome.tabs.executeScript is called
+ // with a frameId of 0.
+ if (frameId != 0)
+ details.frameId = frameId;
+
+ browser.tabs.executeScript(tabId, details)
.catch(error =>
{
// Sometimes a frame is added and removed very quickly, in such cases we
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld