Closed Bug 1688688 Opened 3 years ago Closed 3 years ago

Add a simple helper to start devtools for wptrunner

Categories

(DevTools :: General, task, P3)

task

Tracking

(firefox88 fixed)

RESOLVED FIXED
88 Branch
Tracking Status
firefox88 --- fixed

People

(Reporter: jdescottes, Assigned: jdescottes)

Details

Attachments

(2 files)

Web platform tests are adding support for opening DevTools on the test window. However, we lack a good single helper to do that so a bunch of devtools-specific code had to be written: https://github.com/web-platform-tests/wpt/pull/27309/files#diff-df97e1990f484c82b8d8a34baf584d01761bfd98386beb69fac702edb31003a3R630-R651

class MarionetteDebugProtocolPart(DebugProtocolPart):
    def setup(self):
        self.marionette = self.parent.marionette

    def load_devtools(self):
        with self.marionette.using_context(self.marionette.CONTEXT_CHROME):
            self.parent.base.execute_script("""
const { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm");
const { TargetFactory } = require("devtools/client/framework/target");
const { gDevTools } = require("devtools/client/framework/devtools");
const callback = arguments[arguments.length - 1];
async function loadDevTools() {
    const target = await TargetFactory.forTab(window.gBrowser.selectedTab);
    await gDevTools.showToolbox(target, "webconsole", "bottom");
}
loadDevTools().catch(() => dump("Devtools failed to load"))
              .then(callback);
""", asynchronous=True)

We should expose a single helper method allowing to easily open DevTools. Maybe from DevToolsShim.jsm ? Otherwise we might break this without realizing it.

We are going to refactor code around TargetFactory.forTab, mostly to use descriptors instead of targets, we should take care of that now.

Assignee: nobody → jdescottes
Status: NEW → ASSIGNED

The webplatform test runner recently added an option to open devtools during their tests.
The current implementation relies on TargetFactory::forTab and gDevTools::showToolbox.
Those methods will most likely change as we move away from targets and start using descriptors.

See previous WPT PR at https://github.com/web-platform-tests/wpt/pull/27309
Will open a PR on the wpt repo to update their snippet when this lands in m-c

Depends on D105740

WPT runner can target several older versions of Firefox, so only use the new showToolboxForTab when the API is available on DevToolsShim

Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8a0f5c24ed9a
[devtools] Add a simple helper to start devtools for wptrunner r=ladybenko
https://hg.mozilla.org/integration/autoland/rev/ae1fa0484c91
Use showToolboxTab to open DevTools in wpt marionetteexecutor r=jgraham
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/27777 for changes under testing/web-platform/tests
Upstream PR was closed without merging

I missed one non-devtools callsite for forTab...

Flags: needinfo?(jdescottes)

Also had a quick look at the TV failures, they seem to also fail on repeat without my patches

Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4bbd72c94c26
[devtools] Add a simple helper to start devtools for wptrunner r=ladybenko
https://hg.mozilla.org/integration/autoland/rev/546a19a61366
Use showToolboxTab to open DevTools in wpt marionetteexecutor r=jgraham
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 88 Branch
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: