Commit Graph

22449 Commits

Author SHA1 Message Date
Julian Descottes
6ead96bb08 Bug 1694140 - [devtools] Remove unused getTargetForTab helper on gDevTools r=ochameau
Depends on D106001

This is only used internally: https://searchfox.org/mozilla-central/search?path=&q=getTargetForTab
Can be inlined and removed from DevToolsShim

Differential Revision: https://phabricator.services.mozilla.com/D106002
2021-02-25 18:02:53 +00:00
Julian Descottes
d9b1d58f33 Bug 1694140 - [devtools] Stop using TargetFactory forTab in devtools browser mochitests r=nchevobbe
Depends on D105999

This patch is mostly a mechanical rewrite of:
```lang=javascript
const target = await TargetFactory.forTab(tab);
const toolbox = await gDevTools.showToolbox(target, "inspector");
```
to
```lang=javascript
const toolbox = await gDevTools.showToolboxForTab(tab, { toolId: "inspector" });
```

The main changes are:
- if the target was actually used in the test, it is now retrieved from toolbox.target
- the arguments for showToolboxForTab are using an option argument, to avoid the occasional showToolbox("inspector", null, null, null, startTime, null, reason);

I suspect that any signature rewrite mistake would have been caught on try.
There a few less mechanical changes:
- devtools/client/framework/test/browser_toolbox_screenshot_tool.js the toolId "console" was omitted because this id doesn't match any tool (author probably meant "webconsole")
- a few tests were: 1/ first creating a target, 2/ looping on tool definitions to get supported tools 3/ opening the toolbox with each supported tool. To support this I extracted a helper called `getSupportedToolIds` which opens a temporary toolbox to list all supported tool ids
- all the tests under storage/ use a single helper to start the test, which can open toolboxes for both tab targets and other targets. This made it more complicated to refactor. We could also drop this part and just refactor each test when we actually modify forTab/showToolbox to only work with descriptors

All in all the goal of this stack is to pave the way to stop handling targets when using forTab/showToolbox, and behind the scenes stop replying on targets to cache open toolboxes. We don't aim to kill all the call sites, just get them to a smaller number so that the next refactors will be easier.

Differential Revision: https://phabricator.services.mozilla.com/D106000
2021-02-25 18:02:52 +00:00
Julian Descottes
d0f4645a76 Bug 1694140 - [devtools] Stop using TargetFactory.forTab in devtools code r=perftest-reviewers,ochameau
Depends on D105998

Differential Revision: https://phabricator.services.mozilla.com/D105999
2021-02-25 18:02:51 +00:00
Julian Descottes
953b5c230b Bug 1694140 - [devtools] Add getToolboxForTab and closeToolboxForTab helpers on gDevTools r=ochameau
Depends on D105743

Differential Revision: https://phabricator.services.mozilla.com/D105998
2021-02-25 18:02:51 +00:00
Julian Descottes
12c3715f97 Bug 1688688 - [devtools] Add a simple helper to start devtools for wptrunner r=ladybenko
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

Differential Revision: https://phabricator.services.mozilla.com/D105740
2021-02-25 18:02:50 +00:00
Nicolas Chevobbe
86d30fc573 Bug 1692970 - [devtools] Remove code handling fixed element in screenshot content actor. r=ladybenko,devtools-backward-compat-reviewers.
With Bug 1688813 drawSnapshot will handle fixed element, so we don't have to do
it from DevTools code.

We can remove this._lastScrollPosition in the screenshotContentActor, which means
we can also get rid of captureDone, which was only used to set the original scroll
position back.

