Commit Graph
157 Commits
Author SHA1 Message Date
Alexandre Poirot 81fd28204b Bug 1622857 - [devtools] Remove now unused dumpv/verbose logging logic. r=devtools-reviewers,nchevobbe
The transport layer was the only one using this.

Differential Revision: https://phabricator.services.mozilla.com/D299058
2026-05-18 09:12:41 +00:00
Emilio Cobos Álvarez feede7eb94 Bug 2033191 - Remove all non-node ownerGlobal usage. r=firefox-desktop-core-reviewers ,extension-reviewers,credential-management-reviewers,devtools-reviewers,fxview-reviewers,tabbrowser-reviewers,omc-reviewers,migration-reviewers,webcompat-reviewers,urlbar-reviewers,whimboo,akulyk,twisniewski,dao,robwu,mconley,sachung,sfoster,dimi,nchevobbe
This is written by greening up the tree with the following patch:

  https://hg.mozilla.org/try/rev/4f0388e9b8f76ff3008d3ec74ee793bb8f9fc364

All uses are effectively one of these categories:

 * windowRoot.ownerGlobal usage. Replaced by an explicit .window
   property.
 * Things that accidentally were given a window when they expected an
   element. Fixed by fixing callers as appropriate. Examples of these
   are using isBrowserPrivate(window) or so, or various test methods
   that expect a <browser> or <tabbrowser> and were given a Window.
 * Things that had a window-or-node and used ownerGlobal to normalize to
   a window. E.g. the AutoScrollChild or extensions code. Fixed by
   checking explicitly for Window.
 * Things that had a window and called ownerGlobal on it. Fixed by just
   removing the ownerGlobal accessor.

Main idea after this is to replace all .ownerGlobal usage with
.documentGlobal, and remove .ownerGlobal from JS (maybe exposing
.relevantGlobal if absolutely needed).

Differential Revision: https://phabricator.services.mozilla.com/D295189
2026-04-29 05:04:36 +00:00
Serban Stanca 095882da04 Revert "Bug 2033191 - Remove all non-node ownerGlobal usage. r=firefox-desktop-core-reviewers ,extension-reviewers,credential-management-reviewers,devtools-reviewers,fxview-reviewers,tabbrowser-reviewers,omc-reviewers,migration-reviewers,webcompat-reviewers,urlbar-reviewers,whimboo,akulyk,twisniewski,dao,robwu,mconley,sachung,sfoster,dimi,nchevobbe" for causing mochitests-plain failures in test_option_index_attribute.html.
This reverts commit 7553d106d0.
2026-04-29 02:20:48 +00:00
Emilio Cobos Álvarez 7553d106d0 Bug 2033191 - Remove all non-node ownerGlobal usage. r=firefox-desktop-core-reviewers ,extension-reviewers,credential-management-reviewers,devtools-reviewers,fxview-reviewers,tabbrowser-reviewers,omc-reviewers,migration-reviewers,webcompat-reviewers,urlbar-reviewers,whimboo,akulyk,twisniewski,dao,robwu,mconley,sachung,sfoster,dimi,nchevobbe
This is written by greening up the tree with the following patch:

  https://hg.mozilla.org/try/rev/4f0388e9b8f76ff3008d3ec74ee793bb8f9fc364

All uses are effectively one of these categories:

 * windowRoot.ownerGlobal usage. Replaced by an explicit .window
   property.
 * Things that accidentally were given a window when they expected an
   element. Fixed by fixing callers as appropriate. Examples of these
   are using isBrowserPrivate(window) or so, or various test methods
   that expect a <browser> or <tabbrowser> and were given a Window.
 * Things that had a window-or-node and used ownerGlobal to normalize to
   a window. E.g. the AutoScrollChild or extensions code. Fixed by
   checking explicitly for Window.
 * Things that had a window and called ownerGlobal on it. Fixed by just
   removing the ownerGlobal accessor.

Main idea after this is to replace all .ownerGlobal usage with
.documentGlobal, and remove .ownerGlobal from JS (maybe exposing
.relevantGlobal if absolutely needed).

Differential Revision: https://phabricator.services.mozilla.com/D295189
2026-04-28 22:39:18 +00:00
Mark Banner 862b27101a Bug 2010005 - Clean up references to .jsm in devtools code. r=devtools-reviewers,profiler-reviewers,nchevobbe,canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D278776
2026-01-14 15:38:46 +00:00
Mark Banner b38cd3110b Bug 1999554 - Automatically fix ESLint rule jsdoc/check-types for devtools/. r=devtools-reviewers,devtools-backward-compat-reviewers,profiler-reviewers,canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D272173
2025-11-21 16:16:08 +00:00
Julian Descottes bbae8b3bd0 Bug 1961777 - [devtools] Sanitize filename used in devtools saveAs helper r=devtools-reviewers,bomsy
Differential Revision: https://phabricator.services.mozilla.com/D246755
2025-04-28 08:39:23 +00:00
Alexandre Poirot cd88f266c8 Bug 1892638 - [devtools] Avoid triggering any page JS when previewing RegExp and Date. r=devtools-reviewers,nchevobbe
For some reason passing an opaque wrapper from the worker thread isn't an issue for Date.getTime, while it breaks RegExp.toString.
So that, in workers, RegExp with overloaded toString method won't be properly logged and will still have an object inspector,
but with an empty label.

Differential Revision: https://phabricator.services.mozilla.com/D223763
2024-10-03 15:26:28 +00:00
Valentin Gosu 98348bede1 Bug 1883693 - Fix devtools expectation that newChannel throws for unsupported external handlers r=nika,devtools-reviewers,ochameau
Depends on D205296

Differential Revision: https://phabricator.services.mozilla.com/D206754
2024-05-02 18:11:52 +00:00
Sandor Molnar 2b94563f8d Backed out 2 changesets (bug 1883693) for causing xpc failures @ test_fetch-file.js CLOSED TREE
Backed out changeset 4f9f5e9c42f8 (bug 1883693)
Backed out changeset 4e8e200c3599 (bug 1883693)
2024-05-01 04:08:52 +03:00
Valentin Gosu b86f770439 Bug 1883693 - Fix devtools expectation that newChannel throws for unsupported external handlers r=nika,devtools-reviewers,ochameau
Differential Revision: https://phabricator.services.mozilla.com/D206754
2024-04-30 20:19:05 +00:00
Stanca Serban 6b85455896 Backed out 2 changesets (bug 1883693) for causing wpt failures in same-origin.html.
Backed out changeset 56770cf9b51a (bug 1883693)
Backed out changeset 8958ecbeec9e (bug 1883693)
2024-04-28 22:59:20 +03:00
Valentin Gosu a02a205ed3 Bug 1883693 - Fix devtools expectation that newChannel throws for unsupported external handlers r=nika,devtools-reviewers,ochameau
Differential Revision: https://phabricator.services.mozilla.com/D206754
2024-04-28 16:21:28 +00:00
Natalia Csoregi e2e3d72e0a Backed out 2 changesets (bug 1883693) for causing bustage on nsExternalProtocolHandler.cpp. CLOSED TREE
Backed out changeset 5b0d6bb6f378 (bug 1883693)
Backed out changeset 1a96a3723839 (bug 1883693)
2024-04-25 13:04:43 +03:00
Valentin Gosu 1bf3284c1f Bug 1883693 - Fix devtools expectation that newChannel throws for unsupported external handlers r=nika,devtools-reviewers,ochameau
Differential Revision: https://phabricator.services.mozilla.com/D206754
2024-04-25 09:06:56 +00:00
Gregory Pappas 67bf0fdf61 Bug 1878401 - part 4 - Update nsIFilePicker users in devtools/ to pass BrowsingContext to init r=profiler-reviewers,devtools-reviewers,nchevobbe,julienw
Depends on D200548

Differential Revision: https://phabricator.services.mozilla.com/D200549
2024-02-28 21:29:38 +00:00
Sandor Molnar c853f2f3e9 Backed out 8 changesets (bug 1878401, bug 1879041) for causing build bustages on widget/nsBaseFilePicker.cpp CLOSED TREE
Backed out changeset 2e2b8df3bdd6 (bug 1879041)
Backed out changeset 6d6952f9df2c (bug 1878401)
Backed out changeset 30b5bb590d3e (bug 1878401)
Backed out changeset 9a4b830334b9 (bug 1878401)
Backed out changeset 3c3d67f1fcb7 (bug 1878401)
Backed out changeset c83ba4026822 (bug 1878401)
Backed out changeset 6bcb670ce475 (bug 1878401)
Backed out changeset f263b196df96 (bug 1878401)
2024-02-28 17:56:48 +02:00
Gregory Pappas 19820007ba Bug 1878401 - part 4 - Update nsIFilePicker users in devtools/ to pass BrowsingContext to init r=profiler-reviewers,devtools-reviewers,nchevobbe,julienw
Depends on D200548

