-
Notifications
You must be signed in to change notification settings - Fork 22.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Complete devtools.inspectedWindow #28131
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tentatively approving with the assumption that removing Firefox support notes form the text is intentional.
@@ -49,14 +49,16 @@ let evaluating = browser.devtools.inspectedWindow.eval( | |||
- : `string`. The JavaScript expression to evaluate. The string must evaluate to an object that can be represented as JSON, or an exception will be thrown. For example, `expression` must not evaluate to a function. | |||
- `options` {{optional_inline}} | |||
|
|||
- : `object`. Options for the function (Note that Firefox does not yet support this options), as follows: | |||
- : `object`. Options for the function, as follows: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like these properties are still labeled as unsupported in Firefox: https://searchfox.org/mozilla-central/source/browser/components/extensions/schemas/devtools_inspected_window.json#107-123. I also tested in Firefox Nightly 129.0a1 (2024-06-28) (64-bit) and Firefox Stable 127.0 (64-bit) and observed that they threw an "unsupported" error.
Is the intent of this change to move notes about what is (not) supported to the compat tables?
|
||
### Parameters | ||
|
||
This function takes no parameters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Chrome's documentation, this function takes a callback parameter and does not return a promise. https://developer.chrome.com/docs/extensions/reference/api/devtools/inspectedWindow#method-getResources
I tested and verified this behavior in Chrome 126.0.6478.127 (Official Build) (x86_64).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On MDN we are using the conventional of omitting the callback in favor of specifying a Promise value. But because we don't support this in Firefox and Chrome doesn't support Promises in their devtools API either, I wouldn't mind being explicit with the callback here.
Probably makes sense to explicitly document that Chrome doesn't support Promise in devtools namespace, which is a deviation from all other MV3 APIs that now support Promises: https://issues.chromium.org/issues/41483013
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rob--W, yesterday I didn't realize that Safari supports this method and returns a Promise (when called without a callback argument). Since Chrome still doesn't support Promises on DevTools APIs, would it make more sense to explicitly document the callback, to stick with the current convention, or something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's stick to the Promise convention.
Note that the APIs are documented with the browser namespace which Chrome doesn't support yet. So the webextension-polyfill might work here.
|
||
### Return value | ||
|
||
A [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) fulfilled with an array of {{WebExtAPIRef("devtools.inspectedWindow.Resource")}}. If the request fails, the promise is rejected with an error message. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chrome returns undefined
.
Compatibility issues discovered while testing Safari 17.5
- `encoding` | ||
- : `string`. Empty if the content is not encoded, otherwise the encoding name. | ||
- `setContent` | ||
- : `function`. Sets the content of the resource. This function takes these parameters: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[mdn-linter] reported by reviewdog 🐶
- : `function`. Sets the content of the resource. This function takes these parameters: | |
- : `function`. Sets the content of the resource. This function takes these parameters: |
- : `string`. Empty if the content is not encoded, otherwise the encoding name. | ||
- `setContent` | ||
- : `function`. Sets the content of the resource. This function takes these parameters: | ||
- `content` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[mdn-linter] reported by reviewdog 🐶
- `content` | |
- `content` |
This pull request has merge conflicts that must be resolved before it can be merged. |
Description
Add details of the features of
devtools.inspectedWindow
not supported by Firefox.Motivation
To ensure the MDN documentation is authoritative and pave the way for adding BCD and removing unsupported features list from the Extend the developer tools article.
Related issues and pull requests