Closed Bug 1766615 Opened 2 years ago Closed 2 years ago

Enable scripting APIs in MV2

Categories

(WebExtensions :: General, task, P2)

task

Tracking

(firefox102 fixed)

RESOLVED FIXED
102 Branch
Tracking Status
firefox102 --- fixed

People

(Reporter: willdurand, Assigned: willdurand)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete, Whiteboard: [addons-jira])

Attachments

(1 file, 2 obsolete files)

We will likely want to enable the scripting APIs in MV2 so let's have a pref to control that..

We should probably list this pref in the important prefs (troubleshooting) and possibly Telemetry as well, which would be similar to what we did recently for the other "MV3 prefs" in Bug 1764568.

Update (2022-05-06): we decided that we didn't need a pref.

This patch adds a postprocessor to control the scripting permission.
It is unconditionally enabled for MV3 and there is a new pref for MV2.

This patch also adds the new pref to about:support. A different patch
will likely add this same pref to the Telemetry environment (but we need
a data review).

Attachment #9274023 - Attachment description: Bug 1766615 - Include `extensions.scripting_apis.enabled` in Telemetry environment. r?rpl! → Bug 1766615 - Include `extensions.scriptingAPIs.enabled` in Telemetry environment. r?rpl!
Attachment #9274023 - Attachment is obsolete: true
Keywords: leave-open
Attachment #9274021 - Attachment description: Bug 1766615 - Add pref to expose the scripting APIs to MV2. r?rpl! → WIP: Bug 1766615 - Add pref to expose the scripting APIs to MV2. r?rpl!
Attachment #9274021 - Attachment description: WIP: Bug 1766615 - Add pref to expose the scripting APIs to MV2. r?rpl! → Bug 1766615 - Add pref to expose the scripting APIs to MV2. r?rpl!
Attachment #9274021 - Attachment is obsolete: true
Summary: Add pref to expose the scripting APIs to MV2 → Enable scripting APIs in MV2
Pushed by wdurand@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/74cf7a839ea5
Enable scripting APIs in MV2. r=rpl

Backed out for causing mochitest failures on test_ext_scripting_permissions.html.

Push with failures

Failure log

Backout link

