-
Notifications
You must be signed in to change notification settings - Fork 214
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
browser.devtools.inspectedWindow.eval() resolves with incorrect promise signature #168
Comments
Chrome's devtools API implementation is not implemented using the default extension bindings. The implementation is here, and contrary to Chrome's documentation, there are not always two parameters passed to the callback: https://chromium.googlesource.com/chromium/src/+/10e9b59ba1acc764a058b8d152e3825ff7db50ba/third_party/blink/renderer/devtools/front_end/extensions/ExtensionAPI.js#577 I suppose that we could repurpose
|
If I understand the Chromium source correctly, the 2nd parameter isn't passed when the eval is successful. I guess that's not really an issue for the event hander as omitting the 2nd argument would still result in value of Repurposing Just a suggestion: Would it make the code easier to understand if you used string values instead? Something like:
|
Oh nice, I just barely ran into this as well. Glad to see that it's already been fixed and merged! Awesome work. Any idea on when the next release is so I can use it? |
workaround until this is released: if (typeof InstallTrigger !== "undefined") {
// see https://stackoverflow.com/a/41820692/2098017
return result[0];
} else {
return result;
} |
@frehner we just released this fix on npm as part of the new webextension-polyfill 0.4.0 version. |
I'm confused. How are you calling |
@joelstransky This project (webextension-polyfill) provides a |
When calling
browser.devtools.inspectedWindow.eval()
in Chrome (I'm using 71), the resulting promise appears to resolve with an incorrect signature. According to MDN, the resulting promise should be an array containing two elements:However, running the following script
Returns
I was expecting
If I call the same function with a statement that will throw an error, the promise resolves with the correct error signature:
Returns:
Firefox behaves as expected.
The text was updated successfully, but these errors were encountered: