FetchAPI: Invalid Request.mode does not throw TypeError |
||||||
Issue description
Chrome Version : 61.0.3163.100 (Official Build) (64-bit)
URLs (if applicable) :
Other browsers tested:
Add OK or FAIL, along with the version, after other browsers where you
have tested this issue:
Safari: OK
Firefox: OK
IE/Edge: Not sure
What steps will reproduce the problem?
(1) Open the Developer Tools
(2) In the console write `x = new Request("", {mode: "whatever"})`
(3)
What is the expected result?
TypeError (ideally with informative message) should be thrown, as "whatever" is not a member of https://fetch.spec.whatwg.org/#requestmode
What happens instead?
No TypeError is thrown
I'm willing to work on this issue and submit a patch with a little guidance!
,
Oct 26 2017
Able to reproduce the issue on Windows 7,Mac 10.12.6 & Ubuntu 14.04 using chrome reported version-61.0.3163.100, stable-62.0.3202.62 & canary-64.0.3250.0 as per below steps:
1. Launch chrome & go to NTP
2. Open dev tools (Press F12)
3. Go to 'Console'
4. paste code as below
x = new Request("", {mode: "whatever"})
5. No error displayed
Same issue observed from M50 builds to latest chrome versions. As it is a non regression issue, marking it as Untriaged for further investigation.
Please find the attached screencast for reference.
Thanks..!
,
Oct 27 2017
,
Oct 27 2017
Thanks for reporting, this is a bug in Fetch API. Usually such issues are handled in the IDL parser but in this case we are doing the work manually, and we should have these checks in it. The logic is located in modules/fetch/RequestInit.cpp[1]. You can throw a TypeError by calling exception_state.ThrowTypeError(message) and return from RequestInit::RequestInit. 1: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/fetch/RequestInit.cpp
,
Oct 27 2017
Thanks a lot, I'll start checking it out and submit a patch soon! Is there any particular reason we're not handling this with the IDL parser, and instead are checking for this manually?
,
Oct 27 2017
Also this question may be out of the scope of this issue, but is there a way I can compile to get debugging symbols included on files in the WebKit folder? I was trying to debug some of the fetch code with gdb, and it seemed that no symbols could be found for any of the source files in there with the `ninja -C out/Default chrome`?. Is there something I can do to debug code in this directory? Perhaps a way to include symbols here?
,
Oct 30 2017
> #5 I don't fully understand the reason, but the bindings team said the current Dictionary implementation in the IDL parser had some problems. > #6 Having "is_debug=true" in GN settings will produce binaries with debug information. https://chromium.googlesource.com/chromium/src/+/master/docs/linux_build_instructions.md
,
Mar 7 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/b66d10ef54411e51c74d8b816162bd8a149ed2eb commit b66d10ef54411e51c74d8b816162bd8a149ed2eb Author: Dominic Farolino <domfarolino@gmail.com> Date: Wed Mar 07 18:42:27 2018 Enforce RequestInit enum values This makes the Fetch API more standards compliant by enforcing the enum values in the RequestInit dictionary, as this is not taken care of by the IDL bindings themselves. This enforces the mode, credentials, cache, and redirect properties of RequestInit. R=yhirano@chromium.org, yoav@yoav.ws Bug: 777116 Change-Id: I8db5fd991b5ffa039dc2f67b4d8f525647fbf915 Reviewed-on: https://chromium-review.googlesource.com/841270 Commit-Queue: Yoav Weiss <yoav@yoav.ws> Reviewed-by: Yoav Weiss <yoav@yoav.ws> Reviewed-by: Yutaka Hirano <yhirano@chromium.org> Cr-Commit-Position: refs/heads/master@{#541515} [modify] https://crrev.com/b66d10ef54411e51c74d8b816162bd8a149ed2eb/third_party/WebKit/LayoutTests/external/wpt/fetch/api/request/request-error-expected.txt [modify] https://crrev.com/b66d10ef54411e51c74d8b816162bd8a149ed2eb/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/webvtt-cross-origin.https.html [modify] https://crrev.com/b66d10ef54411e51c74d8b816162bd8a149ed2eb/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/request.js [modify] https://crrev.com/b66d10ef54411e51c74d8b816162bd8a149ed2eb/third_party/WebKit/Source/core/fetch/RequestInit.cpp [modify] https://crrev.com/b66d10ef54411e51c74d8b816162bd8a149ed2eb/third_party/WebKit/Source/core/fetch/RequestInit.h [modify] https://crrev.com/b66d10ef54411e51c74d8b816162bd8a149ed2eb/third_party/WebKit/Source/platform/weborigin/ReferrerPolicy.h
,
Mar 16 2018
Looks like this can be closed?
,
Mar 19 2018
Yes, not sure how this is done or if I have the permissions to do so, but it can be closed. Thanks.
,
Mar 20 2018
,
Mar 20 2018
|
||||||
►
Sign in to add a comment |
||||||
Comment 1 by domfarolino@gmail.com
, Oct 21 2017