[task 2022-05-06T13:19:03.285Z] 13:19:03     INFO - TEST-START | toolkit/components/extensions/test/mochitest/test_ext_scripting_permissions.html
[task 2022-05-06T13:19:03.509Z] 13:19:03     INFO - GECKO(4152) | Console message: Warning: attempting to write 10214 bytes to preference extensions.webextensions.uuids. This is bad for general performance and memory usage. Such an amount of data should rather be written to an external file. This preference will not be sent to any content processes.
[task 2022-05-06T13:19:05.202Z] 13:19:05     INFO - GECKO(4152) | Console message: [JavaScript Warning: "This page is in Quirks Mode. Page layout may be impacted. For Standards Mode use “<!DOCTYPE html>”." {file: "https://example.net/" line: 0}]
[task 2022-05-06T13:19:06.580Z] 13:19:06     INFO - GECKO(4152) | -----------------------------------------------------
[task 2022-05-06T13:19:06.582Z] 13:19:06     INFO - GECKO(4152) | Suppressions used:
[task 2022-05-06T13:19:06.583Z] 13:19:06     INFO - GECKO(4152) |   count      bytes template
[task 2022-05-06T13:19:06.585Z] 13:19:06     INFO - GECKO(4152) |      12        384 nsComponentManagerImpl
[task 2022-05-06T13:19:06.586Z] 13:19:06     INFO - GECKO(4152) |       2        288 libfontconfig.so
[task 2022-05-06T13:19:06.586Z] 13:19:06     INFO - GECKO(4152) | -----------------------------------------------------
[task 2022-05-06T13:19:06.895Z] 13:19:06     INFO - GECKO(4152) | Console message: [JavaScript Warning: "This page is in Quirks Mode. Page layout may be impacted. For Standards Mode use “<!DOCTYPE html>”." {file: "https://example.org/" line: 0}]
[task 2022-05-06T13:19:06.980Z] 13:19:06     INFO - GECKO(4152) | -----------------------------------------------------
[task 2022-05-06T13:19:06.980Z] 13:19:06     INFO - GECKO(4152) | Suppressions used:
[task 2022-05-06T13:19:06.980Z] 13:19:06     INFO - GECKO(4152) |   count      bytes template
[task 2022-05-06T13:19:06.980Z] 13:19:06     INFO - GECKO(4152) |      12        384 nsComponentManagerImpl
[task 2022-05-06T13:19:06.980Z] 13:19:06     INFO - GECKO(4152) |       2        288 libfontconfig.so
[task 2022-05-06T13:19:06.980Z] 13:19:06     INFO - GECKO(4152) | -----------------------------------------------------
[task 2022-05-06T13:19:08.169Z] 13:19:08     INFO - GECKO(4152) | Console message: [JavaScript Warning: "This page is in Quirks Mode. Page layout may be impacted. For Standards Mode use “<!DOCTYPE html>”." {file: "https://example.com/" line: 0}]
[task 2022-05-06T13:19:08.797Z] 13:19:08     INFO - GECKO(4152) | Console message: [JavaScript Warning: "This page is in Quirks Mode. Page layout may be impacted. For Standards Mode use “<!DOCTYPE html>”." {file: "https://example.org/?2" line: 0}]
[task 2022-05-06T13:19:51.012Z] 13:19:51     INFO - GECKO(4152) | Console message: [JavaScript Error: "Invalid ETag value "undefined"" {file: "resource://services-settings/SyncHistory.jsm" line: 50}]
[task 2022-05-06T13:19:51.014Z] 13:19:51     INFO - GECKO(4152) | store@resource://services-settings/SyncHistory.jsm:50:13
[task 2022-05-06T13:21:51.007Z] 13:21:51     INFO - GECKO(4152) | 1651843311006	addons.xpi	ERROR	System addon update list error Error: got node name: html, expected: updates
[task 2022-05-06T13:21:51.010Z] 13:21:51     INFO - GECKO(4152) | Console message: [JavaScript Error: "1651843311006	addons.xpi	ERROR	System addon update list error Error: got node name: html, expected: updates" {file: "resource://gre/modules/Log.jsm" line: 723}]
[task 2022-05-06T13:21:51.010Z] 13:21:51     INFO - GECKO(4152) | append@resource://gre/modules/Log.jsm:723:12
[task 2022-05-06T13:21:51.011Z] 13:21:51     INFO - GECKO(4152) | log@resource://gre/modules/Log.jsm:379:16
[task 2022-05-06T13:21:51.012Z] 13:21:51     INFO - GECKO(4152) | error@resource://gre/modules/Log.jsm:387:10
[task 2022-05-06T13:21:51.012Z] 13:21:51     INFO - GECKO(4152) | updateSystemAddons/res<@resource://gre/modules/addons/XPIInstall.jsm:4070:25
[task 2022-05-06T13:24:30.773Z] 13:24:30     INFO - TEST-INFO | started process screentopng
[task 2022-05-06T13:24:30.948Z] 13:24:30     INFO - TEST-INFO | screentopng: exit 0
[task 2022-05-06T13:24:30.948Z] 13:24:30     INFO - Buffered messages logged at 13:19:03
[task 2022-05-06T13:24:30.948Z] 13:24:30     INFO - add_task | Entering test setup
[task 2022-05-06T13:24:30.949Z] 13:24:30     INFO - add_task | Leaving test setup
[task 2022-05-06T13:24:30.950Z] 13:24:30     INFO - add_task | Entering test test_scripting_registerContentScripts_mv2
[task 2022-05-06T13:24:30.950Z] 13:24:30     INFO - Extension loaded
[task 2022-05-06T13:24:30.951Z] 13:24:30     INFO - Buffered messages logged at 13:19:08
[task 2022-05-06T13:24:30.952Z] 13:24:30     INFO - TEST-PASS | toolkit/components/extensions/test/mochitest/test_ext_scripting_permissions.html | expected: example.com, received: example.com 
[task 2022-05-06T13:24:30.952Z] 13:24:30     INFO - TEST-PASS | toolkit/components/extensions/test/mochitest/test_ext_scripting_permissions.html | permission request succeeded 
[task 2022-05-06T13:24:30.953Z] 13:24:30     INFO - Buffered messages finished
[task 2022-05-06T13:24:30.954Z] 13:24:30     INFO - TEST-UNEXPECTED-FAIL | toolkit/components/extensions/test/mochitest/test_ext_scripting_permissions.html | Test timed out. - 
[task 2022-05-06T13:24:31.790Z] 13:24:31     INFO - Not taking screenshot here: see the one that was previously logged
[task 2022-05-06T13:24:31.792Z] 13:24:31     INFO - TEST-UNEXPECTED-FAIL | toolkit/components/extensions/test/mochitest/test_ext_scripting_permissions.html | Extension left running at test shutdown 
[task 2022-05-06T13:24:31.793Z] 13:24:31     INFO -     SimpleTest.ok@SimpleTest/SimpleTest.js:417:16
[task 2022-05-06T13:24:31.793Z] 13:24:31     INFO -     ExtensionTestUtils.loadExtension/<@SimpleTest/ExtensionTestUtils.js:132:18
[task 2022-05-06T13:24:31.793Z] 13:24:31     INFO -     executeCleanupFunction@SimpleTest/SimpleTest.js:1487:13
[task 2022-05-06T13:24:31.794Z] 13:24:31     INFO -     SimpleTest.finish@SimpleTest/SimpleTest.js:1501:3
[task 2022-05-06T13:24:31.794Z] 13:24:31     INFO -     killTest@SimpleTest/TestRunner.js:194:22
[task 2022-05-06T13:24:31.805Z] 13:24:31     INFO - Not taking screenshot here: see the one that was previously logged
[task 2022-05-06T13:24:31.807Z] 13:24:31     INFO - TEST-UNEXPECTED-FAIL | toolkit/components/extensions/test/mochitest/test_ext_scripting_permissions.html | no tasks awaiting on messages - got "[\"script-ran\"]", expected "[]"
[task 2022-05-06T13:24:31.808Z] 13:24:31     INFO -     SimpleTest.is@SimpleTest/SimpleTest.js:500:14
[task 2022-05-06T13:24:31.809Z] 13:24:31     INFO -     ExtensionTestUtils.loadExtension/<@SimpleTest/ExtensionTestUtils.js:51:18
[task 2022-05-06T13:24:31.809Z] 13:24:31     INFO -     executeCleanupFunction@SimpleTest/SimpleTest.js:1487:13
[task 2022-05-06T13:24:31.823Z] 13:24:31     INFO - Not taking screenshot here: see the one that was previously logged
[task 2022-05-06T13:24:31.824Z] 13:24:31     INFO - TEST-UNEXPECTED-FAIL | toolkit/components/extensions/test/mochitest/test_ext_scripting_permissions.html | Test left extra windows or tabs: {"extraWindows":{},"extraTabs":{"0":"https://example.net/","1":"https://example.org/","2":"https://example.com/","3":"https://example.org/?2"}}
[task 2022-05-06T13:24:31.824Z] 13:24:31     INFO -  
[task 2022-05-06T13:24:31.825Z] 13:24:31     INFO -     SimpleTest.ok@SimpleTest/SimpleTest.js:417:16
[task 2022-05-06T13:24:31.826Z] 13:24:31     INFO -     @toolkit/components/extensions/test/mochitest/head.js:33:9
[task 2022-05-06T13:24:31.832Z] 13:24:31     INFO - GECKO(4152) | MEMORY STAT | vsize 20974622MB | residentFast 880MB
[task 2022-05-06T13:24:32.850Z] 13:24:32     INFO - TEST-OK | toolkit/components/extensions/test/mochitest/test_ext_scripting_permissions.html | took 329566ms
[task 2022-05-06T13:24:35.855Z] 13:24:35     INFO - Error: Unable to restore focus, expect failures and timeouts.
[task 2022-05-06T13:24:35.873Z] 13:24:35    ERROR - TEST-UNEXPECTED-FAIL | /tests/toolkit/components/extensions/test/mochitest/test_ext_scripting_permissions.html logged result after SimpleTest.finish(): Extension left running at test shutdown
[task 2022-05-06T13:24:35.875Z] 13:24:35    ERROR - TEST-UNEXPECTED-FAIL | /tests/toolkit/components/extensions/test/mochitest/test_ext_scripting_permissions.html logged result after SimpleTest.finish(): no tasks awaiting on messages
[task 2022-05-06T13:24:35.877Z] 13:24:35    ERROR - TEST-UNEXPECTED-FAIL | /tests/toolkit/components/extensions/test/mochitest/test_ext_scripting_permissions.html logged result after SimpleTest.finish(): Test left extra windows or tabs: {"extraWindows":{},"extraTabs":{"0":"https://example.net/","1":"https://example.org/","2":"https://example.com/","3":"https://example.org/?2"}}
[task 2022-05-06T13:24:35.877Z] 13:24:35    ERROR - 
[task 2022-05-06T13:24:35.893Z] 13:24:35     INFO - TEST-START | toolkit/components/extensions/test/mochitest/test_ext_scripting_removeCSS.html
Flags: needinfo?(wdurand)
Pushed by wdurand@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/aec4db172038
Enable scripting APIs in MV2. r=rpl

Backed out 2 changesets (Bug 1760451, Bug 1766615) for causing mochitest failures on test_ext_scripting_permissions.html.
Backout link
Push with failures <--> 2
Failure Log

Pushed by wdurand@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c97f68c18ab9
Enable scripting APIs in MV2. r=rpl
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 102 Branch
Flags: needinfo?(wdurand)

MDN documentation completed ahead of the feature being enabled, in https://github.com/mdn/content/pull/14725 and https://github.com/mdn/browser-compat-data/pull/15872 .

Since MV3 was not enabled by default, the release associated with this bug is a more accurate reflection of the scripting API availability.
I have therefore updated the BCD to list version 102 instead of 101: https://github.com/mdn/browser-compat-data/pull/18879

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: