Title: [210081] trunk/Source/WebCore
Revision
210081
Author
[email protected]
Date
2016-12-21 15:33:37 -0800 (Wed, 21 Dec 2016)

Log Message

[WebIDL] Remove custom binding for ErrorEvent
https://bugs.webkit.org/show_bug.cgi?id=166345

Reviewed by Anders Carlsson.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSBindingsAllInOne.cpp:
* bindings/js/JSErrorEventCustom.cpp: Removed.
Remove JSErrorEventCustom.cpp

* ForwardingHeaders/heap/HandleTypes.h: Added.
Add forwarding header for HandleTypes.h

* bindings/js/JSErrorHandler.cpp:
(WebCore::JSErrorHandler::handleEvent):
Switch to using JSDOMConvert and call the updated name for the error getter.

* bindings/js/ScriptController.h:
* bindings/js/SerializedScriptValue.h:
Remove unnecessary forward declaration of ScriptValue.

* bindings/js/WorkerScriptController.cpp:
(WebCore::WorkerScriptController::evaluate):
* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::sanitizeScriptError):
(WebCore::ScriptExecutionContext::dispatchErrorEvent):
* dom/ScriptExecutionContext.h:
* workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerMessagingProxy::postExceptionToWorkerObject):
Update type that sanitizeScriptError takes from a ScriptValue to a Strong<Unknown>.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateCallWith):
* bindings/scripts/IDLAttributes.txt:
Add a new extended attributes option for the CallWith, GlobalObject, that passes the global object.

* dom/ErrorEvent.cpp:
(WebCore::ErrorEvent::ErrorEvent):
(WebCore::ErrorEvent::error):
(WebCore::ErrorEvent::trySerializeError):
(WebCore::ErrorEvent::sanitizedErrorValue): Deleted.
* dom/ErrorEvent.h:
Store a Strong<Unknown> directly, rather than a ScriptValue. Rename sanitizedErrorValue to 
just error to match the IDL.

* dom/ErrorEvent.idl:
Remove CustomGetter.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (210080 => 210081)


--- trunk/Source/WebCore/CMakeLists.txt	2016-12-21 23:11:37 UTC (rev 210080)
+++ trunk/Source/WebCore/CMakeLists.txt	2016-12-21 23:33:37 UTC (rev 210081)
@@ -1120,7 +1120,6 @@
     bindings/js/JSDocumentCustom.cpp
     bindings/js/JSDocumentFragmentCustom.cpp
     bindings/js/JSElementCustom.cpp
-    bindings/js/JSErrorEventCustom.cpp
     bindings/js/JSErrorHandler.cpp
     bindings/js/JSEventCustom.cpp
     bindings/js/JSEventListener.cpp

Modified: trunk/Source/WebCore/ChangeLog (210080 => 210081)