Differential Revision: https://phabricator.services.mozilla.com/D106065
2021-02-25 16:18:52 +00:00
Brindusan Cristian
39abcde940 Backed out 10 changesets (bug 1694140, bug 1694886, bug 1688688) for devtools failures on browser_CORS-console-warnings.js. CLOSED TREE
Backed out changeset 1b7367a27d9a (bug 1694886)
Backed out changeset d5a70a3143ad (bug 1694140)
Backed out changeset 74adaced5c0a (bug 1694140)
Backed out changeset 0b8f857e3f90 (bug 1694140)
Backed out changeset 45a8dc952aba (bug 1694140)
Backed out changeset 299f17e9cb6f (bug 1694140)
Backed out changeset 6beb9dd48ef3 (bug 1694140)
Backed out changeset 5f6688e8fe4c (bug 1694140)
Backed out changeset ae1fa0484c91 (bug 1688688)
Backed out changeset 8a0f5c24ed9a (bug 1688688)
2021-02-25 16:07:39 +02:00
Nicolas Chevobbe
ccd6e112a5 Bug 1694873 - [devtools] Fix browser_webconsole_network_messages_status_code.js intermittent. .
Differential Revision: https://phabricator.services.mozilla.com/D106429
2021-02-25 13:27:45 +00:00
Julian Descottes
2349ac9ca8 Bug 1694886 - [devtools] Extract test helper getTargetForTab(tab) to shared-head.js r=nchevobbe
Depends on D106037

Differential Revision: https://phabricator.services.mozilla.com/D106405
2021-02-25 12:58:16 +00:00
Julian Descottes
13d48a2ee6 Bug 1694140 - [devtools] Rename TargetFactory to TabTargetFactory and update filename r=ochameau
Depends on D106032

Differential Revision: https://phabricator.services.mozilla.com/D106037
2021-02-25 12:58:16 +00:00
Julian Descottes
86d04516e5 Bug 1694140 - [devtools] Stop using TargetFactory:forTab in netmonitor to retrieve the parent toolbox r=bomsy,ochameau
Depends on D106002

The goal is to reduce the usage of the getToolbox(target) API.
It feels like exposing toolbox on the connector should be a more straightforward way of achieving the same thing?

Differential Revision: https://phabricator.services.mozilla.com/D106032
2021-02-25 12:58:15 +00:00
Julian Descottes
2c32ed1ce4 Bug 1694140 - [devtools] Remove unused getTargetForTab helper on gDevTools r=ochameau
Depends on D106001

This is only used internally: https://searchfox.org/mozilla-central/search?path=&q=getTargetForTab
Can be inlined and removed from DevToolsShim

Differential Revision: https://phabricator.services.mozilla.com/D106002
2021-02-25 12:58:15 +00:00
Julian Descottes
982c525960 Bug 1694140 - [devtools] Stop using TargetFactory forTab in devtools browser mochitests r=nchevobbe
Depends on D105999

This patch is mostly a mechanical rewrite of:
```lang=javascript
const target = await TargetFactory.forTab(tab);
const toolbox = await gDevTools.showToolbox(target, "inspector");
```
to
```lang=javascript
const toolbox = await gDevTools.showToolboxForTab(tab, { toolId: "inspector" });
```

The main changes are:
- if the target was actually used in the test, it is now retrieved from toolbox.target
- the arguments for showToolboxForTab are using an option argument, to avoid the occasional showToolbox("inspector", null, null, null, startTime, null, reason);

I suspect that any signature rewrite mistake would have been caught on try.
There a few less mechanical changes:
- devtools/client/framework/test/browser_toolbox_screenshot_tool.js the toolId "console" was omitted because this id doesn't match any tool (author probably meant "webconsole")
- a few tests were: 1/ first creating a target, 2/ looping on tool definitions to get supported tools 3/ opening the toolbox with each supported tool. To support this I extracted a helper called `getSupportedToolIds` which opens a temporary toolbox to list all supported tool ids
- all the tests under storage/ use a single helper to start the test, which can open toolboxes for both tab targets and other targets. This made it more complicated to refactor. We could also drop this part and just refactor each test when we actually modify forTab/showToolbox to only work with descriptors

All in all the goal of this stack is to pave the way to stop handling targets when using forTab/showToolbox, and behind the scenes stop replying on targets to cache open toolboxes. We don't aim to kill all the call sites, just get them to a smaller number so that the next refactors will be easier.