Differential Revision: https://phabricator.services.mozilla.com/D200549
2024-02-28 15:07:45 +00:00
Tooru Fujisawa 571e7ae7b8 Bug 1875639 - Part 2: Explicitly use contextual loader in files loaded into DevTools global. r=ochameau,devtools-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D199467
2024-02-20 04:49:57 +00:00
Gregory Pappas 8e0ae3e9ae Bug 1872922 - Replace last few uses of XPCOMUtils.defineLazyGetter with ChromeUtils.defineLazyGetter and add linter error for XPCOMUtils.defineLazyGetter r=extension-reviewers,credential-management-reviewers,devtools-reviewers,Standard8,arai,robwu,Gijs,sgalich
Differential Revision: https://phabricator.services.mozilla.com/D198677
2024-01-17 15:54:00 +00:00
Emilio Cobos Álvarez 10ad24f7ba Bug 1867816 - Try harder and better to get the right stylesheet text. r=nchevobbe,devtools-reviewers
Not sure what the right place to add a test for this would be, seems
hard to reproduce the exact set-up here...

Differential Revision: https://phabricator.services.mozilla.com/D195413
2023-12-05 08:55:52 +00:00
jackyzy823 a1f7ccf1b6 Bug 1847513 - Fix typo in DevToolsUtils.js. r=devtools-reviewers,ochameau
Differential Revision: https://phabricator.services.mozilla.com/D186072
2023-08-14 21:59:42 +00:00
Mark Banner 88e658c23d Bug 1792824 - Convert ObjectUtils.jsm to an ES module. r=barret,necko-reviewers,devtools-reviewers,kershaw
Depends on D183308

Differential Revision: https://phabricator.services.mozilla.com/D183309
2023-07-12 08:07:23 +00:00
Mark Banner 40de601f11 Bug 1834176 - Convert consumers of NetUtil.jsm to import the ES module directly. r=arai,webdriver-reviewers,perftest-reviewers,valentin,extension-reviewers,devtools-reviewers,sync-reviewers,cookie-reviewers,robwu,afinder,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D178589
2023-06-07 08:42:36 +00:00
Tooru Fujisawa 0d5ad0d99b Bug 1832769 - Move ensureSideEffectFreeGetters into lazy getter r=devtools-reviewers,nchevobbe
Depends on D178884

Differential Revision: https://phabricator.services.mozilla.com/D178885
2023-05-26 10:45:27 +00:00
Noemi Erli 7d41e7869b Backed out 3 changesets (bug 1831819, bug 1832769, bug 1831826) for causing build bustages in Object-isSameNativeWithJitInfo.js CLOSED TREE
Backed out changeset 260ffbbe45e0 (bug 1832769)
Backed out changeset e6a25ac049e4 (bug 1831819)
Backed out changeset dc4f6fa24aa3 (bug 1831826)
2023-05-26 06:17:20 +03:00
Tooru Fujisawa 982376d567 Bug 1832769 - Move ensureSideEffectFreeGetters into lazy getter r=devtools-reviewers,nchevobbe
Depends on D178884