--- trunk/Source/WebCore/ChangeLog	2016-12-21 23:11:37 UTC (rev 210080)
+++ trunk/Source/WebCore/ChangeLog	2016-12-21 23:33:37 UTC (rev 210081)
@@ -1,3 +1,54 @@
+2016-12-21  Sam Weinig  <[email protected]>
+
+        [WebIDL] Remove custom binding for ErrorEvent
+        https://bugs.webkit.org/show_bug.cgi?id=166345
+
+        Reviewed by Anders Carlsson.
+
+        * CMakeLists.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSBindingsAllInOne.cpp:
+        * bindings/js/JSErrorEventCustom.cpp: Removed.
+        Remove JSErrorEventCustom.cpp
+
+        * ForwardingHeaders/heap/HandleTypes.h: Added.
+        Add forwarding header for HandleTypes.h
+
+        * bindings/js/JSErrorHandler.cpp:
+        (WebCore::JSErrorHandler::handleEvent):
+        Switch to using JSDOMConvert and call the updated name for the error getter.
+
+        * bindings/js/ScriptController.h:
+        * bindings/js/SerializedScriptValue.h:
+        Remove unnecessary forward declaration of ScriptValue.
+
+        * bindings/js/WorkerScriptController.cpp:
+        (WebCore::WorkerScriptController::evaluate):
+        * dom/ScriptExecutionContext.cpp:
+        (WebCore::ScriptExecutionContext::sanitizeScriptError):
+        (WebCore::ScriptExecutionContext::dispatchErrorEvent):
+        * dom/ScriptExecutionContext.h:
+        * workers/WorkerMessagingProxy.cpp:
+        (WebCore::WorkerMessagingProxy::postExceptionToWorkerObject):
+        Update type that sanitizeScriptError takes from a ScriptValue to a Strong<Unknown>.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateCallWith):
+        * bindings/scripts/IDLAttributes.txt:
+        Add a new extended attributes option for the CallWith, GlobalObject, that passes the global object.
+
+        * dom/ErrorEvent.cpp:
+        (WebCore::ErrorEvent::ErrorEvent):
+        (WebCore::ErrorEvent::error):
+        (WebCore::ErrorEvent::trySerializeError):
+        (WebCore::ErrorEvent::sanitizedErrorValue): Deleted.
+        * dom/ErrorEvent.h:
+        Store a Strong<Unknown> directly, rather than a ScriptValue. Rename sanitizedErrorValue to 
+        just error to match the IDL.
+
+        * dom/ErrorEvent.idl:
+        Remove CustomGetter.
+
 2016-12-21  Ryosuke Niwa  <[email protected]>
 
         Modernize findPlainText

Added: trunk/Source/WebCore/ForwardingHeaders/heap/HandleTypes.h (0 => 210081)


--- trunk/Source/WebCore/ForwardingHeaders/heap/HandleTypes.h	                        (rev 0)
+++ trunk/Source/WebCore/ForwardingHeaders/heap/HandleTypes.h	2016-12-21 23:33:37 UTC (rev 210081)
@@ -0,0 +1,2 @@
+#pragma once
+#include <_javascript_Core/HandleTypes.h>

Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (210080 => 210081)


--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp	2016-12-21 23:11:37 UTC (rev 210080)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp	2016-12-21 23:33:37 UTC (rev 210081)
@@ -43,6 +43,7 @@
 #include "SerializedScriptValue.h"
 #include "UniqueIDBDatabaseConnection.h"
 #include <heap/HeapInlines.h>
+#include <heap/StrongInlines.h>
 #include <runtime/AuxiliaryBarrierInlines.h>
 #include <runtime/StructureInlines.h>
 #include <wtf/MainThread.h>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (210080 => 210081)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-12-21 23:11:37 UTC (rev 210080)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-12-21 23:33:37 UTC (rev 210081)
@@ -4008,7 +4008,6 @@
 		A55639D21C6F09E700806D8E /* WorkerConsoleClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A55639CF1C6EFD5900806D8E /* WorkerConsoleClient.cpp */; };
 		A56C5B9A189F34570082D13C /* WebConsoleAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A56C5B98189F34570082D13C /* WebConsoleAgent.cpp */; };
 		A56C5B9B189F34570082D13C /* WebConsoleAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = A56C5B99189F34570082D13C /* WebConsoleAgent.h */; };
-		A56D02A31D0BAD680095E5D3 /* JSErrorEventCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A56D02A21D0B9AF30095E5D3 /* JSErrorEventCustom.cpp */; };
 		A5732B0A136A161D005C8D7C /* DateComponents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5732B08136A161D005C8D7C /* DateComponents.cpp */; };
 		A5732B0B136A161D005C8D7C /* DateComponents.h in Headers */ = {isa = PBXBuildFile; fileRef = A5732B09136A161D005C8D7C /* DateComponents.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A57FD71B1DB9423E006AE24B /* WorkerRuntimeAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A57FD7191DB94236006AE24B /* WorkerRuntimeAgent.cpp */; };