Differential Revision: https://phabricator.services.mozilla.com/D106000
2021-02-25 12:58:14 +00:00
Julian Descottes
5b183d1d77 Bug 1694140 - [devtools] Stop using TargetFactory.forTab in devtools code r=perftest-reviewers,ochameau
Depends on D105998

Differential Revision: https://phabricator.services.mozilla.com/D105999
2021-02-25 12:58:14 +00:00
Julian Descottes
a49f853e14 Bug 1694140 - [devtools] Add getToolboxForTab and closeToolboxForTab helpers on gDevTools r=ochameau
Depends on D105743

Differential Revision: https://phabricator.services.mozilla.com/D105998
2021-02-25 12:58:13 +00:00
Julian Descottes
050bfe4fcb Bug 1688688 - [devtools] Add a simple helper to start devtools for wptrunner r=ladybenko
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

Differential Revision: https://phabricator.services.mozilla.com/D105740
2021-02-25 12:58:12 +00:00
Nicolas Chevobbe
58384d36be Bug 1651398 - [devtools] Fix browser_webconsole_network_messages_status_code.js intermittent. r=bomsy.
Differential Revision: https://phabricator.services.mozilla.com/D105980
2021-02-24 13:37:01 +00:00
Nicolas Chevobbe
9fb3337fb2 Bug 1694090 - [devtools] Don't await for startListening on each loop iteration in ResourceWatcher#_onTargetAvailable. r=jdescottes.
This wasn't needed and could introduce unnecessary delays, so we do all the calls
at the same time and then await for all the calls to be settled.

Differential Revision: https://phabricator.services.mozilla.com/D105944
2021-02-24 13:20:19 +00:00
Nicolas Chevobbe
f5981acf25 Bug 1693846 - [devtools] Fix Storage actor listStores so it can handles multiple concurrent calls. r=ladybenko.
If there was multiple concurrent calls to listStores, only the last one made would
resolve, the other one would be stuck indefinitely.
This was caused by the call to indexedDb actor `preListStores` method, in which
the `hostVsStores` is reset to an empty Map. So if there was still a previous
pending call, one of the promise who was relying on an entry being in `hostVsStores`
would never resolve.
To prevent this, we cache the pending promise when calling `preListStores` so any
concurrent calls would wait for the same promise.
A test is added to make sure we don't regress in the future.

Differential Revision: https://phabricator.services.mozilla.com/D105943
2021-02-24 13:20:18 +00:00
Sebastian Zartner
3fcc126250 Bug 1651649 - Use toggle button for switching between raw and formatted response view. r=Honza,bomsy
The accordion widget inside the response view of the Network Monitor got replaced by a simple headline with a toggle button at the end.

Differential Revision: https://phabricator.services.mozilla.com/D103839
2021-02-24 10:09:36 +00:00
Masayuki Nakano
876ef492b9 Bug 1691622 - part 11: Make mochitests stop using nsIDOMWindowUtils.sendNativeMouseEvent directly as far as possible r=smaug
For making the test framework/API change easier, such raw API shouldn't be
used directly.  Therefore, this patch makes tests using it directly stop
using it and use `synthesizeNativeMouseEvent` instead.

However, this patch does not fix `browser_touch_event_iframes.js` because
it accesses the API from `ContentTask`.  So, `EventUtils.js` isn't available
without larger change.

Note that this patch disables `test_bug596600.xhtml` because as I commented
in it, it's completely broken.  It depends on the race of next native event
loop and `waitForTick`, and this patch changes the result of the race.

Differential Revision: https://phabricator.services.mozilla.com/D105765
2021-02-24 01:27:11 +00:00
Masayuki Nakano
ef2253b4a1 Bug 1691622 - part 9: Make nsIWidget::SynthesizeNativeMouseEvent take an XP button ID and abstract message value r=smaug,geckoview-reviewers,agi,m_kato
Currently, it takes a raw native message value, but it makes JS content too
complicated.  And on Linux, it cannot synthesize non-primary button events
because GDK has only button press and release messages which dont' include
mouse button information.

