Remove more uses of Deprecated::ScriptXXX
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 17 Apr 2016 18:39:13 +0000 (18:39 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 17 Apr 2016 18:39:13 +0000 (18:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=156660

Reviewed by Antti Koivisto.

Source/JavaScriptCore:

* bindings/ScriptFunctionCall.cpp:
(Deprecated::ScriptCallArgumentHandler::appendArgument): Deleted
unneeded overloads that take a ScriptObject and ScriptValue.
* bindings/ScriptFunctionCall.h: Ditto.

* bindings/ScriptObject.h: Added operator so this can change
itself into a JSObject*. Helps while phasing this class out.

* bindings/ScriptValue.h: Export toInspectorValue so it can be
used in WebCore.

* inspector/InjectedScriptManager.cpp:
(Inspector::InjectedScriptManager::createInjectedScript): Changed
return value from Deprecated::ScriptObject to JSObject*.
(Inspector::InjectedScriptManager::injectedScriptFor): Updated for
the return value change above.
* inspector/InjectedScriptManager.h: Ditto.

Source/WebCore:

* Modules/mediacontrols/MediaControlsHost.h: Removed unneeded include.

* Modules/plugins/PluginReplacement.h: Removed unneeded include.
Changed argument to installReplacement into a reference. Changed return
value for creation function from PassRefPtr to Ref.

* Modules/plugins/QuickTimePluginReplacement.h: Removed unneeded includes and
forward declarations. Marked class final. Made almost everything private.

* Modules/plugins/QuickTimePluginReplacement.mm:
(WebCore::QuickTimePluginReplacement::create): Changed to return Ref.
(WebCore::QuickTimePluginReplacement::installReplacement): Changed to take
a reference.

* Modules/plugins/YouTubePluginReplacement.cpp:
(WebCore::YouTubePluginReplacement::create): Changed to return Ref.
(WebCore::YouTubePluginReplacement::installReplacement): Changed to take
a reference.

* Modules/plugins/YouTubePluginReplacement.h: Removed unneeded includes and
forward declarations. Marked class final. Changed return type of create.

* Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::didReceiveBinaryData): Removed local variable so the
MessageEvent::create function gets a Ref&& instead of a RefPtr without having
to add explicit WTFMove.

* bindings/js/DOMRequestState.h: Removed code that set m_exec twice.

* bindings/js/Dictionary.h: Reformatted function templates to use a single
line so they are easier to look at.
(WebCore::Dictionary::getEventListener): Rewrote this so it no longer uses
a Deprecated::ScriptValue and also make it a little more compact and terse.

* bindings/js/JSCommandLineAPIHostCustom.cpp:
(WebCore::JSCommandLineAPIHost::inspect): Rewrote to use JSValue instead of
Deprecated::ScriptValue. Considerably more efficient.

* bindings/js/JSMessageEventCustom.cpp:
(WebCore::JSMessageEvent::data): Streamlined to use Deprecated::ScriptValue
a little bit less.

* bindings/js/JSNodeCustom.cpp: Moved include here from header.
* bindings/js/JSNodeCustom.h: Moved include from here to cpp file.

* bindings/js/JSPopStateEventCustom.cpp:
(WebCore::JSPopStateEvent::state): Updated for changes to return value of the
state() and serializedState functions.

* bindings/js/ScriptState.h: Removed the ScriptState typedef.

* bindings/js/SerializedScriptValue.cpp: Moved include here from header.
* bindings/js/SerializedScriptValue.h: Moved include from here to cpp file.

* css/FontFace.cpp:
(WebCore::FontFace::create): Changed argument to JSValue instead of ScriptValue.
* css/FontFace.h: Ditto.

* dom/MessageEvent.cpp: Moved create functions in here from header file.
Removed some unused ones including one that took a Deprecated::ScriptValue.
* dom/MessageEvent.h: Streamlined create functions, removing unused functions,
unused arguments, and unused default values for arguments. Also moved them all
into the cpp file instead of inlining them. Also changed the return type of
dataAsScriptValue to JSValue.

* dom/NodeFilterCondition.h: Removed unneeded include. Tweaked formatting.

* dom/PopStateEvent.h: Changed return value of state to be a JSValue and of
serializedState to be a raw pointer, not a PassRefPtr.

* dom/Traversal.h: Removed unneeded include. Removed unnecessary use of
unsigned long instead of unsigned. Fixed indentation.

* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::didAddUserAgentShadowRoot): Pass reference.

* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::buildObjectForEventListener): Pass JSValue instead
of constructing a Deprecated::ScriptValue.

* inspector/InspectorFrontendHost.cpp:
(WebCore::FrontendMenuProvider::disconnect): Initialize without explicitly
mentioning the Deprecated::ScriptObject type.

* inspector/InspectorIndexedDBAgent.cpp: Removed unneeded include.

* inspector/InspectorInstrumentation.h: Removed unneeded include and also
declaration of two non-existent functions.

* page/DOMWindow.cpp:
(WebCore::PostMessageTimer::PostMessageTimer): Tweaked types a little bit to
match what is used in MessageEvent now.
(WebCore::PostMessageTimer::event): Streamlined a bit and changed type to
reference.
(WebCore::DOMWindow::postMessage): Updated for changes above.
(WebCore::DOMWindow::postMessageTimerFired): Ditto.

* page/EventSource.cpp:
(WebCore::EventSource::createMessageEvent): Removed now-unneeded
"false, false" from MessageEvent::create function call.

* page/csp/ContentSecurityPolicy.h: Removed unneeded include.

* page/csp/ContentSecurityPolicyDirectiveList.h: Removed unneeded
include and also unneeded non-copyable, since the class has a reference as
a data member and so is automatically non-copyable.

* testing/Internals.cpp:
(WebCore::Internals::description): Changed to take JSValue.
(WebCore::Internals::parserMetaData): Ditto.
(WebCore::Internals::serializeObject): Removed unnecessary copying of vector.
(WebCore::Internals::isFromCurrentWorld): Changed to take JSValue.
(WebCore::Internals::isReadableStreamDisturbed): Changed to not rely on the
ScriptState typedef and call it JSC::ExecState.

* testing/Internals.h: Removed unneeded includes. Removed unneeded and
inappropriate use of ASSERT_NO_EXCEPTION.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199642 268f45cc-cd09-0410-ab3c-d52691b4dbfc

44 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bindings/ScriptFunctionCall.cpp
Source/JavaScriptCore/bindings/ScriptFunctionCall.h
Source/JavaScriptCore/bindings/ScriptObject.h
Source/JavaScriptCore/bindings/ScriptValue.h
Source/JavaScriptCore/inspector/InjectedScriptManager.cpp
Source/JavaScriptCore/inspector/InjectedScriptManager.h
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediacontrols/MediaControlsHost.h
Source/WebCore/Modules/plugins/PluginReplacement.h
Source/WebCore/Modules/plugins/QuickTimePluginReplacement.h
Source/WebCore/Modules/plugins/QuickTimePluginReplacement.mm
Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp
Source/WebCore/Modules/plugins/YouTubePluginReplacement.h
Source/WebCore/Modules/websockets/WebSocket.cpp
Source/WebCore/bindings/js/DOMRequestState.h
Source/WebCore/bindings/js/Dictionary.h
Source/WebCore/bindings/js/JSCommandLineAPIHostCustom.cpp
Source/WebCore/bindings/js/JSMessageEventCustom.cpp
Source/WebCore/bindings/js/JSNodeCustom.cpp
Source/WebCore/bindings/js/JSNodeCustom.h
Source/WebCore/bindings/js/JSPopStateEventCustom.cpp
Source/WebCore/bindings/js/ScriptState.h
Source/WebCore/bindings/js/SerializedScriptValue.cpp
Source/WebCore/bindings/js/SerializedScriptValue.h
Source/WebCore/css/FontFace.cpp
Source/WebCore/css/FontFace.h
Source/WebCore/dom/MessageEvent.cpp
Source/WebCore/dom/MessageEvent.h
Source/WebCore/dom/NodeFilterCondition.h
Source/WebCore/dom/PopStateEvent.h
Source/WebCore/dom/Traversal.cpp
Source/WebCore/dom/Traversal.h
Source/WebCore/html/HTMLPlugInElement.cpp
Source/WebCore/inspector/InspectorDOMAgent.cpp
Source/WebCore/inspector/InspectorFrontendHost.cpp
Source/WebCore/inspector/InspectorIndexedDBAgent.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/EventSource.cpp
Source/WebCore/page/csp/ContentSecurityPolicy.h
Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.h
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h

index f8c0635..9db911b 100644 (file)
@@ -1,3 +1,28 @@
+2016-04-17  Darin Adler  <darin@apple.com>
+
+        Remove more uses of Deprecated::ScriptXXX
+        https://bugs.webkit.org/show_bug.cgi?id=156660
+
+        Reviewed by Antti Koivisto.
+
+        * bindings/ScriptFunctionCall.cpp:
+        (Deprecated::ScriptCallArgumentHandler::appendArgument): Deleted
+        unneeded overloads that take a ScriptObject and ScriptValue.
+        * bindings/ScriptFunctionCall.h: Ditto.
+
+        * bindings/ScriptObject.h: Added operator so this can change
+        itself into a JSObject*. Helps while phasing this class out.
+
+        * bindings/ScriptValue.h: Export toInspectorValue so it can be
+        used in WebCore.
+
+        * inspector/InjectedScriptManager.cpp:
+        (Inspector::InjectedScriptManager::createInjectedScript): Changed
+        return value from Deprecated::ScriptObject to JSObject*.
+        (Inspector::InjectedScriptManager::injectedScriptFor): Updated for
+        the return value change above.
+        * inspector/InjectedScriptManager.h: Ditto.
+
 2016-04-16  Benjamin Poulain  <bpoulain@webkit.org>
 
         [JSC] DFG should support relational comparisons of Number and Other