@@ -11686,7 +11685,6 @@
 		A55639D01C6EFD5900806D8E /* WorkerConsoleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerConsoleClient.h; sourceTree = "<group>"; };
 		A56C5B98189F34570082D13C /* WebConsoleAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebConsoleAgent.cpp; sourceTree = "<group>"; };
 		A56C5B99189F34570082D13C /* WebConsoleAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebConsoleAgent.h; sourceTree = "<group>"; };
-		A56D02A21D0B9AF30095E5D3 /* JSErrorEventCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSErrorEventCustom.cpp; sourceTree = "<group>"; };
 		A5732B08136A161D005C8D7C /* DateComponents.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DateComponents.cpp; sourceTree = "<group>"; };
 		A5732B09136A161D005C8D7C /* DateComponents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateComponents.h; sourceTree = "<group>"; };
 		A57FD7191DB94236006AE24B /* WorkerRuntimeAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkerRuntimeAgent.cpp; sourceTree = "<group>"; };
@@ -22106,7 +22104,6 @@
 				BC64649B11D8238C006455B0 /* JSDOMStringMapCustom.cpp */,
 				BCD9C25E0C17AA67005C90A2 /* JSDOMWindowCustom.cpp */,
 				652FBBBB0DE27CB60001D386 /* JSDOMWindowCustom.h */,
-				A56D02A21D0B9AF30095E5D3 /* JSErrorEventCustom.cpp */,
 				2E7582ED12764F260062628B /* JSFileReaderCustom.cpp */,
 				C28083411C6DC96A001451B6 /* JSFontFaceCustom.cpp */,
 				1C24EEAA1C72AA0A0080F8FC /* JSFontFaceSetCustom.cpp */,
@@ -29925,7 +29922,6 @@
 				65DF31F909D1CC60000BE325 /* JSElement.cpp in Sources */,
 				BC2ED5550C6B9BD300920BFF /* JSElementCustom.cpp in Sources */,
 				2ECF7ADC10162B3800427DE7 /* JSErrorEvent.cpp in Sources */,
-				A56D02A31D0BAD680095E5D3 /* JSErrorEventCustom.cpp in Sources */,
 				F3D461481161D53200CA0D09 /* JSErrorHandler.cpp in Sources */,
 				14E8378409F85D1C00B85AE4 /* JSEvent.cpp in Sources */,
 				BCEFAF4E0C317E6900FA81F6 /* JSEventCustom.cpp in Sources */,

Modified: trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp (210080 => 210081)


--- trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp	2016-12-21 23:11:37 UTC (rev 210080)
+++ trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp	2016-12-21 23:33:37 UTC (rev 210081)
@@ -64,7 +64,6 @@
 #include "JSDocumentCustom.cpp"
 #include "JSDocumentFragmentCustom.cpp"
 #include "JSElementCustom.cpp"
-#include "JSErrorEventCustom.cpp"
 #include "JSErrorHandler.cpp"
 #include "JSEventCustom.cpp"
 #include "JSEventListener.cpp"

Deleted: trunk/Source/WebCore/bindings/js/JSErrorEventCustom.cpp (210080 => 210081)


--- trunk/Source/WebCore/bindings/js/JSErrorEventCustom.cpp	2016-12-21 23:11:37 UTC (rev 210080)
+++ trunk/Source/WebCore/bindings/js/JSErrorEventCustom.cpp	2016-12-21 23:33:37 UTC (rev 210081)
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "JSErrorEvent.h"
-
-#include "ErrorEvent.h"
-#include <heap/HeapInlines.h>
-
-using namespace JSC;
-
-namespace WebCore {
-
-JSValue JSErrorEvent::error(ExecState& state) const
-{
-    return wrapped().sanitizedErrorValue(state, *globalObject());
-}
-
-} // namespace WebCore

Modified: trunk/Source/WebCore/bindings/js/JSErrorHandler.cpp (210080 => 210081)


--- trunk/Source/WebCore/bindings/js/JSErrorHandler.cpp	2016-12-21 23:11:37 UTC (rev 210080)
+++ trunk/Source/WebCore/bindings/js/JSErrorHandler.cpp	2016-12-21 23:33:37 UTC (rev 210081)
@@ -36,6 +36,7 @@
 #include "ErrorEvent.h"
 #include "Event.h"
 #include "EventNames.h"
