Closed Bug 1454342 Opened 6 years ago Closed 2 years ago

executeScript error: frameId and allFrames are mutually exclusive

Categories

(WebExtensions :: Compatibility, defect, P5)

60 Branch
defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: eight04, Assigned: robwu)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete)

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0
Build ID: 20180412172954

Steps to reproduce:

I encountered this bug while developing an extension:

1. Create a webextension.
2. From the background page, call `executeScript` with `frameId` and `allFrames` arguments at the same time.

I also made a demo repo:

1. Clone https://github.com/eight04/webextension-test. (The executable path inside package.json probably has to be modified.)
2. Run command `npm install && npm start`. It installs web-ext and launches the browser.
3. Open the addon debugger and the error is shown.


Actual results:

The promise returned by executeScript is rejected with the following error:
Error: 'frameId' and 'allFrames' are mutually exclusive



Expected results:

Quote from MDN:

> allFrames Optional
> ... If true and frameId is set, then the code will be injected into the specified frame and all its child frames. ...

https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/tabs/executeScript#Parameters

I also found a ticket related to this issue, which is under the documentation category:
https://bugzilla.mozilla.org/show_bug.cgi?id=1346941
This is not a bug. frameId and allFrames are mutually exclusive.

The documentation should be fixed, though.
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → INVALID
Product: Toolkit → WebExtensions
I have re-opened the other bug because it is older and has a test case for QA, and will mark this as a duplicate against that other bug.
Resolution: INVALID → DUPLICATE
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: DUPLICATE → ---
Note: The other bug has STR that QA can use to verify this bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1346941#c1


We decided to re-open this bug because this restriction is an unnecessary difference in compatibility with the behavior of Chrome's tabs.executeScript API.
Assignee: nobody → rob
Component: Untriaged → Compatibility
I'm holding off the implementation until the refactor in bug 1484373 has landed and sticks.
Priority: -- → P5

tabs.executeScript is part of MV2.

Its successor, scripting.executeScript explicitly marks the allFrames and frameIds as a mutually exclusive:

"You cannot specify both the frameIds and allFrames properties."

This is being implemented in bug 1736574.

The mutual exclusiveness of allFrames and frameIds is already documented at https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/executeScript#parameters:

allFrames Optional
If true and frameId is set, then it will raise an error. (frameId and allFrames are mutually exclusive.)

Status: REOPENED → RESOLVED
Closed: 6 years ago2 years ago
Resolution: --- → WONTFIX
See Also: → 1736574
You need to log in before you can comment on or make changes to this bug.