index a4dc604..c3d0d1b 100644 (file)
@@ -41,15 +41,6 @@ using namespace JSC;
 
 namespace Deprecated {
 
-void ScriptCallArgumentHandler::appendArgument(const Deprecated::ScriptObject& argument)
-{
-    if (argument.scriptState() != m_exec) {
-        ASSERT_NOT_REACHED();
-        return;
-    }
-    m_arguments.append(argument.jsObject());
-}
-
 void ScriptCallArgumentHandler::appendArgument(const String& argument)
 {
     JSLockHolder lock(m_exec);
index 497eac0..1037c42 100644 (file)
@@ -46,8 +46,6 @@ class JS_EXPORT_PRIVATE ScriptCallArgumentHandler {
 public:
     ScriptCallArgumentHandler(JSC::ExecState* state) : m_exec(state) { }
 
-    void appendArgument(const ScriptObject&);
-    void appendArgument(const ScriptValue&);
     void appendArgument(const char*);
     void appendArgument(const String&);
     void appendArgument(JSC::JSValue);
index 8f7b0dc..baa1ea8 100644 (file)
@@ -29,8 +29,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef ScriptObject_h
-#define ScriptObject_h
+#pragma once
 
 #include "JSObject.h"
 #include "ScriptValue.h"
@@ -41,15 +40,15 @@ class ScriptObject : public ScriptValue {
 public:
     JS_EXPORT_PRIVATE ScriptObject(JSC::ExecState*, JSC::JSObject*);
     JS_EXPORT_PRIVATE ScriptObject(JSC::ExecState*, const ScriptValue&);
-    ScriptObject() : m_scriptState(nullptr) { }
+    ScriptObject() { }
+
+    operator JSC::JSObject*() const { return jsObject(); }
 
     JSC::JSObject* jsObject() const { return asObject(jsValue()); }
     JSC::ExecState* scriptState() const { return m_scriptState; }
 
-protected:
-    JSC::ExecState* m_scriptState;
+private:
+    JSC::ExecState* m_scriptState { nullptr };
 };
 
 } // namespace Deprecated
-
-#endif // ScriptObject_h
index 76de1ea..1f354f2 100644 (file)
@@ -43,7 +43,7 @@ namespace Inspector {
 
 class InspectorValue;
 
-RefPtr<InspectorValue> toInspectorValue(JSC::ExecState&, JSC::JSValue);
+JS_EXPORT_PRIVATE RefPtr<InspectorValue> toInspectorValue(JSC::ExecState&, JSC::JSValue);
 
 }
 
index fcbf814..d0d1263 100644 (file)
@@ -131,7 +131,7 @@ String InjectedScriptManager::injectedScriptSource()
     return StringImpl::createWithoutCopying(InjectedScriptSource_js, sizeof(InjectedScriptSource_js));
 }
 
-Deprecated::ScriptObject InjectedScriptManager::createInjectedScript(const String& source, ExecState* scriptState, int id)
+JSC::JSObject* InjectedScriptManager::createInjectedScript(const String& source, ExecState* scriptState, int id)
 {
     JSLockHolder lock(scriptState);
 
@@ -143,12 +143,12 @@ Deprecated::ScriptObject InjectedScriptManager::createInjectedScript(const Strin
     InspectorEvaluateHandler evaluateHandler = m_environment.evaluateHandler();
     JSValue functionValue = evaluateHandler(scriptState, sourceCode, globalThisValue, evaluationException);
     if (evaluationException)
-        return Deprecated::ScriptObject();
+        return nullptr;
 
     CallData callData;
     CallType callType = getCallData(functionValue, callData);
     if (callType == CallType::None)
-        return Deprecated::ScriptObject();
+        return nullptr;
 
     MarkedArgumentBuffer args;
     args.append(m_injectedScriptHost->wrapper(scriptState, globalObject));
@@ -157,10 +157,7 @@ Deprecated::ScriptObject InjectedScriptManager::createInjectedScript(const Strin
 
     JSValue result = JSC::call(scriptState, functionValue, callType, callData, globalThisValue, args);
     scriptState->clearException();
-    if (result.isObject())
-        return Deprecated::ScriptObject(scriptState, result.getObject());
-
-    return Deprecated::ScriptObject();
+    return result.getObject();
 }
 
 InjectedScript InjectedScriptManager::injectedScriptFor(ExecState* inspectedExecState)
@@ -176,14 +173,14 @@ InjectedScript InjectedScriptManager::injectedScriptFor(ExecState* inspectedExec
         return InjectedScript();
 
     int id = injectedScriptIdFor(inspectedExecState);
-    Deprecated::ScriptObject injectedScriptObject = createInjectedScript(injectedScriptSource(), inspectedExecState, id);
-    if (injectedScriptObject.scriptState() != inspectedExecState) {
+    auto injectedScriptObject = createInjectedScript(injectedScriptSource(), inspectedExecState, id);
+    if (!injectedScriptObject) {
         WTFLogAlways("Failed to parse/execute InjectedScriptSource.js!");
         WTFLogAlways("%s\n", injectedScriptSource().ascii().data());
         RELEASE_ASSERT_NOT_REACHED();
     }
 
-    InjectedScript result(injectedScriptObject, &m_environment);
+    InjectedScript result({ inspectedExecState, injectedScriptObject }, &m_environment);
     m_idToInjectedScript.set(id, result);
     didCreateInjectedScript(result);
     return result;
index e18d7cd..606d9f7 100644 (file)
@@ -74,7 +74,7 @@ protected:
 
 private:
     String injectedScriptSource();
-    Deprecated::ScriptObject createInjectedScript(const String& source, JSC::ExecState*, int id);
+    JSC::JSObject* createInjectedScript(const String& source, JSC::ExecState*, int id);
 
     InspectorEnvironment& m_environment;
     RefPtr<InjectedScriptHost> m_injectedScriptHost;
index 1a15eca..9377655 100644 (file)
@@ -1,3 +1,128 @@
+2016-04-17  Darin Adler  <darin@apple.com>
+
+        Remove more uses of Deprecated::ScriptXXX
+        https://bugs.webkit.org/show_bug.cgi?id=156660
+
+        Reviewed by Antti Koivisto.
+
+        * Modules/mediacontrols/MediaControlsHost.h: Removed unneeded include.
+
+        * Modules/plugins/PluginReplacement.h: Removed unneeded include.
+        Changed argument to installReplacement into a reference. Changed return
+        value for creation function from PassRefPtr to Ref.
+
+        * Modules/plugins/QuickTimePluginReplacement.h: Removed unneeded includes and
+        forward declarations. Marked class final. Made almost everything private.
+
+        * Modules/plugins/QuickTimePluginReplacement.mm:
+        (WebCore::QuickTimePluginReplacement::create): Changed to return Ref.
+        (WebCore::QuickTimePluginReplacement::installReplacement): Changed to take
+        a reference.
+
+        * Modules/plugins/YouTubePluginReplacement.cpp:
+        (WebCore::YouTubePluginReplacement::create): Changed to return Ref.
+        (WebCore::YouTubePluginReplacement::installReplacement): Changed to take
+        a reference.
+
+        * Modules/plugins/YouTubePluginReplacement.h: Removed unneeded includes and
+        forward declarations. Marked class final. Changed return type of create.
+
+        * Modules/websockets/WebSocket.cpp:
+        (WebCore::WebSocket::didReceiveBinaryData): Removed local variable so the
+        MessageEvent::create function gets a Ref&& instead of a RefPtr without having
+        to add explicit WTFMove.
+
+        * bindings/js/DOMRequestState.h: Removed code that set m_exec twice.
+
+        * bindings/js/Dictionary.h: Reformatted function templates to use a single
+        line so they are easier to look at.
+        (WebCore::Dictionary::getEventListener): Rewrote this so it no longer uses
+        a Deprecated::ScriptValue and also make it a little more compact and terse.
+
+        * bindings/js/JSCommandLineAPIHostCustom.cpp:
+        (WebCore::JSCommandLineAPIHost::inspect): Rewrote to use JSValue instead of
+        Deprecated::ScriptValue. Considerably more efficient.
+
+        * bindings/js/JSMessageEventCustom.cpp:
+        (WebCore::JSMessageEvent::data): Streamlined to use Deprecated::ScriptValue
+        a little bit less.
+
+        * bindings/js/JSNodeCustom.cpp: Moved include here from header.
+        * bindings/js/JSNodeCustom.h: Moved include from here to cpp file.
+
+        * bindings/js/JSPopStateEventCustom.cpp:
+        (WebCore::JSPopStateEvent::state): Updated for changes to return value of the
+        state() and serializedState functions.
+
+        * bindings/js/ScriptState.h: Removed the ScriptState typedef.
+
+        * bindings/js/SerializedScriptValue.cpp: Moved include here from header.
+        * bindings/js/SerializedScriptValue.h: Moved include from here to cpp file.
+
+        * css/FontFace.cpp:
+        (WebCore::FontFace::create): Changed argument to JSValue instead of ScriptValue.
+        * css/FontFace.h: Ditto.
+
+        * dom/MessageEvent.cpp: Moved create functions in here from header file.
+        Removed some unused ones including one that took a Deprecated::ScriptValue.
+        * dom/MessageEvent.h: Streamlined create functions, removing unused functions,
+        unused arguments, and unused default values for arguments. Also moved them all
+        into the cpp file instead of inlining them. Also changed the return type of
+        dataAsScriptValue to JSValue.
+
+        * dom/NodeFilterCondition.h: Removed unneeded include. Tweaked formatting.
+
+        * dom/PopStateEvent.h: Changed return value of state to be a JSValue and of
+        serializedState to be a raw pointer, not a PassRefPtr.
+
+        * dom/Traversal.h: Removed unneeded include. Removed unnecessary use of
+        unsigned long instead of unsigned. Fixed indentation.
+
+        * html/HTMLPlugInElement.cpp:
+        (WebCore::HTMLPlugInElement::didAddUserAgentShadowRoot): Pass reference.
+
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::buildObjectForEventListener): Pass JSValue instead
+        of constructing a Deprecated::ScriptValue.
+
+        * inspector/InspectorFrontendHost.cpp:
+        (WebCore::FrontendMenuProvider::disconnect): Initialize without explicitly
+        mentioning the Deprecated::ScriptObject type.
+
+        * inspector/InspectorIndexedDBAgent.cpp: Removed unneeded include.
+
+        * inspector/InspectorInstrumentation.h: Removed unneeded include and also
+        declaration of two non-existent functions.
+
+        * page/DOMWindow.cpp:
+        (WebCore::PostMessageTimer::PostMessageTimer): Tweaked types a little bit to
+        match what is used in MessageEvent now.
+        (WebCore::PostMessageTimer::event): Streamlined a bit and changed type to
+        reference.
+        (WebCore::DOMWindow::postMessage): Updated for changes above.
+        (WebCore::DOMWindow::postMessageTimerFired): Ditto.
+
+        * page/EventSource.cpp:
+        (WebCore::EventSource::createMessageEvent): Removed now-unneeded
+        "false, false" from MessageEvent::create function call.
+
+        * page/csp/ContentSecurityPolicy.h: Removed unneeded include.
+
+        * page/csp/ContentSecurityPolicyDirectiveList.h: Removed unneeded
+        include and also unneeded non-copyable, since the class has a reference as
+        a data member and so is automatically non-copyable.
+
+        * testing/Internals.cpp:
+        (WebCore::Internals::description): Changed to take JSValue.
+        (WebCore::Internals::parserMetaData): Ditto.
+        (WebCore::Internals::serializeObject): Removed unnecessary copying of vector.
+        (WebCore::Internals::isFromCurrentWorld): Changed to take JSValue.
+        (WebCore::Internals::isReadableStreamDisturbed): Changed to not rely on the
+        ScriptState typedef and call it JSC::ExecState.
+
+        * testing/Internals.h: Removed unneeded includes. Removed unneeded and
+        inappropriate use of ASSERT_NO_EXCEPTION.
+
 2016-04-17  Youenn Fablet  <youenn.fablet@crf.canon.fr>
 
         [Fetch API] Consume HTTP data as a ReadableStream
index 1957713..750c5ec 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef MediaControlsHost_h
-#define MediaControlsHost_h
+#pragma once
 
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
 
-#include "ScriptState.h"
 #include <bindings/ScriptObject.h>
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
@@ -90,5 +88,3 @@ private:
 }
 
 #endif
-
-#endif
index de78434..85d2bf2 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef PluginReplacement_h
-#define PluginReplacement_h
+#pragma once
 
 #include "RenderPtr.h"
-#include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
 
 namespace JSC {
@@ -47,17 +45,14 @@ class PluginReplacement : public RefCounted<PluginReplacement> {
 public:
     virtual ~PluginReplacement() { }
 
-    virtual bool installReplacement(ShadowRoot*) = 0;
-    virtual JSC::JSObject* scriptObject() { return 0; }
+    virtual bool installReplacement(ShadowRoot&) = 0;
+    virtual JSC::JSObject* scriptObject() { return nullptr; }
 
     virtual bool willCreateRenderer() { return false; }
     virtual RenderPtr<RenderElement> createElementRenderer(HTMLPlugInElement&, Ref<RenderStyle>&&, const RenderTreePosition&) = 0;
-
-protected:
-    PluginReplacement() { }
 };
 
-typedef PassRefPtr<PluginReplacement> (*CreatePluginReplacement)(HTMLPlugInElement&, const Vector<String>& paramNames, const Vector<String>& paramValues);
+typedef Ref<PluginReplacement> (*CreatePluginReplacement)(HTMLPlugInElement&, const Vector<String>& paramNames, const Vector<String>& paramValues);
 typedef bool (*PluginReplacementSupportsType)(const String&);
 typedef bool (*PluginReplacementSupportsFileExtension)(const String&);
 typedef bool (*PluginReplacementSupportsURL)(const URL&);
@@ -80,7 +75,7 @@ public:
     {
     }
 
-    PassRefPtr<PluginReplacement> create(HTMLPlugInElement& element, const Vector<String>& paramNames, const Vector<String>& paramValues) const { return m_constructor(element, paramNames, paramValues); }
+    Ref<PluginReplacement> create(HTMLPlugInElement& element, const Vector<String>& paramNames, const Vector<String>& paramValues) const { return m_constructor(element, paramNames, paramValues); }
     bool supportsType(const String& mimeType) const { return m_supportsType(mimeType); }
     bool supportsFileExtension(const String& extension) const { return m_supportsFileExtension(extension); }
     bool supportsURL(const URL& url) const { return m_supportsURL(url); }
@@ -95,5 +90,3 @@ private:
 typedef void (*PluginReplacementRegistrar)(const ReplacementPlugin&);
 
 }
-
-#endif
index 82271e1..9dc3150 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef QuickTimePluginReplacement_h
-#define QuickTimePluginReplacement_h
+#pragma once
 
 #include "PluginReplacement.h"
-#include "ScriptState.h"
-#include <bindings/ScriptObject.h>
-#include <wtf/RefCounted.h>
-#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
-class HTMLPlugInElement;
+class DOMWrapperWorld;
 class HTMLVideoElement;
-class RenderElement;
-class RenderStyle;
-class ShadowRoot;
 
-class QuickTimePluginReplacement : public PluginReplacement {
+class QuickTimePluginReplacement final : public PluginReplacement {
 public:
     static void registerPluginReplacement(PluginReplacementRegistrar);
-    static bool supportsMimeType(const String&);
-    static bool supportsFileExtension(const String&);
-    static bool supportsURL(const URL&) { return true; }
-    
-    static PassRefPtr<PluginReplacement> create(HTMLPlugInElement&, const Vector<String>& paramNames, const Vector<String>& paramValues);
-    ~QuickTimePluginReplacement();
-
-    bool installReplacement(ShadowRoot*) override;
-    JSC::JSObject* scriptObject() override { return m_scriptObject; }
 
-    bool willCreateRenderer() override { return m_mediaElement; }
-    RenderPtr<RenderElement> createElementRenderer(HTMLPlugInElement&, Ref<RenderStyle>&&, const RenderTreePosition&) override;
-
-    HTMLVideoElement* parentElement() { return m_mediaElement.get(); }
+    virtual ~QuickTimePluginReplacement();
 
     unsigned long long movieSize() const;
     void postEvent(const String&);
 
+    HTMLVideoElement* parentElement() { return m_mediaElement.get(); }
+
 private:
     QuickTimePluginReplacement(HTMLPlugInElement&, const Vector<String>& paramNames, const Vector<String>& paramValues);
+    static Ref<PluginReplacement> create(HTMLPlugInElement&, const Vector<String>& paramNames, const Vector<String>& paramValues);
+    static bool supportsMimeType(const String&);
+    static bool supportsFileExtension(const String&);
+    static bool supportsURL(const URL&) { return true; }
+
+    bool installReplacement(ShadowRoot&) final;
+    JSC::JSObject* scriptObject() final { return m_scriptObject; }
+
+    bool willCreateRenderer() final { return m_mediaElement; }
+    RenderPtr<RenderElement> createElementRenderer(HTMLPlugInElement&, Ref<RenderStyle>&&, const RenderTreePosition&) final;
 
     bool ensureReplacementScriptInjected();
     DOMWrapperWorld& isolatedWorld();
@@ -71,9 +63,7 @@ private:
     RefPtr<HTMLVideoElement> m_mediaElement;
     const Vector<String> m_names;
     const Vector<String> m_values;
-    JSC::JSObject* m_scriptObject;
+    JSC::JSObject* m_scriptObject; // FIXME: Why is it safe to have this pointer here? What keeps it alive during GC?
 };
 
 }
-
-#endif
index e7dcf89..5165231 100644 (file)
@@ -75,9 +75,9 @@ void QuickTimePluginReplacement::registerPluginReplacement(PluginReplacementRegi
     registrar(ReplacementPlugin(create, supportsMimeType, supportsFileExtension, supportsURL));
 }
 
-PassRefPtr<PluginReplacement> QuickTimePluginReplacement::create(HTMLPlugInElement& plugin, const Vector<String>& paramNames, const Vector<String>& paramValues)
+Ref<PluginReplacement> QuickTimePluginReplacement::create(HTMLPlugInElement& plugin, const Vector<String>& paramNames, const Vector<String>& paramValues)
 {
-    return adoptRef(new QuickTimePluginReplacement(plugin, paramNames, paramValues));
+    return adoptRef(*new QuickTimePluginReplacement(plugin, paramNames, paramValues));
 }
 
 bool QuickTimePluginReplacement::supportsMimeType(const String& mimeType)
@@ -171,7 +171,7 @@ bool QuickTimePluginReplacement::ensureReplacementScriptInjected()
     return true;
 }
 
-bool QuickTimePluginReplacement::installReplacement(ShadowRoot* root)
+bool QuickTimePluginReplacement::installReplacement(ShadowRoot& root)
 {
     if (!ensureReplacementScriptInjected())
         return false;
@@ -197,7 +197,7 @@ bool QuickTimePluginReplacement::installReplacement(ShadowRoot* root)
         return false;
 
     JSC::MarkedArgumentBuffer argList;
-    argList.append(toJS(exec, globalObject, root));
+    argList.append(toJS(exec, globalObject, &root));
     argList.append(toJS(exec, globalObject, m_parentElement));
     argList.append(toJS(exec, globalObject, this));
     argList.append(toJS<String>(exec, globalObject, m_names));
index cae2111..f20e415 100644 (file)
@@ -43,9 +43,9 @@ void YouTubePluginReplacement::registerPluginReplacement(PluginReplacementRegist
     registrar(ReplacementPlugin(create, supportsMimeType, supportsFileExtension, supportsURL));
 }
 
-PassRefPtr<PluginReplacement> YouTubePluginReplacement::create(HTMLPlugInElement& plugin, const Vector<String>& paramNames, const Vector<String>& paramValues)
+Ref<PluginReplacement> YouTubePluginReplacement::create(HTMLPlugInElement& plugin, const Vector<String>& paramNames, const Vector<String>& paramValues)
 {
-    return adoptRef(new YouTubePluginReplacement(plugin, paramNames, paramValues));
+    return adoptRef(*new YouTubePluginReplacement(plugin, paramNames, paramValues));
 }
 
 bool YouTubePluginReplacement::supportsMimeType(const String& mimeType)
@@ -77,11 +77,11 @@ RenderPtr<RenderElement> YouTubePluginReplacement::createElementRenderer(HTMLPlu
     return m_embedShadowElement->createElementRenderer(WTFMove(style), insertionPosition);
 }
 
-bool YouTubePluginReplacement::installReplacement(ShadowRoot* root)
+bool YouTubePluginReplacement::installReplacement(ShadowRoot& root)
 {
     m_embedShadowElement = YouTubeEmbedShadowElement::create(m_parentElement->document());
 
-    root->appendChild(*m_embedShadowElement);
+    root.appendChild(*m_embedShadowElement);
 
     Ref<HTMLIFrameElement> iframeElement = HTMLIFrameElement::create(HTMLNames::iframeTag, m_parentElement->document());
     if (m_attributes.contains("width"))
index c68e049..8b4c023 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef YouTubePluginReplacement_h
-#define YouTubePluginReplacement_h
+#pragma once
 
 #include "PluginReplacement.h"
-
 #include <wtf/HashMap.h>
-#include <wtf/RetainPtr.h>
 
 namespace WebCore {
 
-class HTMLPlugInElement;
-class HTMLIFrameElement;
-class RenderElement;
-class RenderStyle;
-class ShadowRoot;
 class YouTubeEmbedShadowElement;
 
-class YouTubePluginReplacement : public PluginReplacement {
+class YouTubePluginReplacement final : public PluginReplacement {
 public:
     static void registerPluginReplacement(PluginReplacementRegistrar);
 
@@ -48,25 +40,21 @@ public:
 
 private:
     YouTubePluginReplacement(HTMLPlugInElement&, const Vector<String>& paramNames, const Vector<String>& paramValues);
-
+    static Ref<PluginReplacement> create(HTMLPlugInElement&, const Vector<String>& paramNames, const Vector<String>& paramValues);
     static bool supportsMimeType(const String&);
     static bool supportsFileExtension(const String&);
     static bool supportsURL(const URL&);
-    
-    static PassRefPtr<PluginReplacement> create(HTMLPlugInElement&, const Vector<String>& paramNames, const Vector<String>& paramValues);
 
-    bool installReplacement(ShadowRoot*) override;
-    
+    bool installReplacement(ShadowRoot&) final;
+
     String youTubeURL(const String& rawURL);
-    
-    bool willCreateRenderer() override { return m_embedShadowElement; }
-    RenderPtr<RenderElement> createElementRenderer(HTMLPlugInElement&, Ref<RenderStyle>&&, const RenderTreePosition&) override;
-    
+
+    bool willCreateRenderer() final { return m_embedShadowElement; }
+    RenderPtr<RenderElement> createElementRenderer(HTMLPlugInElement&, Ref<RenderStyle>&&, const RenderTreePosition&) final;
+
     HTMLPlugInElement* m_parentElement;
     RefPtr<YouTubeEmbedShadowElement> m_embedShadowElement;
     KeyValueMap m_attributes;
 };
 
 }
-
-#endif
index cfbe679..38216a6 100644 (file)
@@ -565,13 +565,10 @@ void WebSocket::didReceiveBinaryData(Vector<uint8_t>&& binaryData)
 {
     LOG(Network, "WebSocket %p didReceiveBinaryData() %lu byte binary message", this, static_cast<unsigned long>(binaryData.size()));
     switch (m_binaryType) {
-    case BinaryTypeBlob: {
+    case BinaryTypeBlob:
         // FIXME: We just received the data from NetworkProcess, and are sending it back. This is inefficient.
-        RefPtr<Blob> blob = Blob::create(WTFMove(binaryData), emptyString());
-        dispatchEvent(MessageEvent::create(blob.release(), SecurityOrigin::create(m_url)->toString()));
+        dispatchEvent(MessageEvent::create(Blob::create(WTFMove(binaryData), emptyString()), SecurityOrigin::create(m_url)->toString()));
         break;
-    }
-
     case BinaryTypeArrayBuffer:
         dispatchEvent(MessageEvent::create(ArrayBuffer::create(binaryData.data(), binaryData.size()), SecurityOrigin::create(m_url)->toString()));
         break;
index 2a4714c..48fb1da 100644 (file)
@@ -25,8 +25,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef DOMRequestState_h
-#define DOMRequestState_h
+#pragma once
 
 #include "DOMWrapperWorld.h"
 #include "Document.h"
@@ -41,7 +40,6 @@ class DOMRequestState {
 public:
     explicit DOMRequestState(ScriptExecutionContext* scriptExecutionContext)
         : m_scriptExecutionContext(scriptExecutionContext)
-        , m_exec(nullptr)
     {
         if (is<Document>(*m_scriptExecutionContext)) {
             Document& document = downcast<Document>(*m_scriptExecutionContext);
@@ -79,4 +77,3 @@ private:
 };
 
 }
-#endif
index d3172af..0f44314 100644 (file)
@@ -24,8 +24,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef Dictionary_h
-#define Dictionary_h
+#pragma once
 
 #include "JSDictionary.h"
 #include "JSEventListener.h"
@@ -47,18 +46,13 @@ public:
     Dictionary(JSC::ExecState*, JSC::JSValue);
 
     // Returns true if a value was found for the provided property.
-    template <typename Result>
-    bool get(const char* propertyName, Result&) const;
-    template <typename Result>
-    bool get(const String& propertyName, Result&) const;
+    template<typename Result> bool get(const char* propertyName, Result&) const;
+    template<typename Result> bool get(const String& propertyName, Result&) const;
 
-    template <typename Result>
-    Optional<Result> get(const char* propertyName) const;
+    template<typename Result> Optional<Result> get(const char* propertyName) const;
 
-    template <typename T>
-    RefPtr<EventListener> getEventListener(const char* propertyName, T* target) const;
-    template <typename T>
-    RefPtr<EventListener> getEventListener(const String& propertyName, T* target) const;
+    template<typename T> RefPtr<EventListener> getEventListener(const char* propertyName, T* target) const;
+    template<typename T> RefPtr<EventListener> getEventListener(const String& propertyName, T* target) const;
 
     bool isObject() const { return m_dictionary.isValid(); }
     bool isUndefinedOrNull() const { return !m_dictionary.isValid(); }
@@ -69,61 +63,40 @@ public:
     JSC::ExecState* execState() const { return m_dictionary.execState(); }
 
 private:
-    template <typename T>
-    JSC::JSObject* asJSObject(T*) const;
+    template<typename T> JSC::JSObject* asJSObject(T*) const;
     
     JSDictionary m_dictionary;
 };
 
-template <typename Result>
-bool Dictionary::get(const char* propertyName, Result& result) const
+template<typename Result> bool Dictionary::get(const char* propertyName, Result& result) const
 {
-    if (!m_dictionary.isValid())
-        return false;
-    
-    return m_dictionary.get(propertyName, result);
+    return m_dictionary.isValid() && m_dictionary.get(propertyName, result);
 }
 
-template <typename Result>
-bool Dictionary::get(const String& propertyName, Result& result) const
+template<typename Result> bool Dictionary::get(const String& propertyName, Result& result) const
 {
     return get(propertyName.utf8().data(), result);
 }
 
-template<typename Result>
-Optional<Result> Dictionary::get(const char* propertyName) const
+template<typename Result> Optional<Result> Dictionary::get(const char* propertyName) const
 {
     Result result;
-
     if (!get(propertyName, result))
         return Nullopt;
-
     return result;
 }
 
-template <typename T>
-RefPtr<EventListener> Dictionary::getEventListener(const char* propertyName, T* target) const
+template<typename T> RefPtr<EventListener> Dictionary::getEventListener(const char* propertyName, T* target) const
 {
-    if (!m_dictionary.isValid())
-        return nullptr;
-
-    Deprecated::ScriptValue eventListener;
-    if (!m_dictionary.tryGetProperty(propertyName, eventListener))
+    JSC::JSValue eventListener;
+    if (!get(propertyName, eventListener) || !eventListener || !eventListener.isObject())
         return nullptr;
-    if (eventListener.hasNoValue())
-        return nullptr;
-    if (!eventListener.isObject())
-        return nullptr;
-
-    return JSEventListener::create(asObject(eventListener.jsValue()), asJSObject(target), true, currentWorld(m_dictionary.execState()));
+    return JSEventListener::create(asObject(eventListener), asJSObject(target), true, currentWorld(execState()));
 }
 
-template <typename T>
-RefPtr<EventListener> Dictionary::getEventListener(const String& propertyName, T* target) const
+template<typename T> RefPtr<EventListener> Dictionary::getEventListener(const String& propertyName, T* target) const
 {
     return getEventListener(propertyName.utf8().data(), target);
 }
 
 }
-
-#endif // Dictionary_h
index 43c25a8..ef839d8 100644 (file)
@@ -122,12 +122,10 @@ JSValue JSCommandLineAPIHost::getEventListeners(ExecState& state)
 
 JSValue JSCommandLineAPIHost::inspect(ExecState& state)
 {
-    if (state.argumentCount() >= 2) {
-        Deprecated::ScriptValue object(state.vm(), state.uncheckedArgument(0));
-        Deprecated::ScriptValue hints(state.vm(), state.uncheckedArgument(1));
-        wrapped().inspectImpl(object.toInspectorValue(&state), hints.toInspectorValue(&state));
-    }
-
+    if (state.argumentCount() < 2)
+        return jsUndefined();
+    wrapped().inspectImpl(Inspector::toInspectorValue(state, state.uncheckedArgument(0)),
+        Inspector::toInspectorValue(state, state.uncheckedArgument(1)));
     return jsUndefined();
 }
 
index 1e5b0ca..4f32a1e 100644 (file)
@@ -57,11 +57,10 @@ JSValue JSMessageEvent::data(ExecState& state) const
     JSValue result;
     switch (event.dataType()) {
     case MessageEvent::DataTypeScriptValue: {
-        Deprecated::ScriptValue scriptValue = event.dataAsScriptValue();
-        if (scriptValue.hasNoValue())
+        JSValue dataValue = event.dataAsScriptValue();
+        if (!dataValue)
             result = jsNull();
         else {
-            JSValue dataValue = scriptValue.jsValue();
             // We need to make sure MessageEvents do not leak objects in their state property across isolated DOM worlds.
             // Ideally, we would check that the worlds have different privileges but that's not possible yet.
             if (dataValue.isObject() && &worldForDOMObject(dataValue.getObject()) != &currentWorld(&state)) {
@@ -120,7 +119,7 @@ static JSC::JSValue handleInitMessageEvent(JSMessageEvent* jsEvent, JSC::ExecSta
         if (state.hadException())
             return jsUndefined();
     }
-    Deprecated::ScriptValue dataArg = Deprecated::ScriptValue(state.vm(), state.argument(3));
+    Deprecated::ScriptValue dataArg(state.vm(), state.argument(3));
     if (state.hadException())
         return jsUndefined();
 
index 3123c94..26fa9e5 100644 (file)
@@ -61,6 +61,7 @@
 #include "ProcessingInstruction.h"
 #include "RegisteredEventListener.h"
 #include "SVGElement.h"
+#include "ScriptState.h"
 #include "ShadowRoot.h"
 #include "StyleSheet.h"
 #include "StyledElement.h"
index 78d2d6e..2b3c09b 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef JSNodeCustom_h
-#define JSNodeCustom_h
+#pragma once
 
 #include "JSDOMBinding.h"
 #include "JSNode.h"
-#include "ScriptState.h"
 #include "ShadowRoot.h"
 
 namespace WebCore {
@@ -91,5 +89,3 @@ ALWAYS_INLINE JSNode* jsNodeCast(JSC::JSValue value)
 }
 
 } // namespace WebCore
-
-#endif // JSDOMNodeCustom_h
index 95a0fb7..71b4fef 100644 (file)
@@ -58,17 +58,15 @@ JSValue JSPopStateEvent::state(ExecState& state) const
 
     PopStateEvent& event = wrapped();
 
-    if (!event.state().hasNoValue()) {
+    if (auto eventState = event.state()) {
         // We need to make sure a PopStateEvent does not leak objects in its state property across isolated DOM worlds.
         // Ideally, we would check that the worlds have different privileges but that's not possible yet.
-        JSValue eventState = event.state().jsValue();
         if (eventState.isObject() && &worldForDOMObject(eventState.getObject()) != &currentWorld(&state)) {
-            if (RefPtr<SerializedScriptValue> serializedValue = event.trySerializeState(&state))
+            if (auto serializedValue = event.trySerializeState(&state))
                 eventState = serializedValue->deserialize(&state, globalObject(), nullptr);
             else
                 eventState = jsNull();
         }
-        
         return cacheState(state, this, eventState);
     }
     
@@ -82,7 +80,7 @@ JSValue JSPopStateEvent::state(ExecState& state) const
     // The current history state object might've changed in the meantime, so we need to take care
     // of using the correct one, and always share the same deserialization with history.state.
 
-    bool isSameState = history->isSameAsCurrentState(event.serializedState().get());
+    bool isSameState = history->isSameAsCurrentState(event.serializedState());
     JSValue result;
 
     if (isSameState) {
index 7e26ac7..74421fd 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef ScriptState_h
-#define ScriptState_h
+#pragma once
 
 namespace JSC {
 class ExecState;
 }
 
 namespace WebCore {
+
 class DOMWindow;
 class DOMWrapperWorld;
 class Frame;
@@ -45,12 +45,6 @@ class Page;
 class ScriptExecutionContext;
 class WorkerGlobalScope;
 
-// The idea is to expose "state-like" methods (hadException, and any other
-// methods where ExecState just dips into vm) of JSC::ExecState as a
-// separate abstraction.
-// For now, the separation is purely by convention.
-typedef JSC::ExecState ScriptState;
-
 DOMWindow* domWindowFromExecState(JSC::ExecState*);
 Frame* frameFromExecState(JSC::ExecState*);
 ScriptExecutionContext* scriptExecutionContextFromExecState(JSC::ExecState*);
@@ -62,5 +56,3 @@ WEBCORE_EXPORT JSC::ExecState* execStateFromPage(DOMWrapperWorld&, Page*);
 JSC::ExecState* execStateFromWorkerGlobalScope(WorkerGlobalScope*);
 
 } // namespace WebCore
-
-#endif // ScriptState_h
index 87002ef..a7e3aeb 100644 (file)
@@ -49,6 +49,7 @@
 #include "JSMessagePort.h"
 #include "JSNavigator.h"
 #include "ScriptExecutionContext.h"
+#include "ScriptState.h"
 #include "SharedBuffer.h"
 #include "WebCoreJSClientData.h"
 #include <limits>
index bcd2d55..731acc2 100644 (file)
  *
  */
 
-#ifndef SerializedScriptValue_h
-#define SerializedScriptValue_h
+#pragma once
 
-#include "ScriptState.h"
 #include <bindings/ScriptValue.h>
 #include <heap/Strong.h>
 #include <runtime/ArrayBuffer.h>
@@ -115,5 +113,3 @@ private:
 };
 
 }
-
-#endif // SerializedScriptValue_h
index a0bd824..6b756b8 100644 (file)
@@ -57,7 +57,7 @@ static inline Optional<String> valueFromDictionary(const Dictionary& dictionary,
     return result.isNull() ? Nullopt : Optional<String>(result);
 }
 
-RefPtr<FontFace> FontFace::create(JSC::ExecState& execState, ScriptExecutionContext& context, const String& family, const Deprecated::ScriptValue& source, const Dictionary& descriptors, ExceptionCode& ec)
+RefPtr<FontFace> FontFace::create(JSC::ExecState& execState, ScriptExecutionContext& context, const String& family, JSC::JSValue source, const Dictionary& descriptors, ExceptionCode& ec)
 {
     if (!context.isDocument()) {
         ec = TypeError;
@@ -66,20 +66,19 @@ RefPtr<FontFace> FontFace::create(JSC::ExecState& execState, ScriptExecutionCont
 
     Ref<FontFace> result = adoptRef(*new FontFace(execState, downcast<Document>(context).fontSelector()));
 
+    ec = 0;
     result->setFamily(family, ec);
     if (ec)
         return nullptr;
 
-    if (source.jsValue().isString()) {
-        String sourceString = source.jsValue().toString(&execState)->value(&execState);
+    if (source.isString()) {
+        String sourceString = source.toString(&execState)->value(&execState);
         auto value = FontFace::parseString(sourceString, CSSPropertySrc);
-        if (is<CSSValueList>(value.get())) {
-            CSSValueList& srcList = downcast<CSSValueList>(*value);
-            CSSFontFace::appendSources(result->backing(), srcList, &downcast<Document>(context), false);
-        } else {
+        if (!is<CSSValueList>(value.get())) {
             ec = SYNTAX_ERR;
             return nullptr;
         }
+        CSSFontFace::appendSources(result->backing(), downcast<CSSValueList>(*value), &downcast<Document>(context), false);
     }
 
     if (auto style = valueFromDictionary(descriptors, "style"))
index d6c19a3..fcfc9b7 100644 (file)
@@ -48,7 +48,7 @@ class Dictionary;
 
 class FontFace final : public RefCounted<FontFace>, public CSSFontFace::Client {
 public:
-    static RefPtr<FontFace> create(JSC::ExecState&, ScriptExecutionContext&, const String& family, const Deprecated::ScriptValue& source, const Dictionary& descriptors, ExceptionCode&);
+    static RefPtr<FontFace> create(JSC::ExecState&, ScriptExecutionContext&, const String& family, JSC::JSValue source, const Dictionary& descriptors, ExceptionCode&);
     static Ref<FontFace> create(JSC::ExecState&, CSSFontFace&);
     virtual ~FontFace();
 
index 6abc86c..3dd6426 100644 (file)
@@ -28,6 +28,8 @@
 #include "config.h"
 #include "MessageEvent.h"
 
+#include "Blob.h"
+#include "DOMWindow.h"
 #include <runtime/JSCInlines.h>
 
 namespace WebCore {
@@ -37,12 +39,12 @@ static inline bool isValidSource(EventTarget* source)
     return !source || source->toDOMWindow() || source->isMessagePort();
 }
 
-MessageEvent::MessageEvent()
+inline MessageEvent::MessageEvent()
     : m_dataType(DataTypeScriptValue)
 {
 }
 
-MessageEvent::MessageEvent(const AtomicString& type, const MessageEventInit& initializer)
+inline MessageEvent::MessageEvent(const AtomicString& type, const MessageEventInit& initializer)
     : Event(type, initializer)
     , m_dataType(DataTypeScriptValue)
     , m_dataAsScriptValue(initializer.data)
@@ -53,40 +55,28 @@ MessageEvent::MessageEvent(const AtomicString& type, const MessageEventInit& ini
 {
 }
 
-MessageEvent::MessageEvent(const Deprecated::ScriptValue& data, const String& origin, const String& lastEventId, PassRefPtr<EventTarget> source, std::unique_ptr<MessagePortArray> ports)
-    : Event(eventNames().messageEvent, false, false)
-    , m_dataType(DataTypeScriptValue)
-    , m_dataAsScriptValue(data)
-    , m_origin(origin)
-    , m_lastEventId(lastEventId)
-    , m_source(source)
-    , m_ports(WTFMove(ports))
-{
-    ASSERT(isValidSource(m_source.get()));
-}
-
-MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<EventTarget> source, std::unique_ptr<MessagePortArray> ports)
+inline MessageEvent::MessageEvent(RefPtr<SerializedScriptValue>&& data, const String& origin, const String& lastEventId, EventTarget* source, std::unique_ptr<MessagePortArray> ports)
     : Event(eventNames().messageEvent, false, false)
     , m_dataType(DataTypeSerializedScriptValue)
-    , m_dataAsSerializedScriptValue(data)
+    , m_dataAsSerializedScriptValue(WTFMove(data))
     , m_origin(origin)
     , m_lastEventId(lastEventId)
     , m_source(source)
     , m_ports(WTFMove(ports))
 {
-    ASSERT(isValidSource(m_source.get()));
+    ASSERT(isValidSource(source));
 }
 
-MessageEvent::MessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId)
-    : Event(type, canBubble, cancelable)
+inline MessageEvent::MessageEvent(const AtomicString& type, RefPtr<SerializedScriptValue>&& data, const String& origin, const String& lastEventId)
+    : Event(type, false, false)
     , m_dataType(DataTypeSerializedScriptValue)
-    , m_dataAsSerializedScriptValue(data)
+    , m_dataAsSerializedScriptValue(WTFMove(data))
     , m_origin(origin)
     , m_lastEventId(lastEventId)
 {
 }
 
-MessageEvent::MessageEvent(const String& data, const String& origin)
+inline MessageEvent::MessageEvent(const String& data, const String& origin)
     : Event(eventNames().messageEvent, false, false)
     , m_dataType(DataTypeString)
     , m_dataAsString(data)
@@ -94,15 +84,15 @@ MessageEvent::MessageEvent(const String& data, const String& origin)
 {
 }
 
-MessageEvent::MessageEvent(PassRefPtr<Blob> data, const String& origin)
+inline MessageEvent::MessageEvent(Ref<Blob>&& data, const String& origin)
     : Event(eventNames().messageEvent, false, false)
     , m_dataType(DataTypeBlob)
-    , m_dataAsBlob(data)
+    , m_dataAsBlob(WTFMove(data))
     , m_origin(origin)
 {
 }
 
-MessageEvent::MessageEvent(Ref<ArrayBuffer>&& data, const String& origin)
+inline MessageEvent::MessageEvent(Ref<ArrayBuffer>&& data, const String& origin)
     : Event(eventNames().messageEvent, false, false)
     , m_dataType(DataTypeArrayBuffer)
     , m_dataAsArrayBuffer(WTFMove(data))
@@ -110,6 +100,41 @@ MessageEvent::MessageEvent(Ref<ArrayBuffer>&& data, const String& origin)
 {
 }
 
+Ref<MessageEvent> MessageEvent::create(std::unique_ptr<MessagePortArray> ports, RefPtr<SerializedScriptValue>&& data, const String& origin, const String& lastEventId, EventTarget* source)
+{
+    return adoptRef(*new MessageEvent(WTFMove(data), origin, lastEventId, source, WTFMove(ports)));
+}
+
+Ref<MessageEvent> MessageEvent::create(const AtomicString& type, RefPtr<SerializedScriptValue>&& data, const String& origin, const String& lastEventId)
+{
+    return adoptRef(*new MessageEvent(type, WTFMove(data), origin, lastEventId));
+}
+
+Ref<MessageEvent> MessageEvent::create(const String& data, const String& origin)
+{
+    return adoptRef(*new MessageEvent(data, origin));
+}
+
+Ref<MessageEvent> MessageEvent::create(Ref<Blob>&& data, const String& origin)
+{
+    return adoptRef(*new MessageEvent(WTFMove(data), origin));
+}
+
+Ref<MessageEvent> MessageEvent::create(Ref<ArrayBuffer>&& data, const String& origin)
+{
+    return adoptRef(*new MessageEvent(WTFMove(data), origin));
+}
+
+Ref<MessageEvent> MessageEvent::createForBindings()
+{
+    return adoptRef(*new MessageEvent);
+}
+
+Ref<MessageEvent> MessageEvent::createForBindings(const AtomicString& type, const MessageEventInit& initializer)
+{
+    return adoptRef(*new MessageEvent(type, initializer));
+}
+
 MessageEvent::~MessageEvent()
 {
 }
index 068cb8e..0cceaf4 100644 (file)
  *
  */
 
-#ifndef MessageEvent_h
-#define MessageEvent_h
+#pragma once
 
-#include "Blob.h"
-#include "DOMWindow.h"
 #include "Event.h"
 #include "MessagePort.h"
 #include "SerializedScriptValue.h"
 #include <bindings/ScriptValue.h>
-#include <memory>
-#include <runtime/ArrayBuffer.h>
 
 namespace WebCore {
 
-class EventTarget;
+class Blob;
 
 struct MessageEventInit : public EventInit {
     Deprecated::ScriptValue data;
@@ -51,38 +46,13 @@ struct MessageEventInit : public EventInit {
 
 class MessageEvent final : public Event {
 public:
-    static Ref<MessageEvent> create(std::unique_ptr<MessagePortArray> ports, const Deprecated::ScriptValue& data = Deprecated::ScriptValue(), const String& origin = String(), const String& lastEventId = String(), PassRefPtr<EventTarget> source = nullptr)
-    {
-        return adoptRef(*new MessageEvent(data, origin, lastEventId, source, WTFMove(ports)));
-    }
-    static Ref<MessageEvent> create(std::unique_ptr<MessagePortArray> ports, PassRefPtr<SerializedScriptValue> data, const String& origin = String(), const String& lastEventId = String(), PassRefPtr<EventTarget> source = nullptr)
-    {
-        return adoptRef(*new MessageEvent(data, origin, lastEventId, source, WTFMove(ports)));
-    }
-    static Ref<MessageEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId)
-    {
-        return adoptRef(*new MessageEvent(type, canBubble, cancelable, data, origin, lastEventId));
-    }
-    static Ref<MessageEvent> create(const String& data, const String& origin = String())
-    {
-        return adoptRef(*new MessageEvent(data, origin));
-    }
-    static Ref<MessageEvent> create(PassRefPtr<Blob> data, const String& origin = String())
-    {
-        return adoptRef(*new MessageEvent(data, origin));
-    }
-    static Ref<MessageEvent> create(Ref<ArrayBuffer>&& data, const String& origin = String())
-    {
-        return adoptRef(*new MessageEvent(WTFMove(data), origin));
-    }
-    static Ref<MessageEvent> createForBindings()
-    {
-        return adoptRef(*new MessageEvent);
-    }
-    static Ref<MessageEvent> createForBindings(const AtomicString& type, const MessageEventInit& initializer)
-    {
-        return adoptRef(*new MessageEvent(type, initializer));
-    }
+    static Ref<MessageEvent> create(std::unique_ptr<MessagePortArray>, RefPtr<SerializedScriptValue>&&, const String& origin = { }, const String& lastEventId = { }, EventTarget* source = nullptr);
+    static Ref<MessageEvent> create(const AtomicString& type, RefPtr<SerializedScriptValue>&&, const String& origin, const String& lastEventId);
+    static Ref<MessageEvent> create(const String& data, const String& origin = { });
+    static Ref<MessageEvent> create(Ref<Blob>&& data, const String& origin);
+    static Ref<MessageEvent> create(Ref<ArrayBuffer>&& data, const String& origin = { });
+    static Ref<MessageEvent> createForBindings();
+    static Ref<MessageEvent> createForBindings(const AtomicString& type, const MessageEventInit&);
     virtual ~MessageEvent();
 
     void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const Deprecated::ScriptValue& data, const String& origin, const String& lastEventId, DOMWindow* source, std::unique_ptr<MessagePortArray>);
@@ -110,7 +80,7 @@ public:
         DataTypeArrayBuffer
     };
     DataType dataType() const { return m_dataType; }
-    const Deprecated::ScriptValue& dataAsScriptValue() const { ASSERT(m_dataType == DataTypeScriptValue); return m_dataAsScriptValue; }
+    JSC::JSValue dataAsScriptValue() const { ASSERT(m_dataType == DataTypeScriptValue); return m_dataAsScriptValue; }
     PassRefPtr<SerializedScriptValue> dataAsSerializedScriptValue() const { ASSERT(m_dataType == DataTypeSerializedScriptValue); return m_dataAsSerializedScriptValue; }
     String dataAsString() const { ASSERT(m_dataType == DataTypeString); return m_dataAsString; }
     Blob* dataAsBlob() const { ASSERT(m_dataType == DataTypeBlob); return m_dataAsBlob.get(); }
@@ -121,13 +91,11 @@ public:
 private:
     MessageEvent();
     MessageEvent(const AtomicString&, const MessageEventInit&);
-    MessageEvent(const Deprecated::ScriptValue& data, const String& origin, const String& lastEventId, PassRefPtr<EventTarget> source, std::unique_ptr<MessagePortArray>);
-    MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<EventTarget> source, std::unique_ptr<MessagePortArray>);
-    MessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId);
-
-    explicit MessageEvent(const String& data, const String& origin);
-    explicit MessageEvent(PassRefPtr<Blob> data, const String& origin);
-    explicit MessageEvent(Ref<ArrayBuffer>&& data, const String& origin);
+    MessageEvent(RefPtr<SerializedScriptValue>&& data, const String& origin, const String& lastEventId, EventTarget* source, std::unique_ptr<MessagePortArray>);
+    MessageEvent(const AtomicString& type, RefPtr<SerializedScriptValue>&& data, const String& origin, const String& lastEventId);
+    MessageEvent(const String& data, const String& origin);
+    MessageEvent(Ref<Blob>&& data, const String& origin);
+    MessageEvent(Ref<ArrayBuffer>&& data, const String& origin);
 
     DataType m_dataType;
     Deprecated::ScriptValue m_dataAsScriptValue;
@@ -143,5 +111,3 @@ private:
 };
 
 } // namespace WebCore
-
-#endif // MessageEvent_h
index 2b9ab68..8ccebe3 100644 (file)
  *
  */
 
-#ifndef NodeFilterCondition_h
-#define NodeFilterCondition_h
+#pragma once
 
-#include "ScriptState.h"
 #include <wtf/RefCounted.h>
 
 namespace JSC {
-
 class SlotVisitor;
-
 }
 
 namespace WebCore {
 
-    class Node;
+class Node;
 
-    class NodeFilterCondition : public RefCounted<NodeFilterCondition> {
-    public:
-        virtual ~NodeFilterCondition() { }
-        virtual short acceptNode(Node*) const = 0;
-        virtual void visitAggregate(JSC::SlotVisitor&) { }
-    };
+class NodeFilterCondition : public RefCounted<NodeFilterCondition> {
+public:
+    virtual ~NodeFilterCondition() { }
+    virtual short acceptNode(Node*) const = 0;
+    virtual void visitAggregate(JSC::SlotVisitor&) { }
+};
 
 } // namespace WebCore
-
-#endif // NodeFilterCondition_h
index 452c898..ab44f5a 100644 (file)
  *
  */
 
-#ifndef PopStateEvent_h
-#define PopStateEvent_h
+#pragma once
 
 #include "Event.h"
-#include "SerializedScriptValue.h"
 #include <bindings/ScriptValue.h>
 
 namespace WebCore {
 
+class History;
+class SerializedScriptValue;
+
 struct PopStateEventInit : public EventInit {
     Deprecated::ScriptValue state;
 };
 
-class History;
-class SerializedScriptValue;
-
 class PopStateEvent final : public Event {
 public:
     virtual ~PopStateEvent();
     static Ref<PopStateEvent> create(RefPtr<SerializedScriptValue>&&, PassRefPtr<History>);
     static Ref<PopStateEvent> createForBindings(const AtomicString&, const PopStateEventInit&);
 
-    PassRefPtr<SerializedScriptValue> serializedState() const { ASSERT(m_serializedState); return m_serializedState; }
-    
+    JSC::JSValue state() const { return m_state; }
+    SerializedScriptValue* serializedState() const { return m_serializedState.get(); }
+
     RefPtr<SerializedScriptValue> trySerializeState(JSC::ExecState*);
     
-    const Deprecated::ScriptValue& state() const { return m_state; }
     History* history() const { return m_history.get(); }
 
     EventInterface eventInterface() const override;
@@ -66,5 +64,3 @@ private:
 };
 
 } // namespace WebCore
-
-#endif // PopStateEvent_h
index 3314b39..0fdf858 100644 (file)
@@ -30,7 +30,7 @@
 
 namespace WebCore {
 
-NodeIteratorBase::NodeIteratorBase(Node& rootNode, unsigned long whatToShow, RefPtr<NodeFilter>&& nodeFilter)
+NodeIteratorBase::NodeIteratorBase(Node& rootNode, unsigned whatToShow, RefPtr<NodeFilter>&& nodeFilter)
     : m_root(&rootNode)
     , m_whatToShow(whatToShow)
     , m_filter(WTFMove(nodeFilter))
index 1c11607..b8b9ec4 100644 (file)
  *
  */
 
-#ifndef Traversal_h
-#define Traversal_h
+#pragma once
 
-#include "ScriptState.h"
 #include <wtf/RefPtr.h>
 
 namespace WebCore {
 
-    class Node;
-    class NodeFilter;
+class Node;
+class NodeFilter;
 
-    class NodeIteratorBase {
-    public:
-        Node* root() const { return m_root.get(); }
-        unsigned long whatToShow() const { return m_whatToShow; }
-        NodeFilter* filter() const { return m_filter.get(); }
-        bool expandEntityReferences() const { return false; }
+class NodeIteratorBase {
+public:
+    Node* root() const { return m_root.get(); }
+    unsigned whatToShow() const { return m_whatToShow; }
+    NodeFilter* filter() const { return m_filter.get(); }
+    bool expandEntityReferences() const { return false; }
 
-    protected:
-        NodeIteratorBase(Node&, unsigned long whatToShow, RefPtr<NodeFilter>&&);
-        short acceptNode(Node*) const;
+protected:
+    NodeIteratorBase(Node&, unsigned whatToShow, RefPtr<NodeFilter>&&);
+    short acceptNode(Node*) const;
 
-    private:
-        RefPtr<Node> m_root;
-        unsigned long m_whatToShow;
-        RefPtr<NodeFilter> m_filter;
-    };
+private:
+    RefPtr<Node> m_root;
+    unsigned m_whatToShow;
+    RefPtr<NodeFilter> m_filter;
+};
 
 } // namespace WebCore
-
-#endif // Traversal_h
index 67eac2a..951e6ad 100644 (file)
@@ -327,7 +327,7 @@ void HTMLPlugInElement::didAddUserAgentShadowRoot(ShadowRoot* root)
         return;
     
     root->setResetStyleInheritance(true);
-    if (m_pluginReplacement->installReplacement(root)) {
+    if (m_pluginReplacement->installReplacement(*root)) {
         setDisplayState(DisplayingPluginReplacement);
         setNeedsStyleRecalc(ReconstructRenderTree);
     }
index 4d02b25..306d3d3 100644 (file)
@@ -1496,7 +1496,7 @@ Ref<Inspector::Protocol::DOM::EventListener> InspectorDOMAgent::buildObjectForEv
     if (objectGroupId && handler && state) {
         InjectedScript injectedScript = m_injectedScriptManager.injectedScriptFor(state);
         if (!injectedScript.hasNoValue())
-            value->setHandler(injectedScript.wrapObject(Deprecated::ScriptValue(state->vm(), handler), *objectGroupId));
+            value->setHandler(injectedScript.wrapObject(handler, *objectGroupId));
     }
     if (!scriptID.isNull()) {
         auto location = Inspector::Protocol::Debugger::Location::create()
index dcfe1d1..e164584 100644 (file)
@@ -68,7 +68,7 @@ public:
     
     void disconnect()
     {
-        m_frontendApiObject = Deprecated::ScriptObject();
+        m_frontendApiObject = { };
         m_frontendHost = nullptr;
     }
     
index 3d2dbe0..759ae42 100644 (file)
@@ -58,6 +58,7 @@
 #include "IDBTransaction.h"
 #include "InspectorPageAgent.h"
 #include "InstrumentingAgents.h"
+#include "ScriptState.h"
 #include "SecurityOrigin.h"
 #include <inspector/InjectedScript.h>
 #include <inspector/InjectedScriptManager.h>
index dbafcdb..7f19a3a 100644 (file)
@@ -29,8 +29,7 @@
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-#ifndef InspectorInstrumentation_h
-#define InspectorInstrumentation_h
+#pragma once
 
 #include "CSSSelector.h"
 #include "Element.h"
@@ -41,7 +40,6 @@
 #include "MemoryPressureHandler.h"
 #include "Page.h"
 #include "ScriptExecutionContext.h"
-#include "ScriptState.h"
 #include "StorageArea.h"
 #include "WebSocketFrame.h"
 #include <runtime/ConsoleTypes.h>
@@ -255,11 +253,6 @@ public:
     static void didReceiveWebSocketFrameError(Document*, unsigned long identifier, const String& errorMessage);
 #endif
 
-    static Deprecated::ScriptObject wrapCanvas2DRenderingContextForInstrumentation(Document*, const Deprecated::ScriptObject&);
-#if ENABLE(WEBGL)
-    static Deprecated::ScriptObject wrapWebGLRenderingContextForInstrumentation(Document*, const Deprecated::ScriptObject&);
-#endif
-
 #if ENABLE(RESOURCE_USAGE)
     static void didHandleMemoryPressure(Page&, Critical);
 #endif
@@ -1292,5 +1285,3 @@ inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForDocu
 }
 
 } // namespace WebCore
-
-#endif // !defined(InspectorInstrumentation_h)
index 08ea38d..c9bccf0 100644 (file)
@@ -144,21 +144,20 @@ namespace WebCore {
 
 class PostMessageTimer : public TimerBase {
 public:
-    PostMessageTimer(DOMWindow* window, PassRefPtr<SerializedScriptValue> message, const String& sourceOrigin, PassRefPtr<DOMWindow> source, std::unique_ptr<MessagePortChannelArray> channels, SecurityOrigin* targetOrigin, PassRefPtr<ScriptCallStack> stackTrace)
+    PostMessageTimer(DOMWindow& window, PassRefPtr<SerializedScriptValue> message, const String& sourceOrigin, DOMWindow& source, std::unique_ptr<MessagePortChannelArray> channels, RefPtr<SecurityOrigin>&& targetOrigin, RefPtr<ScriptCallStack>&& stackTrace)
         : m_window(window)
         , m_message(message)
         , m_origin(sourceOrigin)
         , m_source(source)
         , m_channels(WTFMove(channels))
-        , m_targetOrigin(targetOrigin)
+        , m_targetOrigin(WTFMove(targetOrigin))
         , m_stackTrace(stackTrace)
     {
     }
 
-    Ref<MessageEvent> event(ScriptExecutionContext* context)
+    Ref<MessageEvent> event(ScriptExecutionContext& context)
     {
-        std::unique_ptr<MessagePortArray> messagePorts = MessagePort::entanglePorts(*context, WTFMove(m_channels));
-        return MessageEvent::create(WTFMove(messagePorts), m_message, m_origin, String(), m_source);
+        return MessageEvent::create(MessagePort::entanglePorts(context, WTFMove(m_channels)), WTFMove(m_message), m_origin, { }, m_source.ptr());
     }
     SecurityOrigin* targetOrigin() const { return m_targetOrigin.get(); }
     ScriptCallStack* stackTrace() const { return m_stackTrace.get(); }
@@ -171,10 +170,10 @@ private:
         m_window->postMessageTimerFired(*timer);
     }
 
-    RefPtr<DOMWindow> m_window;
+    Ref<DOMWindow> m_window;
     RefPtr<SerializedScriptValue> m_message;
     String m_origin;
-    RefPtr<DOMWindow> m_source;
+    Ref<DOMWindow> m_source;
     std::unique_ptr<MessagePortChannelArray> m_channels;
     RefPtr<SecurityOrigin> m_targetOrigin;
     RefPtr<ScriptCallStack> m_stackTrace;
@@ -899,7 +898,7 @@ void DOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message, const Mes
         }
     }
 
-    std::unique_ptr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(ports, ec);
+    auto channels = MessagePort::disentanglePorts(ports, ec);
     if (ec)
         return;
 
@@ -915,7 +914,7 @@ void DOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message, const Mes
         stackTrace = createScriptCallStack(JSMainThreadExecState::currentState(), ScriptCallStack::maxCallStackSizeToCapture);
 
     // Schedule the message.
-    PostMessageTimer* timer = new PostMessageTimer(this, message, sourceOrigin, &source, WTFMove(channels), target.get(), stackTrace.release());
+    PostMessageTimer* timer = new PostMessageTimer(*this, message, sourceOrigin, source, WTFMove(channels), WTFMove(target), WTFMove(stackTrace));
     timer->startOneShot(0);
 }
 
@@ -924,7 +923,7 @@ void DOMWindow::postMessageTimerFired(PostMessageTimer& timer)
     if (!document() || !isCurrentlyDisplayedInFrame())
         return;
 
-    dispatchMessageEventWithOriginCheck(timer.targetOrigin(), timer.event(document()), timer.stackTrace());
+    dispatchMessageEventWithOriginCheck(timer.targetOrigin(), timer.event(*document()), timer.stackTrace());
 }
 
 void DOMWindow::dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetOrigin, Event& event, PassRefPtr<ScriptCallStack> stackTrace)
index 0f2ce3d..1dc43ca 100644 (file)
@@ -413,7 +413,7 @@ bool EventSource::canSuspendForDocumentSuspension() const
 
 Ref<MessageEvent> EventSource::createMessageEvent()
 {
-    return MessageEvent::create(m_eventName.isEmpty() ? eventNames().messageEvent : AtomicString(m_eventName), false, false, SerializedScriptValue::create(String::adopt(m_data)), m_eventStreamOrigin, m_lastEventId);
+    return MessageEvent::create(m_eventName.isEmpty() ? eventNames().messageEvent : AtomicString(m_eventName), SerializedScriptValue::create(String::adopt(m_data)), m_eventStreamOrigin, m_lastEventId);
 }
 
 } // namespace WebCore
index b8a7039..38726f5 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef ContentSecurityPolicy_h
-#define ContentSecurityPolicy_h
+#pragma once
 
 #include "ContentSecurityPolicyResponseHeaders.h"
-#include "ScriptState.h"
 #include <wtf/OptionSet.h>
 #include <wtf/Vector.h>
 #include <wtf/text/TextPosition.h>
 
+namespace JSC {
+class ExecState;
+}
+
 namespace WTF {
 class OrdinalNumber;
 }
@@ -43,6 +45,7 @@ class ContentSecurityPolicyDirective;
 class ContentSecurityPolicyDirectiveList;
 class ContentSecurityPolicySource;
 class DOMStringList;
+class Frame;
 class JSDOMWindowShell;
 class ScriptExecutionContext;
 class SecurityOrigin;
@@ -184,5 +187,3 @@ inline const ContentSecurityPolicyDirective* ContentSecurityPolicy::violatedDire
 }
 
 }
-
-#endif
index a41e759..64ee95d 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef ContentSecurityPolicyDirectiveList_h
-#define ContentSecurityPolicyDirectiveList_h
+#pragma once
 
 #include "ContentSecurityPolicy.h"
 #include "ContentSecurityPolicyHash.h"
 #include "ContentSecurityPolicyMediaListDirective.h"
 #include "ContentSecurityPolicySourceListDirective.h"
 #include "URL.h"
-#include <wtf/Noncopyable.h>
 
 namespace WebCore {
 
+class Frame;
+
 class ContentSecurityPolicyDirectiveList {
     WTF_MAKE_FAST_ALLOCATED;
-    WTF_MAKE_NONCOPYABLE(ContentSecurityPolicyDirectiveList)
 public:
     static std::unique_ptr<ContentSecurityPolicyDirectiveList> create(ContentSecurityPolicy&, const String&, ContentSecurityPolicyHeaderType, ContentSecurityPolicy::PolicyFrom);
     ContentSecurityPolicyDirectiveList(ContentSecurityPolicy&, ContentSecurityPolicyHeaderType);
@@ -125,5 +124,3 @@ private:
 };
 
 } // namespace WebCore
-
-#endif /* ContentSecurityPolicyDirectiveList_h */
index 21d0f2d..0390806 100644 (file)
@@ -505,9 +505,9 @@ String Internals::styleChangeType(Node& node)
     return styleChangeTypeToString(node.styleChangeType());
 }
 
-String Internals::description(Deprecated::ScriptValue value)
+String Internals::description(JSC::JSValue value)
 {
-    return toString(value.jsValue());
+    return toString(value);
 }
 
 bool Internals::isPreloaded(const String& url)
@@ -1491,11 +1491,10 @@ private:
     mutable CodeBlock* m_codeBlock;
 };
 
-String Internals::parserMetaData(Deprecated::ScriptValue value)
+String Internals::parserMetaData(JSC::JSValue code)
 {
     JSC::VM& vm = contextDocument()->vm();
     JSC::ExecState* exec = vm.topCallFrame;
-    JSC::JSValue code = value.jsValue();
     ScriptExecutable* executable;
 
     if (!code || code.isNull() || code.isUndefined()) {
@@ -2525,7 +2524,7 @@ String Internals::getCurrentCursorInfo(ExceptionCode& ec)
 
 RefPtr<ArrayBuffer> Internals::serializeObject(PassRefPtr<SerializedScriptValue> value) const
 {
-    Vector<uint8_t> bytes = value->data();
+    auto& bytes = value->data();
     return ArrayBuffer::create(bytes.data(), bytes.size());
 }
 
@@ -2536,14 +2535,11 @@ RefPtr<SerializedScriptValue> Internals::deserializeBuffer(ArrayBuffer& buffer)
     return SerializedScriptValue::adopt(WTFMove(bytes));
 }
 
-bool Internals::isFromCurrentWorld(Deprecated::ScriptValue value) const
+bool Internals::isFromCurrentWorld(JSC::JSValue value) const
 {
-    ASSERT(!value.hasNoValue());
-    
-    JSC::ExecState* exec = contextDocument()->vm().topCallFrame;
-    if (!value.isObject() || &worldForDOMObject(value.jsValue().getObject()) == &currentWorld(exec))
-        return true;
-    return false;
+    ASSERT(value);
+    JSC::ExecState& state = *contextDocument()->vm().topCallFrame;
+    return !value.isObject() || &worldForDOMObject(asObject(value)) == &currentWorld(&state);
 }
 
 void Internals::setUsesOverlayScrollbars(bool enabled)
@@ -3281,7 +3277,7 @@ void Internals::setShowAllPlugins(bool show)
 
 #if ENABLE(STREAMS_API)
 
-bool Internals::isReadableStreamDisturbed(ScriptState& state, JSValue stream)
+bool Internals::isReadableStreamDisturbed(JSC::ExecState& state, JSValue stream)
 {
     JSGlobalObject* globalObject = state.vmEntryGlobalObject();
     JSVMClientData* clientData = static_cast<JSVMClientData*>(state.vm().clientData);
index 523870b..bdd3401 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef Internals_h
-#define Internals_h
+#pragma once
 
 #include "CSSComputedStyleDeclaration.h"
 #include "ContextDestructionObserver.h"
-#include "ExceptionCodePlaceholder.h"
-#include "NodeList.h"
 #include "PageConsoleClient.h"
-#include "ScriptState.h"
-#include <bindings/ScriptValue.h>
-#include <runtime/ArrayBuffer.h>
 #include <runtime/Float32Array.h>
-#include <wtf/RefCounted.h>
-#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
@@ -65,6 +57,7 @@ class MemoryInfo;
 class MockContentFilterSettings;
 class MockPageOverlay;
 class Node;
+class NodeList;
 class Page;
 class Range;
 class RenderedDocumentMarker;
@@ -77,7 +70,7 @@ class XMLHttpRequest;
 
 typedef int ExceptionCode;
 
-class Internals : public RefCounted<Internals>, public ContextDestructionObserver {
+class Internals final : public RefCounted<Internals>, private ContextDestructionObserver {
 public:
     static Ref<Internals> create(Document&);
     virtual ~Internals();
@@ -90,7 +83,7 @@ public:
     String address(Node&);
     bool nodeNeedsStyleRecalc(Node&);
     String styleChangeType(Node&);
-    String description(Deprecated::ScriptValue);
+    String description(JSC::JSValue);
 
     bool isPreloaded(const String& url);
     bool isLoadingFromMemoryCache(const String& url);
@@ -208,7 +201,7 @@ public:
     RefPtr<NodeList> nodesFromRect(Document&, int x, int y, unsigned topPadding, unsigned rightPadding,
         unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent, ExceptionCode&) const;
 
-    String parserMetaData(Deprecated::ScriptValue = Deprecated::ScriptValue());
+    String parserMetaData(JSC::JSValue = { });
 
     void updateEditorUINowIfScheduled();
 
@@ -291,8 +284,8 @@ public:
     Vector<String> shortcutIconURLs() const;
 
     int numberOfPages(float pageWidthInPixels = 800, float pageHeightInPixels = 600);
-    String pageProperty(String, int, ExceptionCode& = ASSERT_NO_EXCEPTION) const;
-    String pageSizeAndMarginsInPixels(int, int, int, int, int, int, int, ExceptionCode& = ASSERT_NO_EXCEPTION) const;
+    String pageProperty(String, int, ExceptionCode&) const;
+    String pageSizeAndMarginsInPixels(int, int, int, int, int, int, int, ExceptionCode&) const;
 
     void setPageScaleFactor(float scaleFactor, int x, int y, ExceptionCode&);
     void setPageZoomFactor(float zoomFactor, ExceptionCode&);
@@ -344,7 +337,7 @@ public:
     RefPtr<ArrayBuffer> serializeObject(PassRefPtr<SerializedScriptValue>) const;
     RefPtr<SerializedScriptValue> deserializeBuffer(ArrayBuffer&) const;
 
-    bool isFromCurrentWorld(Deprecated::ScriptValue) const;
+    bool isFromCurrentWorld(JSC::JSValue) const;
 
     void setUsesOverlayScrollbars(bool);
     void setUsesMockScrollAnimator(bool);
@@ -472,7 +465,7 @@ public:
     void setResourceLoadStatisticsEnabled(bool);
 
 #if ENABLE(STREAMS_API)
-    bool isReadableStreamDisturbed(ScriptState&, JSC::JSValue);
+    bool isReadableStreamDisturbed(JSC::ExecState&, JSC::JSValue);
 #endif
 
     String composedTreeAsText(Node&);
@@ -490,5 +483,3 @@ private:
 };
 
 } // namespace WebCore
-
-#endif