Changeset 281756 in webkit


Ignore:
Timestamp:
Aug 30, 2021 7:59:41 AM (11 months ago)
Author:
Chris Dumez
Message:

Implement self.reportError()
https://bugs.webkit.org/show_bug.cgi?id=228316
<rdar://problem/81446162>

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

Import test coverage from:

  • 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.

Source/WebCore:

Implement self.reportError() as per:

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:
Location:
trunk
Files:
6 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r281701 r281756  
     12021-08-30  Chris Dumez  <cdumez@apple.com>
     2
     3        Implement self.reportError()
     4        https://bugs.webkit.org/show_bug.cgi?id=228316
     5        <rdar://problem/81446162>
     6
     7        Reviewed by Sam Weinig.
     8
     9        Import test coverage from:
     10        - https://github.com/web-platform-tests/wpt/pull/29738
     11
     12        * web-platform-tests/html/webappapis/scripting/reporterror.any-expected.txt: Added.
     13        * web-platform-tests/html/webappapis/scripting/reporterror.any.html: Added.
     14        * web-platform-tests/html/webappapis/scripting/reporterror.any.js: Added.
     15        (undefined.forEach.throwable.test.t.assert_equals):
     16        (test):
     17        * web-platform-tests/html/webappapis/scripting/reporterror.any.worker-expected.txt: Added.
     18        * web-platform-tests/html/webappapis/scripting/reporterror.any.worker.html: Added.
     19        * web-platform-tests/html/webappapis/scripting/w3c-import.log: Added.
     20
    1212021-08-27  Antti Koivisto  <antti@apple.com>
    222
  • trunk/Source/WebCore/ChangeLog

    r281754 r281756  
     12021-08-30  Chris Dumez  <cdumez@apple.com>
     2
     3        Implement self.reportError()
     4        https://bugs.webkit.org/show_bug.cgi?id=228316
     5        <rdar://problem/81446162>
     6
     7        Reviewed by Sam Weinig.
     8
     9        Implement self.reportError() as per:
     10        - https://github.com/whatwg/html/pull/1196
     11
     12        Firefox already shipped this and Chrome will do so soon too.
     13
     14        Tests: imported/w3c/web-platform-tests/html/webappapis/scripting/reporterror.any.html
     15               imported/w3c/web-platform-tests/html/webappapis/scripting/reporterror.any.worker.html
     16
     17        * page/DOMWindow.cpp:
     18        (WebCore::DOMWindow::reportError):
     19        * page/DOMWindow.h:
     20        * page/WindowOrWorkerGlobalScope.idl:
     21        * workers/WorkerGlobalScope.cpp:
     22        (WebCore::WorkerGlobalScope::reportError):
     23        * workers/WorkerGlobalScope.h:
     24
    1252021-08-30  Alan Bujtas  <zalan@apple.com>
    226
  • trunk/Source/WebCore/page/DOMWindow.cpp

    r281147 r281756  
    7373#include "IdleRequestOptions.h"
    7474#include "InspectorInstrumentation.h"
     75#include "JSDOMExceptionHandling.h"
    7576#include "JSDOMPromiseDeferred.h"
    7677#include "JSDOMWindowBase.h"
     
    18021803}
    18031804
     1805void DOMWindow::reportError(JSC::JSGlobalObject& globalObject, JSC::JSValue error)
     1806{
     1807    auto& vm = globalObject.vm();
     1808    RELEASE_ASSERT(vm.currentThreadIsHoldingAPILock());
     1809    auto* exception = JSC::jsDynamicCast<JSC::Exception*>(vm, error);
     1810    if (!exception)
     1811        exception = JSC::Exception::create(vm, error);
     1812
     1813    reportException(&globalObject, exception);
     1814}
     1815
    18041816ExceptionOr<int> DOMWindow::setTimeout(JSC::JSGlobalObject& state, std::unique_ptr<ScheduledAction> action, int timeout, Vector<JSC::Strong<JSC::Unknown>>&& arguments)
    18051817{
  • trunk/Source/WebCore/page/DOMWindow.h

    r280504 r281756  
    387387#endif
    388388
     389    void reportError(JSC::JSGlobalObject&, JSC::JSValue);
     390
    389391    // FIXME: When this DOMWindow is no longer the active DOMWindow (i.e.,
    390392    // when its document is no longer the document that is displayed in its
  • trunk/Source/WebCore/page/WindowOrWorkerGlobalScope.idl

    r280968 r281756  
    4949
    5050    [EnabledBySetting=CrossOriginOpenerPolicy] readonly attribute boolean crossOriginIsolated;
    51  
     51
     52    [CallWith=GlobalObject] undefined reportError(any error);
     53
    5254    // Base64 utility methods.
    5355    DOMString atob(DOMString string);
  • trunk/Source/WebCore/workers/WorkerGlobalScope.cpp

    r280953 r281756  
    4040#include "ImageBitmapOptions.h"
    4141#include "InspectorInstrumentation.h"
     42#include "JSDOMExceptionHandling.h"
    4243#include "Performance.h"
    4344#include "RuntimeEnabledFeatures.h"
     
    548549}
    549550
     551void WorkerGlobalScope::reportError(JSC::JSGlobalObject& globalObject, JSC::JSValue error)
     552{
     553    auto& vm = globalObject.vm();
     554    RELEASE_ASSERT(vm.currentThreadIsHoldingAPILock());
     555    auto* exception = JSC::jsDynamicCast<JSC::Exception*>(vm, error);
     556    if (!exception)
     557        exception = JSC::Exception::create(vm, error);
     558
     559    WebCore::reportException(&globalObject, exception);
     560}
     561
    550562void WorkerGlobalScope::releaseMemoryInWorkers(Synchronous synchronous)
    551563{
  • trunk/Source/WebCore/workers/WorkerGlobalScope.h

    r280504 r281756  
    131131    void beginLoadingFontSoon(FontLoadRequest&) final;
    132132
     133    void reportError(JSC::JSGlobalObject&, JSC::JSValue);
     134
    133135    ReferrerPolicy referrerPolicy() const final;
    134136
Note: See TracChangeset for help on using the changeset viewer.