Differential Revision: https://phabricator.services.mozilla.com/D178885
2023-05-26 02:53:58 +00:00
Natalia Csoregi 1b67d0b941 Backed out 3 changesets (bug 1834222, bug 1834176) for causing RemoteProcessMonitor failures. CLOSED TREE
Backed out changeset 346d3a1568dd (bug 1834222)
Backed out changeset ea1d8b634bfc (bug 1834176)
Backed out changeset 74d1880272d3 (bug 1834176)
2023-05-24 04:29:45 +03:00
Mark Banner d1fc869252 Bug 1834176 - Convert NetUtil.jsm to be an ES system module. r=arai,webdriver-reviewers,perftest-reviewers,valentin,extension-reviewers,devtools-reviewers,sync-reviewers,cookie-reviewers,robwu,afinder,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D178589
2023-05-23 19:09:29 +00:00
Noemi Erli 1f146f097e Backed out 2 changesets (bug 1834176) for causing xpc failures in test_unload.js CLOSED TREE
Backed out changeset 57876d77a652 (bug 1834176)
Backed out changeset ae2f0837b528 (bug 1834176)
2023-05-23 12:14:37 +03:00
Mark Banner 08ff6c0ad9 Bug 1834176 - Convert NetUtil.jsm to be an ES system module. r=arai,webdriver-reviewers,perftest-reviewers,valentin,extension-reviewers,devtools-reviewers,sync-reviewers,cookie-reviewers,robwu,afinder,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D178589
2023-05-23 08:13:08 +00:00
Mark Banner 91fde42f7b Bug 1826062 - Automatic fixes for Prettier 2.0.5 upgrade. r=mossop,perftest-reviewers,webcompat-reviewers,geckoview-reviewers,denschub,devtools-reviewers,sparky,owlish
Differential Revision: https://phabricator.services.mozilla.com/D177025
2023-05-20 12:26:49 +00:00
Tooru Fujisawa b63a55d9fa Bug 1820951 - Part 1: Implement DevToolsUtils.hasSafeGetter based on explicit allowlist and DebuggerObject.prototype.isNativeGetterWithJitInfo. r=nchevobbe,devtools-reviewers
Perform the same test as `nativeIsEagerlyEvaluateable` in `hasSafeGetter`.

Differential Revision: https://phabricator.services.mozilla.com/D175093
2023-05-12 06:21:41 +00:00
Hubert Boma Manilla fadb58c375 Bug 1818806 [devtools] Local overrides feature in the debugger r=ochameau,devtools-backward-compat-reviewers,devtools-reviewers
Highlights for this patch
- Support for the script overrides feature
- Overrides for html files are not supported
- Add styling to indicate overrides
- Add mochitests

Depends on D163600

Differential Revision: https://phabricator.services.mozilla.com/D163610
2023-03-17 14:18:29 +00:00
Barret Rennie d4d0b9d430 Bug 1783100 - Remove osfile.jsm usage from DevToolsUtils.js r=ochameau
Differential Revision: https://phabricator.services.mozilla.com/D163500
2022-12-15 19:46:29 +00:00
Iulian Moraru 77e155ba4b Backed out changeset af7353099e41 (bug 1783100) for causing dt failures on browser_dbg-features-source-text-content.js. CLOSED TREE 2022-12-15 06:14:25 +02:00
Barret Rennie bae95b0232 Bug 1783100 - Remove osfile.jsm usage from DevToolsUtils.js r=ochameau
Differential Revision: https://phabricator.services.mozilla.com/D163500
2022-12-15 02:35:36 +00:00
Julian Descottes d5638c413b Bug 1788777 - [devtools] Group all network-observer related modules in a single folder r=ochameau,Sasha
This patch is only moving all network observer files in the same folder.
For webdriver reviewers, we could update our phabricator herald rule to be added as reviewers for changes in this folder?

Differential Revision: https://phabricator.services.mozilla.com/D160241
2022-11-08 20:27:50 +00:00
Mark Banner 5407bdffa8 Bug 1792341 - Migrate more toolkit/modules consumers to use direct ES module import. r=Gijs,webdriver-reviewers,perftest-reviewers,necko-reviewers,geckoview-reviewers,preferences-reviewers,application-update-reviewers,pip-reviewers,credential-management-reviewers,sgalich,owlish,bytesized,AlexandruIonescu,whimboo,mconley,mixedpuppy
Mainly automated changes. Some manual ESLint fixes and whitespace cleanup.

Differential Revision: https://phabricator.services.mozilla.com/D158452
2022-10-18 11:21:26 +00:00
Julian Descottes d947f89f30 Bug 1788762 - Migrate devtools network observer to an ES module r=ochameau
This is a very basic migration from commonjs modules to ESM for all modules related to network observation.
A few classes have been introduced instead of prototype-based classes, but otherwise the code remains mostly untouched.

We can followup to introduce private fields and methods if there's interest?

Differential Revision: https://phabricator.services.mozilla.com/D156968
2022-10-17 19:56:18 +00:00
Alexandre Poirot 07e6ce0083 Bug 1792848 - [devtools] Use absolute URLs to import modules in devtools/shared. r=Honza,devtools-backward-compat-reviewers,bomsy
Differential Revision: https://phabricator.services.mozilla.com/D158643
2022-10-12 15:56:22 +00:00
Alexandre Poirot acb64f5211 Bug 1791969 - [devtools] Migrate lazyRequireGetter for JSM to ChromeUtils.defineModuleGetter. r=jdescottes
There was some imports of sys.mjs which I migrated to `ChromeUtils.defineESModuleGetters`.

