Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (281755 => 281756)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-08-30 14:24:14 UTC (rev 281755)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-08-30 14:59:41 UTC (rev 281756)
@@ -1,3 +1,23 @@
+2021-08-30 Chris Dumez <[email protected]>
+
+ Implement self.reportError()
+ https://bugs.webkit.org/show_bug.cgi?id=228316
+ <rdar://problem/81446162>
+
+ Reviewed by Sam Weinig.
+
+ Import test coverage from:
+ - https://github.com/web-platform-tests/wpt/pull/29738
+
+ * web-platform-tests/html/webappapis/scripting/reporterror.any-expected.txt: Added.
+ * web-platform-tests/html/webappapis/scripting/reporterror.any.html: Added.
+ * web-platform-tests/html/webappapis/scripting/reporterror.any.js: Added.
+ (undefined.forEach.throwable.test.t.assert_equals):
+ (test):
+ * web-platform-tests/html/webappapis/scripting/reporterror.any.worker-expected.txt: Added.
+ * web-platform-tests/html/webappapis/scripting/reporterror.any.worker.html: Added.
+ * web-platform-tests/html/webappapis/scripting/w3c-import.log: Added.
+
2021-08-27 Antti Koivisto <[email protected]>
[CSS Cascade Layers] Initial support
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/reporterror.any-expected.txt (0 => 281756)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/reporterror.any-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/reporterror.any-expected.txt 2021-08-30 14:59:41 UTC (rev 281756)
@@ -0,0 +1,9 @@
+CONSOLE MESSAGE: 1
+CONSOLE MESSAGE: TypeError
+CONSOLE MESSAGE: undefined
+
+PASS self.reportError(1)
+PASS self.reportError(TypeError)
+PASS self.reportError(undefined)
+PASS self.reportError() (without arguments) throws
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/reporterror.any.html (0 => 281756)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/reporterror.any.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/reporterror.any.html 2021-08-30 14:59:41 UTC (rev 281756)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/reporterror.any.js (0 => 281756)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/reporterror.any.js (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/reporterror.any.js 2021-08-30 14:59:41 UTC (rev 281756)
@@ -0,0 +1,25 @@
+setup({ allow_uncaught_exception:true });
+
+[
+ 1,
+ new TypeError(),
+ undefined
+].forEach(throwable => {
+ test(t => {
+ let happened = false;
+ self.addEventListener("error", t.step_func(e => {
+ assert_true(e.message !== "");
+ assert_equals(e.filename, new URL("reporterror.any.js", location.href).href);
+ assert_greater_than(e.lineno, 0);
+ assert_greater_than(e.colno, 0);
+ assert_equals(e.error, throwable);
+ happened = true;
+ }), { once:true });
+ self.reportError(throwable);
+ assert_true(happened);
+ }, `self.reportError(${throwable})`);
+});
+
+test(() => {
+ assert_throws_js(TypeError, () => self.reportError());
+}, `self.reportError() (without arguments) throws`);
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/reporterror.any.worker-expected.txt (0 => 281756)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/reporterror.any.worker-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/reporterror.any.worker-expected.txt 2021-08-30 14:59:41 UTC (rev 281756)
@@ -0,0 +1,6 @@
+
+PASS self.reportError(1)
+PASS self.reportError(TypeError)
+PASS self.reportError(undefined)
+PASS self.reportError() (without arguments) throws
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/reporterror.any.worker.html (0 => 281756)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/reporterror.any.worker.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/reporterror.any.worker.html 2021-08-30 14:59:41 UTC (rev 281756)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/w3c-import.log (0 => 281756)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/w3c-import.log (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/w3c-import.log 2021-08-30 14:59:41 UTC (rev 281756)
@@ -0,0 +1,17 @@
+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the WPT github:
+ https://github.com/web-platform-tests/wpt
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/reporterror.any.js
Modified: trunk/Source/WebCore/ChangeLog (281755 => 281756)
--- trunk/Source/WebCore/ChangeLog 2021-08-30 14:24:14 UTC (rev 281755)
+++ trunk/Source/WebCore/ChangeLog 2021-08-30 14:59:41 UTC (rev 281756)
@@ -1,3 +1,27 @@
+2021-08-30 Chris Dumez <[email protected]>
+
+ Implement self.reportError()
+ https://bugs.webkit.org/show_bug.cgi?id=228316
+ <rdar://problem/81446162>
+
+ Reviewed by Sam Weinig.
+
+ Implement self.reportError() as per:
+ - https://github.com/whatwg/html/pull/1196
+
+ Firefox already shipped this and Chrome will do so soon too.
+
+ Tests: imported/w3c/web-platform-tests/html/webappapis/scripting/reporterror.any.html
+ imported/w3c/web-platform-tests/html/webappapis/scripting/reporterror.any.worker.html
+
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::reportError):
+ * page/DOMWindow.h:
+ * page/WindowOrWorkerGlobalScope.idl:
+ * workers/WorkerGlobalScope.cpp:
+ (WebCore::WorkerGlobalScope::reportError):
+ * workers/WorkerGlobalScope.h:
+
2021-08-30 Alan Bujtas <[email protected]>
[LFC][IFC] Introduce Line::Run::Text to hold text content related properties
Modified: trunk/Source/WebCore/page/DOMWindow.cpp (281755 => 281756)
--- trunk/Source/WebCore/page/DOMWindow.cpp 2021-08-30 14:24:14 UTC (rev 281755)
+++ trunk/Source/WebCore/page/DOMWindow.cpp 2021-08-30 14:59:41 UTC (rev 281756)
@@ -72,6 +72,7 @@
#include "History.h"
#include "IdleRequestOptions.h"
#include "InspectorInstrumentation.h"
+#include "JSDOMExceptionHandling.h"
#include "JSDOMPromiseDeferred.h"
#include "JSDOMWindowBase.h"
#include "JSExecState.h"
@@ -1801,6 +1802,17 @@
page->chrome().setWindowRect(adjustWindowRect(*page, update));
}
+void DOMWindow::reportError(JSC::JSGlobalObject& globalObject, JSC::JSValue error)
+{
+ auto& vm = globalObject.vm();
+ RELEASE_ASSERT(vm.currentThreadIsHoldingAPILock());
+ auto* exception = JSC::jsDynamicCast<JSC::Exception*>(vm, error);
+ if (!exception)
+ exception = JSC::Exception::create(vm, error);
+
+ reportException(&globalObject, exception);
+}
+
ExceptionOr<int> DOMWindow::setTimeout(JSC::JSGlobalObject& state, std::unique_ptr<ScheduledAction> action, int timeout, Vector<JSC::Strong<JSC::Unknown>>&& arguments)
{
RefPtr context = scriptExecutionContext();
Modified: trunk/Source/WebCore/page/DOMWindow.h (281755 => 281756)
--- trunk/Source/WebCore/page/DOMWindow.h 2021-08-30 14:24:14 UTC (rev 281755)
+++ trunk/Source/WebCore/page/DOMWindow.h 2021-08-30 14:59:41 UTC (rev 281756)
@@ -386,6 +386,8 @@
WebKitNamespace* webkitNamespace();
#endif
+ void reportError(JSC::JSGlobalObject&, JSC::JSValue);
+
// FIXME: When this DOMWindow is no longer the active DOMWindow (i.e.,
// when its document is no longer the document that is displayed in its
// frame), we would like to zero out m_frame to avoid being confused
Modified: trunk/Source/WebCore/page/WindowOrWorkerGlobalScope.idl (281755 => 281756)
--- trunk/Source/WebCore/page/WindowOrWorkerGlobalScope.idl 2021-08-30 14:24:14 UTC (rev 281755)
+++ trunk/Source/WebCore/page/WindowOrWorkerGlobalScope.idl 2021-08-30 14:59:41 UTC (rev 281756)
@@ -48,7 +48,9 @@
readonly attribute boolean isSecureContext;
[EnabledBySetting=CrossOriginOpenerPolicy] readonly attribute boolean crossOriginIsolated;
-
+
+ [CallWith=GlobalObject] undefined reportError(any error);
+
// Base64 utility methods.
DOMString atob(DOMString string);
DOMString btoa(DOMString string);
Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.cpp (281755 => 281756)
--- trunk/Source/WebCore/workers/WorkerGlobalScope.cpp 2021-08-30 14:24:14 UTC (rev 281755)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.cpp 2021-08-30 14:59:41 UTC (rev 281756)
@@ -39,6 +39,7 @@
#include "IDBConnectionProxy.h"
#include "ImageBitmapOptions.h"
#include "InspectorInstrumentation.h"
+#include "JSDOMExceptionHandling.h"
#include "Performance.h"
#include "RuntimeEnabledFeatures.h"
#include "ScheduledAction.h"
@@ -547,6 +548,17 @@
#endif
}
+void WorkerGlobalScope::reportError(JSC::JSGlobalObject& globalObject, JSC::JSValue error)
+{
+ auto& vm = globalObject.vm();
+ RELEASE_ASSERT(vm.currentThreadIsHoldingAPILock());
+ auto* exception = JSC::jsDynamicCast<JSC::Exception*>(vm, error);
+ if (!exception)
+ exception = JSC::Exception::create(vm, error);
+
+ WebCore::reportException(&globalObject, exception);
+}
+
void WorkerGlobalScope::releaseMemoryInWorkers(Synchronous synchronous)
{
Locker locker { allWorkerGlobalScopeIdentifiersLock };
Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.h (281755 => 281756)
--- trunk/Source/WebCore/workers/WorkerGlobalScope.h 2021-08-30 14:24:14 UTC (rev 281755)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.h 2021-08-30 14:59:41 UTC (rev 281756)
@@ -130,6 +130,8 @@
std::unique_ptr<FontLoadRequest> fontLoadRequest(String& url, bool isSVG, bool isInitiatingElementInUserAgentShadowTree, LoadedFromOpaqueSource) final;
void beginLoadingFontSoon(FontLoadRequest&) final;
+ void reportError(JSC::JSGlobalObject&, JSC::JSValue);
+
ReferrerPolicy referrerPolicy() const final;
const Settings::Values& settingsValues() const final { return m_settingsValues; }