WebKit Bugzilla
Attachment 361359 Details for
Bug 194366
: Unable to sign in leetcode
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194366-20190206182348.patch (text/plain), 7.85 KB, created by
youenn fablet
on 2019-02-06 18:23:49 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2019-02-06 18:23:49 PST
Size:
7.85 KB
patch
obsolete
>Subversion Revision: 240959 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 97a9066fa6ea2cdf6bad056b8429fee893e25ea7..002fda971927b15b8226c038ebafe3abcca754f3 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,25 @@ >+2019-02-06 Youenn Fablet <youenn@apple.com> >+ >+ Unable to sign in leetcode. >+ https://bugs.webkit.org/show_bug.cgi?id=194366 >+ rdar://problem/47259025. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ In case a signal is passed as part of a FetchRequestInit, >+ the IDL binding code is throwing an exception in case signal is not an AbortSignal object. >+ This breaks an AbortSignal shim used in some web sites. >+ Relaxed the IDL binding rule by marking signal as any and doing the conversion in FetchRequest. >+ >+ Test: http/wpt/fetch/request-abort.html >+ Also covered by manually signing in to leetcode. >+ >+ * Modules/fetch/FetchRequest.cpp: >+ (WebCore::FetchRequest::initializeWith): >+ * Modules/fetch/FetchRequestInit.h: >+ (WebCore::FetchRequestInit::hasMembers const): >+ * Modules/fetch/FetchRequestInit.idl: >+ > 2019-02-06 Youenn Fablet <youenn@apple.com> > > Disable audio ducking at Audio Unit setup time >diff --git a/Source/WebCore/Modules/fetch/FetchRequest.cpp b/Source/WebCore/Modules/fetch/FetchRequest.cpp >index c0790bc2a184f14604d3d44fc0f96ec172de9239..cfb9c4be58f972f772ddced8d172f3b3f305d303 100644 >--- a/Source/WebCore/Modules/fetch/FetchRequest.cpp >+++ b/Source/WebCore/Modules/fetch/FetchRequest.cpp >@@ -30,6 +30,7 @@ > #include "FetchRequest.h" > > #include "HTTPParsers.h" >+#include "JSAbortSignal.h" > #include "ScriptExecutionContext.h" > #include "SecurityOrigin.h" > >@@ -159,8 +160,14 @@ ExceptionOr<void> FetchRequest::initializeWith(const String& url, Init&& init) > if (optionsResult.hasException()) > return optionsResult.releaseException(); > >- if (init.signal && init.signal.value()) >- m_signal->follow(*init.signal.value()); >+ if (init.signal) { >+ if (auto* signal = JSAbortSignal::toWrapped(scriptExecutionContext()->vm(), init.signal)) >+ m_signal->follow(*signal); >+ else if (!init.signal.isUndefinedOrNull()) { >+ ASCIILiteral consoleMessage { "FetchRequestInit.signal should be undefined, null or an AbortSignal object."_s }; >+ scriptExecutionContext()->addConsoleMessage(MessageSource::JS, MessageLevel::Warning, consoleMessage); >+ } >+ } > > if (init.headers) { > auto fillResult = m_headers->fill(*init.headers); >@@ -191,11 +198,16 @@ ExceptionOr<void> FetchRequest::initializeWith(FetchRequest& input, Init&& init) > if (optionsResult.hasException()) > return optionsResult.releaseException(); > >- if (init.signal) { >- if (init.signal.value()) >- m_signal->follow(*init.signal.value()); >+ if (init.signal && !init.signal.isUndefined()) { >+ if (auto* signal = JSAbortSignal::toWrapped(scriptExecutionContext()->vm(), init.signal)) >+ m_signal->follow(*signal); >+ else if (!init.signal.isNull()) { >+ ASCIILiteral consoleMessage { "FetchRequestInit.signal should be undefined, null or an AbortSignal object."_s }; >+ scriptExecutionContext()->addConsoleMessage(MessageSource::JS, MessageLevel::Warning, consoleMessage); >+ } >+ > } else >- m_signal->follow(input.m_signal); >+ m_signal->follow(input.m_signal.get()); > > if (init.headers) { > auto fillResult = m_headers->fill(*init.headers); >diff --git a/Source/WebCore/Modules/fetch/FetchRequestInit.h b/Source/WebCore/Modules/fetch/FetchRequestInit.h >index a8d374b53060960c1472845f2394822027af9e37..c065e158a70e8d051a612e0a946c72d0062d2127 100644 >--- a/Source/WebCore/Modules/fetch/FetchRequestInit.h >+++ b/Source/WebCore/Modules/fetch/FetchRequestInit.h >@@ -47,10 +47,10 @@ struct FetchRequestInit { > Optional<FetchOptions::Redirect> redirect; > String integrity; > Optional<bool> keepalive; >- Optional<AbortSignal*> signal; >+ JSC::JSValue signal; > JSC::JSValue window; > >- bool hasMembers() const { return !method.isEmpty() || headers || body || !referrer.isEmpty() || referrerPolicy || mode || credentials || cache || redirect || !integrity.isEmpty() || keepalive || !window.isUndefined() || signal; } >+ bool hasMembers() const { return !method.isEmpty() || headers || body || !referrer.isEmpty() || referrerPolicy || mode || credentials || cache || redirect || !integrity.isEmpty() || keepalive || !window.isUndefined() || !signal.isUndefined(); } > }; > > } >diff --git a/Source/WebCore/Modules/fetch/FetchRequestInit.idl b/Source/WebCore/Modules/fetch/FetchRequestInit.idl >index cc7ca55e2c28a40567a49884bd3228c94162ed97..f2ed837e2358a2f12bd5080ec5148da93bfdc222 100644 >--- a/Source/WebCore/Modules/fetch/FetchRequestInit.idl >+++ b/Source/WebCore/Modules/fetch/FetchRequestInit.idl >@@ -39,6 +39,6 @@ dictionary FetchRequestInit { > FetchRequestRedirect redirect; > DOMString integrity; > boolean keepalive; >- AbortSignal? signal; >+ any signal; > any window; // can only be set to null > }; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index cb63ce47777118be447d35e532b6cf3369acacab..92df44d2f5d41a99f654ffdf82eddbc62c796df0 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2019-02-06 Youenn Fablet <youenn@apple.com> >+ >+ Unable to sign in leetcode. >+ https://bugs.webkit.org/show_bug.cgi?id=194366 >+ rdar://problem/47259025. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * http/wpt/fetch/request-abort-expected.txt: Added. >+ * http/wpt/fetch/request-abort.html: Added. >+ > 2019-02-05 Youenn Fablet <youenn@apple.com> > > Filter out Overconstrainederror.constraint when getUserMedia is not granted >diff --git a/LayoutTests/http/wpt/fetch/request-abort-expected.txt b/LayoutTests/http/wpt/fetch/request-abort-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..57cd5f3e800da6ebf68d9f2f9749eddb6a3902ed >--- /dev/null >+++ b/LayoutTests/http/wpt/fetch/request-abort-expected.txt >@@ -0,0 +1,6 @@ >+CONSOLE MESSAGE: line 14: FetchRequestInit.signal should be undefined, null or an AbortSignal object. >+CONSOLE MESSAGE: line 28: FetchRequestInit.signal should be undefined, null or an AbortSignal object. >+ >+FAIL Request from URL with signal assert_throws: function "() => { new Request("/", {signal: "my signal"}) }" did not throw >+FAIL Request from request with signal assert_throws: function "() => { new Request(request, {signal: "my signal"}) }" did not throw >+ >diff --git a/LayoutTests/http/wpt/fetch/request-abort.html b/LayoutTests/http/wpt/fetch/request-abort.html >new file mode 100644 >index 0000000000000000000000000000000000000000..5fcb1ec243f3d0d8ccd6f52c2d5d2869a0197e7e >--- /dev/null >+++ b/LayoutTests/http/wpt/fetch/request-abort.html >@@ -0,0 +1,32 @@ >+<!doctype html> >+<html> >+ <head> >+ <meta charset="utf-8"> >+ <title>Request signal</title> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ </head> >+ <body> >+ <script> >+test(() => { >+ new Request("/", {signal: null}); >+ new Request("/", {signal: undefined}); >+ assert_throws(new TypeError, () => { new Request("/", {signal: "my signal"}) }); >+}, "Request from URL with signal"); >+ >+test(() => { >+ const controller = new AbortController(); >+ const request = new Request("/", {signal : controller.signal}); >+ controller.abort(); >+ >+ const r1 = new Request(request, {signal: undefined}); >+ assert_true(r1.signal.aborted, "r1 signal is aborted"); >+ >+ const r2 = new Request(request, {signal: null}); >+ assert_false(r2.signal.aborted, "r2 signal is not aborted"); >+ >+ assert_throws(new TypeError, () => { new Request(request, {signal: "my signal"}) }); >+}, "Request from request with signal"); >+ </script> >+ </body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194366
:
361343
|
361344
|
361346
|
361355
|
361356
| 361359 |
361372