Differential Revision: https://phabricator.services.mozilla.com/D158129
2022-09-28 16:20:08 +00:00
Alexandre Poirot 58b38d7c16 Bug 1791969 - [devtools] Import all JSM in DevTools via ChromeUtils.import. r=jdescottes
Convert all imports but the one related to SessionDataHelper
as that's an hybrid module which is loaded as a JSM from the main thread,
but loaded as a common js module from the worker thread.

We will be able to drop this once we can migrate this JSM to ESM
once we support loading ESM from the worker thread.

Differential Revision: https://phabricator.services.mozilla.com/D158007
2022-09-26 13:01:33 +00:00
Alexandre Poirot 94fbe736c2 Bug 1791828 - [devtools] Remove devtools lazyImporter in favor of ChromeUtils.defineModuleGetter. r=jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D157910
2022-09-26 10:48:04 +00:00
Alexandre Poirot 0c4e317914 Bug 1789980 - [devtools] Migrate all callsites using require("chrome") to use Components.* global symbols. r=jdescottes,perftest-reviewers,AlexandruIonescu
This will help transition to ES Modules as we won't be able to expose a magic "chrome" ESM.
Also, most of these symbols are exposed as global already.
All but:
* `components` which is `Components`,
* `CC` which is `Components.Constructor`,
* `Cm` which is `Components.manager`.

$ sed -ie "/require(.chrome.)/d" $(git grep -l 'require("chrome")' devtools/)
+ manual edits for all three exceptions

Differential Revision: https://phabricator.services.mozilla.com/D156936
2022-09-20 12:52:27 +00:00
Alexandre Poirot 0f32f335e3 Bug 1789201 - [devtools] Expose Services as a global to all DevTools modules. r=perftest-reviewers,nchevobbe,julienw,AlexandruIonescu
This will help transition to ES Modules as this symbol is exposed to them.

$ sed -ie "/require(.Services.)/d" $(git grep -l 'require("Services")' devtools/)
$ sed -ie "/loader.lazyRequireGetter(this, .Services./d" $(git grep -l 'loader.lazyRequireGetter(this, "Services"' devtools/)
+ the edition of builtin-modules.js + eslintrc.js
+ manual eslint fixes
+ removal of devtools-services in the debugger, except for jest tests

Differential Revision: https://phabricator.services.mozilla.com/D156401
2022-09-09 07:22:51 +00:00
Mark Banner 3387a89bc7 Bug 1786197 - Turn on ESLint rule for prefer-boolean-length-check for devtools. r=jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D155167
2022-08-26 13:39:34 +00:00
Mark Banner 6d03c63e2d Bug 1330099 - Enable object-shorthand eslint rule. r=jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D153567
2022-08-03 14:57:05 +00:00
Barret Rennie bbd8b8f0db Bug 1779574 - Use OS.File to read empty files in DevTools content process r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D151827
2022-07-14 13:33:37 +00:00
Michael Ratcliffe d6307b5774 Bug 1771608 - Eliminate mozilla/reject-osfile eslint warning in devTools code r=devtools-reviewers,perftest-reviewers,jdescottes,sparky
## Removed Some Osfile.jsm and ChromeUtils Dependencies

```diff
-  const { OS } = require("resource://gre/modules/osfile.jsm");

And / Or

-  const ChromeUtils = require("ChromeUtils");
```

- devtools/client/memory/actions/io.js
- devtools/client/memory/utils.js
- devtools/client/netmonitor/src/har/har-menu-utils.js
- devtools/client/responsive/test/browser/browser_screenshot_button.js
- devtools/client/shared/remote-debugging/adb/adb-binary.js
- devtools/client/shared/screenshot.js
- devtools/client/styleeditor/StyleEditorUI.jsm
- devtools/client/styleeditor/StyleSheetEditor.jsm
- devtools/client/webconsole/components/Input/JSTerm.js
- devtools/client/webconsole/test/browser/stub-generator-helpers.js
- devtools/server/actors/heap-snapshot-file.js
- devtools/server/actors/storage.js
- devtools/server/tests/xpcshell/test_MemoryActor_saveHeapSnapshot_01.js
- devtools/server/tests/xpcshell/test_MemoryActor_saveHeapSnapshot_02.js
- devtools/server/tests/xpcshell/test_MemoryActor_saveHeapSnapshot_03.js
- devtools/shared/DevToolsUtils.js
- devtools/shared/heapsnapshot/HeapSnapshotFileUtils.js
- devtools/shared/tests/xpcshell/test_fetch-file.js
- testing/talos/talos/tests/devtools/addon/content/tests/toolbox/screenshot.js