+#include "JSDOMConvert.h"
 #include "JSEvent.h"
 #include "JSMainThreadExecState.h"
 #include "JSMainThreadExecStateInstrumentation.h"
@@ -90,11 +91,11 @@
         globalObject->setCurrentEvent(event);
 
         MarkedArgumentBuffer args;
-        args.append(jsStringWithCache(exec, errorEvent.message()));
-        args.append(jsStringWithCache(exec, errorEvent.filename()));
-        args.append(jsNumber(errorEvent.lineno()));
-        args.append(jsNumber(errorEvent.colno()));
-        args.append(errorEvent.sanitizedErrorValue(*exec, *globalObject));
+        args.append(toJS<IDLDOMString>(*exec, errorEvent.message()));
+        args.append(toJS<IDLUSVString>(*exec, errorEvent.filename()));
+        args.append(toJS<IDLUnsignedLong>(errorEvent.lineno()));
+        args.append(toJS<IDLUnsignedLong>(errorEvent.colno()));
+        args.append(errorEvent.error(*exec, *globalObject));
 
         VM& vm = globalObject->vm();
         VMEntryScope entryScope(vm, vm.entryScope ? vm.entryScope->globalObject() : globalObject);

Modified: trunk/Source/WebCore/bindings/js/ScriptController.h (210080 => 210081)


--- trunk/Source/WebCore/bindings/js/ScriptController.h	2016-12-21 23:11:37 UTC (rev 210080)
+++ trunk/Source/WebCore/bindings/js/ScriptController.h	2016-12-21 23:33:37 UTC (rev 210081)
@@ -37,10 +37,6 @@
 
 struct NPObject;
 