For solving these problems, this patch creates a new abstract native message
as `nsIWidget::NativeMouseMessage` and makes each widget converts it to
a platform native message.

Additionally, this patch adds an argument to make it possible its callers
to specify pressing or releasing mouse button with a DOM mouse button value.

Note that the following patch adds new argument to
`synthesizeNativeEventMouse*` for mochitests and which will be tested by
new tests.

Differential Revision: https://phabricator.services.mozilla.com/D105763
2021-02-24 01:27:10 +00:00
Julian Descottes
5618cad244 Bug 1692995 - [devtools] Support early calls to unwatchResources r=ochameau
Differential Revision: https://phabricator.services.mozilla.com/D105295
2021-02-23 11:59:59 +00:00
Yogita
6bd700d7de Bug 1674307 - Add focusin and focusout checkboxes in Event Listener Breakpoints r=bomsy
Differential Revision: https://phabricator.services.mozilla.com/D103441
2021-02-23 08:46:42 +00:00
Tom Tung
f8a32ec9bc Bug 1665942 - Collect userContextId from tab in _collectBaseTabData and stop collecting it in the session history collection; r=nika,geckoview-reviewers,agi
### Story

When a COOP+COEP page is opened, we change the remoteness of the tab. After
changing the remoteness, the tab is then restored by its TabState. However,
we haven't collected userContextId through the current mechanism.

To fix that, this patch changes the way to collect userContextId.

### Test Plan

Test: D98296

Depends on D98296

Differential Revision: https://phabricator.services.mozilla.com/D98468
2021-02-23 08:28:57 +00:00
Alexandre Poirot
c2b5a6345f Bug 1685474 - [devtools] Stop having intermediate "storage resources" dictionary. r=ladybenko
* onResourceListAvailable and populateStorageTree were both computing distinct dictinary. `storages` versus `this.storageResources` (with the resourcesWithHosts making them both differents). It is easier to follow if we have only one dictionary, build by onResourceListAvailable and that's the straight object given by the ResourceWatcher API.
* Since we migrated to resources API. `resources` object passed to onResourceAvailable
should no longer have any `from` attribute. This is no longer a RDP packet, but an array computed by the ResourceWatcher API.
* This isn't really useful to filter out resources with empty `hosts` because `populateTreeFromResource` will be a noop
if that's empty. I think it is easier to follow if we pass all the resources to this method.

Differential Revision: https://phabricator.services.mozilla.com/D105646
2021-02-22 21:04:20 +00:00
Alexandre Poirot
cfda62b223 Bug 1685474 - [devtools] Rename storageTypes to storageResources. r=ladybenko
This variable name was confusing and didn't help understand the great complexity of this object.
This is a dictionary of storage resources, which also happen to be fronts, keyed by storage type/key (string).

Differential Revision: https://phabricator.services.mozilla.com/D105645
2021-02-22 21:04:20 +00:00
Alexandre Poirot
83b6a355d2 Bug 1685474 - [devtools] Update StorageFront/Resource's hosts attribute on single-store-update events r=ladybenko
Differential Revision: https://phabricator.services.mozilla.com/D105345
2021-02-22 21:04:20 +00:00
Alexandre Poirot
256ca192eb Bug 1685474 - [devtools] Clear storage fronts/resources when a target is destroyed. r=ladybenko
Differential Revision: https://phabricator.services.mozilla.com/D105224
2021-02-22 21:04:19 +00:00
Alexandre Poirot
edce8d4404 Bug 1685474 - [devtools] Stop using resource-updated and resource-destroyed for storage resources. r=ladybenko,devtools-backward-compat-reviewers
Resource updates and destroyed were ignored because the singleton storage resource
was cleaned on will-navigate.
So, we instead revert back to listen to events on fronts.
But instead of listening to a unique event on storageFront,
we listen to each individual storage resource front (one per type and per target).
This is why we have to do some filtering, still. Both on legacy listener and Watcher classes.