## IOUtils.read()

```diff
-  OS.File.read(path);
+  IOUtils.read(path);
```

- devtools/client/aboutdebugging/test/browser/helper-real-usb.js
- devtools/client/netmonitor/src/har/har-menu-utils.js
- devtools/client/shared/remote-debugging/adb/adb-binary.js
- devtools/client/styleeditor/StyleSheetEditor.jsm
- devtools/client/webconsole/components/Input/JSTerm.js
- devtools/client/webconsole/test/browser/browser_jsterm_file_load_save_keyboard_shortcut.js
- devtools/client/webconsole/test/browser/browser_webconsole_context_menu_export_console_output.js
- devtools/shared/DevToolsUtils.js

## IOUtils.write()

```diff
-  OS.File.writeAtomic(filePath, fileContent);
+  IOUtils.write(filePath, fileContent);
```

- devtools/client/webconsole/test/browser/stub-generator-helpers.js
- devtools/shared/DevToolsUtils.js
- devtools/shared/tests/xpcshell/test_fetch-file.js

## PathUtils.split()

```diff
-  OS.Path.split(path);
+  PathUtils.split(path);
```

- devtools/client/styleeditor/StyleSheetEditor.jsm

## PathUtils.join()

```diff
-  OS.Path.join(path, filename);
+  PathUtils.join(path, filename);
```

NOTE: If `filename` is an absolute path then `OS.Path` will ignore `path` and use `filename` but `PathUtils` will try to concatenate both paths. If filename can be an absolute path we need to use `PathUtils.isAbsolute()` and `PathUtils.joinRelative()` to make our desired behaviour explicit.

- devtools/client/debugger/test/mochitest/browser_dbg-chrome-create.js
- devtools/client/shared/remote-debugging/adb/adb-binary.js
- devtools/client/styleeditor/StyleSheetEditor.jsm
- devtools/shared/heapsnapshot/HeapSnapshotFileUtils.js

## PathUtils.isAbsolute() and PathUtils.joinRelative()

```diff
-  filename = OS.Path.join(path, filename);
+  filename = PathUtils.isAbsolute(filename)
+    ? filename
+    : PathUtils.joinRelative(path, filename);
```

- devtools/client/shared/screenshot.js

## IOUtils.remove()

```diff
-  OS.File.remove(filePath);
+  IOUtils.remove(filePath);
```

- devtools/client/framework/test/browser_toolbox_screenshot_tool.js
- devtools/client/responsive/test/browser/browser_screenshot_button.js
- devtools/client/responsive/test/browser/browser_screenshot_button_warning.js
- devtools/client/shared/test/shared-head.js
- devtools/client/webconsole/test/browser/browser_console_screenshot.js
- devtools/client/webconsole/test/browser/browser_jsterm_screenshot_command_file.js
- devtools/client/webconsole/test/browser/browser_jsterm_screenshot_command_fixed_header.js
- devtools/client/webconsole/test/browser/browser_jsterm_screenshot_command_selector.js
- testing/talos/talos/tests/devtools/addon/content/tests/toolbox/screenshot.js

## PathUtils.toFileURI()

```diff
-  OS.Path.toFileURI(filePath);
+  PathUtils.toFileURI(filePath);
```

- devtools/client/framework/test/browser_toolbox_screenshot_tool.js
- devtools/client/responsive/test/browser/browser_screenshot_button.js
- devtools/client/shared/test/shared-head.js
- devtools/client/webconsole/test/browser/browser_console_screenshot.js
- devtools/client/webconsole/test/browser/browser_jsterm_screenshot_command_file.js
- devtools/client/webconsole/test/browser/browser_jsterm_screenshot_command_fixed_header.js
- devtools/client/webconsole/test/browser/browser_jsterm_screenshot_command_selector.js

## PathUtils.filename()

```diff
-  OS.Path.basename(path),
+  PathUtils.filename(path),
```