-namespace Deprecated {
-class ScriptValue;
-}
-
 namespace JSC {
 class ExecState;
 class JSGlobalObject;

Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.h (210080 => 210081)


--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.h	2016-12-21 23:11:37 UTC (rev 210080)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.h	2016-12-21 23:33:37 UTC (rev 210081)
@@ -27,7 +27,6 @@
 #pragma once
 
 #include "ExceptionOr.h"
-#include <bindings/ScriptValue.h>
 #include <heap/Strong.h>
 #include <runtime/ArrayBuffer.h>
 #include <runtime/JSCJSValue.h>

Modified: trunk/Source/WebCore/bindings/js/WorkerScriptController.cpp (210080 => 210081)


--- trunk/Source/WebCore/bindings/js/WorkerScriptController.cpp	2016-12-21 23:11:37 UTC (rev 210080)
+++ trunk/Source/WebCore/bindings/js/WorkerScriptController.cpp	2016-12-21 23:33:37 UTC (rev 210081)
@@ -136,7 +136,7 @@
         int lineNumber = 0;
         int columnNumber = 0;
         String sourceURL = sourceCode.url().string();
-        Deprecated::ScriptValue error;
+        JSC::Strong<JSC::Unknown> error;
         if (m_workerGlobalScope->sanitizeScriptError(errorMessage, lineNumber, columnNumber, sourceURL, error, sourceCode.cachedScript()))
             returnedException = JSC::Exception::create(vm, createError(exec, errorMessage.impl()));
     }

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (210080 => 210081)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-12-21 23:11:37 UTC (rev 210080)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-12-21 23:33:37 UTC (rev 210081)
@@ -4254,17 +4254,13 @@
 
 sub GenerateCallWith
 {
-    my $callWith = shift;
+    my ($callWith, $outputArray, $returnValue, $function, $statePointer, $stateReference, $globalObject) = @_;
+
     return () unless $callWith;
-    my $outputArray = shift;
-    my $returnValue = shift;
-    my $function = shift;
-    my $statePointer = shift;
-    my $stateReference = shift;
-    my $globalObject = shift;
 
     my @callWithArgs;
     push(@callWithArgs, $stateReference) if $codeGenerator->ExtendedAttributeContains($callWith, "ScriptState");
+    push(@callWithArgs, "*${globalObject}") if $codeGenerator->ExtendedAttributeContains($callWith, "GlobalObject");
     if ($codeGenerator->ExtendedAttributeContains($callWith, "ScriptExecutionContext")) {
         push(@$outputArray, "    auto* context = $globalObject->scriptExecutionContext();\n");
         push(@$outputArray, "    if (!context)\n");

Modified: trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt (210080 => 210081)


--- trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt	2016-12-21 23:11:37 UTC (rev 210080)
+++ trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt	2016-12-21 23:33:37 UTC (rev 210081)
@@ -24,7 +24,7 @@
 CEReactions
 CachedAttribute
 CallbackNeedsOperatorEqual
-CallWith=Document|ScriptExecutionContext|ScriptState|ScriptArguments|CallStack|ActiveWindow|FirstWindow|CallerDocument|CallerWindow
+CallWith=Document|ScriptExecutionContext|ScriptState|ScriptArguments|CallStack|GlobalObject|ActiveWindow|FirstWindow|CallerDocument|CallerWindow
 CheckSecurity
 CheckSecurityForNode
 Clamp
@@ -110,7 +110,7 @@
 ReportExtraMemoryCost
 ReportExternalMemoryCost
 RequiresExistingAtomicString
-SetterCallWith=ScriptExecutionContext|ScriptState|ScriptArguments|CallStack|ActiveWindow|FirstWindow
+SetterCallWith=ScriptExecutionContext|ScriptState|ScriptArguments|CallStack|GlobalObject|ActiveWindow|FirstWindow
 SetterMayThrowException
 SkipVTableValidation
 SuppressToJSObject

Modified: trunk/Source/WebCore/dom/ErrorEvent.cpp (210080 => 210081)


--- trunk/Source/WebCore/dom/ErrorEvent.cpp	2016-12-21 23:11:37 UTC (rev 210080)
+++ trunk/Source/WebCore/dom/ErrorEvent.cpp	2016-12-21 23:33:37 UTC (rev 210081)
@@ -35,6 +35,7 @@
 #include "DOMWrapperWorld.h"
 #include "EventNames.h"
 #include <heap/HeapInlines.h>
+#include <heap/StrongInlines.h>
 
 using namespace JSC;
 
@@ -50,7 +51,7 @@
 {
 }
 
-ErrorEvent::ErrorEvent(const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, const Deprecated::ScriptValue& error)
+ErrorEvent::ErrorEvent(const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, JSC::Strong<JSC::Unknown> error)
     : Event(eventNames().errorEvent, false, true)
     , m_message(message)
     , m_fileName(fileName)
@@ -69,9 +70,9 @@
     return ErrorEventInterfaceType;
 }
 
-JSValue ErrorEvent::sanitizedErrorValue(ExecState& exec, JSGlobalObject& globalObject)
+JSValue ErrorEvent::error(ExecState& exec, JSGlobalObject& globalObject)
 {    
-    auto error = m_error.jsValue();
+    auto error = m_error.get();
     if (!error)
         return jsNull();
 
@@ -90,7 +91,7 @@
 RefPtr<SerializedScriptValue> ErrorEvent::trySerializeError(ExecState& exec)
 {
     if (!m_triedToSerialize) {
-        m_serializedDetail = SerializedScriptValue::create(exec, m_error, NonThrowing);
+        m_serializedDetail = SerializedScriptValue::create(exec, m_error.get(), NonThrowing);
         m_triedToSerialize = true;
     }
     return m_serializedDetail;

Modified: trunk/Source/WebCore/dom/ErrorEvent.h (210080 => 210081)


--- trunk/Source/WebCore/dom/ErrorEvent.h	2016-12-21 23:11:37 UTC (rev 210080)
+++ trunk/Source/WebCore/dom/ErrorEvent.h	2016-12-21 23:33:37 UTC (rev 210081)
@@ -33,7 +33,7 @@
 
 #include "Event.h"
 #include "SerializedScriptValue.h"
-#include <bindings/ScriptValue.h>
+#include <heap/Strong.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
@@ -40,7 +40,7 @@
 
 class ErrorEvent final : public Event {
 public:
-    static Ref<ErrorEvent> create(const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, const Deprecated::ScriptValue& error)
+    static Ref<ErrorEvent> create(const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, JSC::Strong<JSC::Unknown> error)
     {
         return adoptRef(*new ErrorEvent(message, fileName, lineNumber, columnNumber, error));
     }
@@ -64,13 +64,12 @@
     const String& filename() const { return m_fileName; }
     unsigned lineno() const { return m_lineNumber; }
     unsigned colno() const { return m_columnNumber; }
-    const Deprecated::ScriptValue& error() const { return m_error; }
-    JSC::JSValue sanitizedErrorValue(JSC::ExecState&, JSC::JSGlobalObject&);
+    JSC::JSValue error(JSC::ExecState&, JSC::JSGlobalObject&);
 
     EventInterface eventInterface() const override;
 
 private:
-    ErrorEvent(const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, const Deprecated::ScriptValue& error);
+    ErrorEvent(const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, JSC::Strong<JSC::Unknown> error);
     ErrorEvent(JSC::ExecState&, const AtomicString&, const Init&, IsTrusted);
 
     RefPtr<SerializedScriptValue> trySerializeError(JSC::ExecState&);
@@ -81,7 +80,7 @@
     String m_fileName;
     unsigned m_lineNumber;
     unsigned m_columnNumber;
-    Deprecated::ScriptValue m_error;
+    JSC::Strong<JSC::Unknown> m_error;
     RefPtr<SerializedScriptValue> m_serializedDetail;
     bool m_triedToSerialize { false };
 };

Modified: trunk/Source/WebCore/dom/ErrorEvent.idl (210080 => 210081)


--- trunk/Source/WebCore/dom/ErrorEvent.idl	2016-12-21 23:11:37 UTC (rev 210080)
+++ trunk/Source/WebCore/dom/ErrorEvent.idl	2016-12-21 23:33:37 UTC (rev 210081)
@@ -38,7 +38,7 @@
     readonly attribute USVString filename;
     readonly attribute unsigned long lineno;
     readonly attribute unsigned long colno;
-    [CustomGetter] readonly attribute any error;
+    [CallWith=ScriptState&GlobalObject] readonly attribute any error;
 };
 
 dictionary ErrorEventInit : EventInit {

Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.cpp (210080 => 210081)


--- trunk/Source/WebCore/dom/ScriptExecutionContext.cpp	2016-12-21 23:11:37 UTC (rev 210080)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.cpp	2016-12-21 23:33:37 UTC (rev 210081)
@@ -34,6 +34,7 @@
 #include "DatabaseContext.h"
 #include "Document.h"
 #include "ErrorEvent.h"
+#include "JSDOMWindow.h"
 #include "MessagePort.h"
 #include "NoEventDispatchAssertion.h"
 #include "PublicURLManager.h"
@@ -42,18 +43,12 @@
 #include "Settings.h"
 #include "WorkerGlobalScope.h"
 #include "WorkerThread.h"
+#include <heap/StrongInlines.h>
 #include <inspector/ScriptCallStack.h>
 #include <runtime/Exception.h>
 #include <wtf/MainThread.h>
 #include <wtf/Ref.h>
 
-// FIXME: This is a layering violation.
-#include "JSDOMWindow.h"
-
-#if PLATFORM(IOS)
-#include "Document.h"
-#endif
-
 using namespace Inspector;
 
 namespace WebCore {
@@ -357,7 +352,7 @@
     m_destructionObservers.remove(&observer);
 }
 
-bool ScriptExecutionContext::sanitizeScriptError(String& errorMessage, int& lineNumber, int& columnNumber, String& sourceURL, Deprecated::ScriptValue& error, CachedScript* cachedScript)
+bool ScriptExecutionContext::sanitizeScriptError(String& errorMessage, int& lineNumber, int& columnNumber, String& sourceURL, JSC::Strong<JSC::Unknown>& error, CachedScript* cachedScript)
 {
     ASSERT(securityOrigin());
     if (cachedScript) {
@@ -369,10 +364,10 @@
         return false;
 
     errorMessage = "Script error.";
-    sourceURL = String();
+    sourceURL = { };
     lineNumber = 0;
     columnNumber = 0;
-    error = Deprecated::ScriptValue();
+    error = { };
     return true;
 }
 
@@ -420,7 +415,7 @@
     int line = lineNumber;
     int column = columnNumber;
     String sourceName = sourceURL;
-    Deprecated::ScriptValue error = exception && exception->value() ? Deprecated::ScriptValue(vm(), exception->value()) : Deprecated::ScriptValue();
+    JSC::Strong<JSC::Unknown> error = exception && exception->value() ? JSC::Strong<JSC::Unknown>(vm(), exception->value()) : JSC::Strong<JSC::Unknown>();
     sanitizeScriptError(message, line, column, sourceName, error, cachedScript);
 
     ASSERT(!m_inDispatchErrorEvent);

Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.h (210080 => 210081)


--- trunk/Source/WebCore/dom/ScriptExecutionContext.h	2016-12-21 23:11:37 UTC (rev 210080)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.h	2016-12-21 23:33:37 UTC (rev 210081)
@@ -31,19 +31,17 @@
 #include "DOMTimer.h"
 #include "SecurityContext.h"
 #include "Supplementable.h"
+#include <heap/HandleTypes.h>
 #include <runtime/ConsoleTypes.h>
 #include <wtf/CrossThreadTask.h>
 #include <wtf/Function.h>
 #include <wtf/HashSet.h>
 
-namespace Deprecated {
-class ScriptValue;
-}
-
 namespace JSC {
 class Exception;
 class ExecState;
 class VM;
+template <typename T> class Strong;
 }
 
 namespace Inspector {
@@ -94,7 +92,7 @@
 
     virtual String resourceRequestIdentifier() const { return String(); };
 
-    bool sanitizeScriptError(String& errorMessage, int& lineNumber, int& columnNumber, String& sourceURL, Deprecated::ScriptValue& error, CachedScript* = nullptr);
+    bool sanitizeScriptError(String& errorMessage, int& lineNumber, int& columnNumber, String& sourceURL, JSC::Strong<JSC::Unknown>& error, CachedScript* = nullptr);
     void reportException(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL, JSC::Exception*, RefPtr<Inspector::ScriptCallStack>&&, CachedScript* = nullptr);
 
     void addConsoleMessage(MessageSource, MessageLevel, const String& message, const String& sourceURL, unsigned lineNumber, unsigned columnNumber, JSC::ExecState* = nullptr, unsigned long requestIdentifier = 0);

Modified: trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp (210080 => 210081)


--- trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp	2016-12-21 23:11:37 UTC (rev 210080)
+++ trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp	2016-12-21 23:33:37 UTC (rev 210081)
@@ -161,7 +161,7 @@
         // We don't bother checking the askedToTerminate() flag here, because exceptions should *always* be reported even if the thread is terminated.
         // This is intentionally different than the behavior in MessageWorkerTask, because terminated workers no longer deliver messages (section 4.6 of the WebWorker spec), but they do report exceptions.
 
-        bool errorHandled = !workerObject->dispatchEvent(ErrorEvent::create(errorMessage, sourceURL, lineNumber, columnNumber, Deprecated::ScriptValue()));
+        bool errorHandled = !workerObject->dispatchEvent(ErrorEvent::create(errorMessage, sourceURL, lineNumber, columnNumber, { }));
         if (!errorHandled)
             context.reportException(errorMessage, lineNumber, columnNumber, sourceURL, nullptr, nullptr);
     });
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to