I'm also clarfifying things a bit in ContentProcessStorageWatcher,
I forked StorageActor completely, while removing its protocol.js Actor inheritance
and some stuff that we don't need for the Watcher class.

This help emitting stores-updated and stores-cleared and reuse the exact same
code between legacy listener and watcher class regarding filtering.

Differential Revision: https://phabricator.services.mozilla.com/D104687
2021-02-22 21:04:19 +00:00
Nicolas Chevobbe
b6962abbfe Bug 1694148 - [devtools] Fix browser_console_webconsole_private_browsing.js. r=ochameau.
This patch fixes the existing test that was flawed, checking if messages weren't
displayed too early, so messages didn't have the time to be rendered.
When checking later, we can see that the messages were displayed when they
shouldn't have been.

Depends on D105945

Differential Revision: https://phabricator.services.mozilla.com/D105972
2021-02-22 14:29:10 +00:00
Alexandre Poirot
9e4945cf59 Bug 1693854 - Disable console resources in targets other than tabs. r=nchevobbe
The missing resource-available-form event on content process target specifications
break console resources for content process targets.
Adding this event will probably create duplicate and so requires some more analysis.

Differential Revision: https://phabricator.services.mozilla.com/D105945
2021-02-22 14:11:25 +00:00
Itiel
278f4019e3 Bug 1693899 - Make checkbox and radio options span the text instead of the content width of the page r=julienw DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D105870
2021-02-22 14:00:00 +00:00
Julian Descottes
0def910234 Bug 1600291 - [devtools] Remove gDevToolsBrowser.openWorkerToolbox r=ochameau
Differential Revision: https://phabricator.services.mozilla.com/D105780
2021-02-22 13:40:42 +00:00
Stephen A Pohl
23452bcb06 Bug 1690891: Fix browser_dbg-dom-mutation-breakpoints-fission.js to pass on macOS with the non-native theme enabled. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D105806
2021-02-22 13:01:36 +00:00
Alexandre Poirot
1d1e362316 Bug 1690742 - [devtools] - Remove flow plugin and stop running flow on try r=nchevobbe,bomsy
Remove references to flow in build files.
This effectively stop stipping flow from debugger modules.
So any leftover would now start being kept in production file and do an error.

Differential Revision: https://phabricator.services.mozilla.com/D105330
2021-02-22 10:48:53 +00:00
Alexandre Poirot
0eb9a9859f Bug 1690742 - [devtools] - Remove eslint settings about flow. r=nchevobbe,bomsy
Differential Revision: https://phabricator.services.mozilla.com/D105657
2021-02-22 10:48:53 +00:00
Alexandre Poirot
ed507be3f8 Bug 1690742 - [devtools] - Strip flow from the debugger sources. r=nchevobbe,bomsy
This is a mixed of automated and manual changes.
See abandoned revisions on phabricator for a detailed breakdown.

Differential Revision: https://phabricator.services.mozilla.com/D105324
2021-02-22 10:48:52 +00:00
Emilio Cobos Álvarez
6825bbc8f8 Bug 1693688 - Make the non-native theme not return minimum sizes for checkboxes (and most other widgets). r=spohl,mstange
This matches closer what Chrome and Safari do (Safari paints outside of
the box when this happens, but the layout box still respects the
author), see:

  data:text/html,<button style="padding: 0; width: 0">
  data:text/html,<input type=checkbox style="width: 0">

Etc. For checkboxes, this matches what OSX does, too.

Since we still want checkboxes to be slightly larger than what they'd be
otherwise, we add a hook to tweak it when non-native theme is enabled.