- devtools/client/memory/actions/io.js
- devtools/client/memory/utils.js
- devtools/client/styleeditor/StyleEditorUI.jsm
- devtools/client/styleeditor/StyleSheetEditor.jsm

## IOUtils.copy()

```diff
-  OS.File.copy(path, dest);
+  IOUtils.copy(path, dest);
```

- devtools/client/memory/actions/io.js

## IOUtils.stat()

```diff
-  OS.File.stat(filePath);
+  IOUtils.stat(filePath);
```

The objects that these `stat()` versions return differ from one another. This hasn't made much difference to the codebase but our changed usage is included here for completeness:

```diff
-      this._fileModDate = info.lastModificationDate.getTime();
+      this._fileModDate = info.lastModified;
```

- devtools/client/memory/test/browser/browser_memory_transferHeapSnapshot_e10s_01.js
- devtools/client/memory/test/xpcshell/head.js
- devtools/client/memory/test/xpcshell/test_action-export-snapshot.js
- devtools/client/styleeditor/StyleSheetEditor.jsm
- devtools/server/actors/heap-snapshot-file.js
- devtools/server/tests/xpcshell/test_MemoryActor_saveHeapSnapshot_01.js
- devtools/server/tests/xpcshell/test_MemoryActor_saveHeapSnapshot_02.js
- devtools/server/tests/xpcshell/test_MemoryActor_saveHeapSnapshot_03.js
- devtools/shared/heapsnapshot/HeapSnapshotFileUtils.js

## IOUtils.setPermissions

```diff
-  OS.File.setPermissions(filePath, { unixMode: 0o744 });
+  IOUtils.setPermissions(filePath, 0o744);
```

- devtools/client/shared/remote-debugging/adb/adb-binary.js

## IOUtils.makeDirectory

```diff
-  OS.File.makeDir(path);
+  IOUtils.makeDirectory(path);
```

- devtools/client/shared/remote-debugging/adb/adb-binary.js

## IOUtils.exists

```diff
-  OS.File.exists(path);
+  IOUtils.exists(path);
```

- devtools/client/shared/remote-debugging/adb/adb-binary.js
- devtools/client/shared/screenshot.js
- devtools/client/webconsole/test/browser/browser_jsterm_file_load_save_keyboard_shortcut.js
- devtools/client/webconsole/test/browser/browser_webconsole_context_menu_export_console_output.js

## PathUtils.profileDir, PathUtils.localProfileDir and PathUtils.tempDir

```diff
-    const profileDir = OS.Constants.Path.profileDir;
+    const profileDir = PathUtils.profileDir;
```

We can reduce reliance on `Osfile.jsm` in another bug bug this is a small step in that direction.

- devtools/client/shared/remote-debugging/adb/adb-binary.js
- devtools/server/actors/storage.js
- devtools/shared/heapsnapshot/HeapSnapshotFileUtils.js

## IOUtils.getChildren(storagePath)

`IOUtils` does not have a direct equivalent of `OS.File.DirectoryIterator()` so we need to iterate more explicitely using `IOUtils.getChildren()`.

```diff
- async findStorageTypePaths(storagePath) {
-   const iterator = new OS.File.DirectoryIterator(storagePath);
-   const typePaths = [];
-
-   await iterator.forEach(entry => {
-     if (entry.isDir) {
-       typePaths.push(entry.path);
-     }
-   });
-
-   iterator.close();
-   return typePaths;
- }

+ async findStorageTypePaths(storagePath) {
+   const children = await IOUtils.getChildren(storagePath);
+   const typePaths = [];
+
+   for (const path of children) {
+     const exists = await IOUtils.exists(path);
+     if (!exists) {
+       continue;
+     }
+
+     const stats = await IOUtils.stat(path);
+     if (stats.type === "directory") {
+       typePaths.push(path);
+     }
+   }
+
+   return typePaths;
+ }

```

- devtools/server/actors/storage.js

## Misc

Made `IOUtils` and `PathUtils` available to DevTools modules.

```diff
   HeapSnapshot,
+  IOUtils,
   L10nRegistry,
   Localization,
   NamedNodeMap,
   NodeFilter,
+  PathUtils,
   StructuredCloneHolder,
   TelemetryStopwatch,
```

- devtools/shared/loader/builtin-modules.js

Differential Revision: https://phabricator.services.mozilla.com/D147589
2022-06-02 21:13:56 +00:00