Differential Revision: https://phabricator.services.mozilla.com/D105798
2021-02-20 00:13:10 +00:00
Daisuke Akatsuka
7c1a6365c1 Bug 1693694: Update MDN compat data. r=Honza
Differential Revision: https://phabricator.services.mozilla.com/D105706
2021-02-19 15:16:53 +00:00
Nicolas Chevobbe
e45ee54643 Bug 1691392 - [devtools] Fix eyedropper intermittents. r=ladybenko.
We had failure in tests calling TestActor `getEyeDropperColorValue` method as
we were getting an empty string back.
I couldn't reproduce, but I suspect that it can happen that even if the element
is visible, the text isn't rendered yet somehow.
To fix this issue, we wait until we do get a non empty string for the color-value
element.

Differential Revision: https://phabricator.services.mozilla.com/D105582
2021-02-19 14:48:55 +00:00
Nicolas Chevobbe
c90796d458 Bug 1691590 - [devtools] Fix intermittent failure on devtools/shared/resources/tests/browser_resources_stylesheets.js. r=jdescottes.
The test was assuming that resources are coming in a constant order, which is not
the case. We use find to retrieve the resource we want instead.
There was another weird intermittent with the media query induced resource update
not being triggered. It looks like the resourceId that was used, a simple count
increment, could lead to duplicate ids that would mess with the other methods
of the watcher. Including the target actorID in the resourceId seems to fix the issue.

Differential Revision: https://phabricator.services.mozilla.com/D105722
2021-02-19 13:28:16 +00:00
Julian Descottes
5e9590e26a Bug 1693626 - [devtools] Remote debugging visual cue for devtools should update dynamically r=nchevobbe
It should also not be displayed for the browser toolbox.

I messed up strings with the initial landing:
- wrong event name used in browser.js (no dynamic update)
- wrong flag passed from BT launcher (stripes show up when BT is used)

Sorry about that

Differential Revision: https://phabricator.services.mozilla.com/D105666
2021-02-19 06:34:59 +00:00
Alexandre Poirot
17df6d9066 Bug 1692874 - [devtools] Read isLocalTab from descriptor instead of target front. r=rpl,jdescottes
There is still some usages in isTargetSupported,
but that would requires refactoring this method into isDescriptorSupported
and be async as some isTargetSupported only works against target as it checks for traits on it.

Differential Revision: https://phabricator.services.mozilla.com/D105201
2021-02-18 18:36:48 +00:00
Alexandre Poirot
1956957ae8 Bug 1692874 - [devtools] Use descriptors instead of targets in TargetList/Toolbox r=jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D105200
2021-02-18 18:36:47 +00:00
Julian Descottes
f5abfe3c32 Bug 1691607 - [devtools] Fix and re-enable browser_inspector_navigate_to_errors.js test for Fission r=nchevobbe
Depends on D105623

Differential Revision: https://phabricator.services.mozilla.com/D105624
2021-02-18 17:09:29 +00:00
Julian Descottes
6066277874 Bug 1691608 - [devtools] Fix and re-enable browser_inspector_open_on_neterror.js for Fission r=nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D105623
2021-02-18 17:09:29 +00:00
Julian Descottes
352bff0a66 Bug 1692965 - [devtools] Remove the ChromeWindowTargetActor r=ochameau,devtools-backward-compat-reviewers
The ChromeWindowTargetActor was not exposed to end users and doesn't support descriptors which will make it a blocker for fission refactors.
So we remove it for now.

Differential Revision: https://phabricator.services.mozilla.com/D105452
2021-02-18 11:10:13 +00:00
Julian Descottes
7cd91ace5b Bug 1693144 - [devtools] Fallback to the initial javascriptEnabled value from the target r=ochameau
Differential Revision: https://phabricator.services.mozilla.com/D105463
2021-02-18 10:54:19 +00:00
Gabriel Luong
564c00eb78 Bug 1693315 - Insert "Page Source" before "Extensions for Developers" in the DevTools menu. r=mconley
Use the correct menu item ID to insert the "Page Source" menu item before the
"Extensions for Developers" menu item in the DevTools menu.

Differential Revision: https://phabricator.services.mozilla.com/D105485
2021-02-17 15:52:39 +00:00