Changeset 199642 in webkit
- Timestamp:
- Apr 17, 2016, 11:39:13 AM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 44 edited
-
JavaScriptCore/ChangeLog (modified) (1 diff)
-
JavaScriptCore/bindings/ScriptFunctionCall.cpp (modified) (1 diff)
-
JavaScriptCore/bindings/ScriptFunctionCall.h (modified) (1 diff)
-
JavaScriptCore/bindings/ScriptObject.h (modified) (2 diffs)
-
JavaScriptCore/bindings/ScriptValue.h (modified) (1 diff)
-
JavaScriptCore/inspector/InjectedScriptManager.cpp (modified) (5 diffs)
-
JavaScriptCore/inspector/InjectedScriptManager.h (modified) (1 diff)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/Modules/mediacontrols/MediaControlsHost.h (modified) (2 diffs)
-
WebCore/Modules/plugins/PluginReplacement.h (modified) (4 diffs)
-
WebCore/Modules/plugins/QuickTimePluginReplacement.h (modified) (2 diffs)
-
WebCore/Modules/plugins/QuickTimePluginReplacement.mm (modified) (3 diffs)
-
WebCore/Modules/plugins/YouTubePluginReplacement.cpp (modified) (2 diffs)
-
WebCore/Modules/plugins/YouTubePluginReplacement.h (modified) (3 diffs)
-
WebCore/Modules/websockets/WebSocket.cpp (modified) (1 diff)
-
WebCore/bindings/js/DOMRequestState.h (modified) (3 diffs)
-
WebCore/bindings/js/Dictionary.h (modified) (4 diffs)
-
WebCore/bindings/js/JSCommandLineAPIHostCustom.cpp (modified) (1 diff)
-
WebCore/bindings/js/JSMessageEventCustom.cpp (modified) (2 diffs)
-
WebCore/bindings/js/JSNodeCustom.cpp (modified) (1 diff)
-
WebCore/bindings/js/JSNodeCustom.h (modified) (2 diffs)
-
WebCore/bindings/js/JSPopStateEventCustom.cpp (modified) (2 diffs)
-
WebCore/bindings/js/ScriptState.h (modified) (4 diffs)
-
WebCore/bindings/js/SerializedScriptValue.cpp (modified) (1 diff)
-
WebCore/bindings/js/SerializedScriptValue.h (modified) (2 diffs)
-
WebCore/css/FontFace.cpp (modified) (2 diffs)
-
WebCore/css/FontFace.h (modified) (1 diff)
-
WebCore/dom/MessageEvent.cpp (modified) (6 diffs)
-
WebCore/dom/MessageEvent.h (modified) (5 diffs)
-
WebCore/dom/NodeFilterCondition.h (modified) (1 diff)
-
WebCore/dom/PopStateEvent.h (modified) (3 diffs)
-
WebCore/dom/Traversal.cpp (modified) (1 diff)
-
WebCore/dom/Traversal.h (modified) (1 diff)
-
WebCore/html/HTMLPlugInElement.cpp (modified) (1 diff)
-
WebCore/inspector/InspectorDOMAgent.cpp (modified) (1 diff)
-
WebCore/inspector/InspectorFrontendHost.cpp (modified) (1 diff)
-
WebCore/inspector/InspectorIndexedDBAgent.cpp (modified) (1 diff)
-
WebCore/inspector/InspectorInstrumentation.h (modified) (4 diffs)
-
WebCore/page/DOMWindow.cpp (modified) (6 diffs)
-
WebCore/page/EventSource.cpp (modified) (1 diff)
-
WebCore/page/csp/ContentSecurityPolicy.h (modified) (3 diffs)
-
WebCore/page/csp/ContentSecurityPolicyDirectiveList.h (modified) (3 diffs)
-
WebCore/testing/Internals.cpp (modified) (5 diffs)
-
WebCore/testing/Internals.h (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r199639 r199642 1 2016-04-17 Darin Adler <darin@apple.com> 2 3 Remove more uses of Deprecated::ScriptXXX 4 https://bugs.webkit.org/show_bug.cgi?id=156660 5 6 Reviewed by Antti Koivisto. 7 8 * bindings/ScriptFunctionCall.cpp: 9 (Deprecated::ScriptCallArgumentHandler::appendArgument): Deleted 10 unneeded overloads that take a ScriptObject and ScriptValue. 11 * bindings/ScriptFunctionCall.h: Ditto. 12 13 * bindings/ScriptObject.h: Added operator so this can change 14 itself into a JSObject*. Helps while phasing this class out. 15 16 * bindings/ScriptValue.h: Export toInspectorValue so it can be 17 used in WebCore. 18 19 * inspector/InjectedScriptManager.cpp: 20 (Inspector::InjectedScriptManager::createInjectedScript): Changed 21 return value from Deprecated::ScriptObject to JSObject*. 22 (Inspector::InjectedScriptManager::injectedScriptFor): Updated for 23 the return value change above. 24 * inspector/InjectedScriptManager.h: Ditto. 25 1 26 2016-04-16 Benjamin Poulain <bpoulain@webkit.org> 2 27 -
trunk/Source/JavaScriptCore/bindings/ScriptFunctionCall.cpp
r199619 r199642 41 41 42 42 namespace Deprecated { 43 44 void ScriptCallArgumentHandler::appendArgument(const Deprecated::ScriptObject& argument)45 {46 if (argument.scriptState() != m_exec) {47 ASSERT_NOT_REACHED();48 return;49 }50 m_arguments.append(argument.jsObject());51 }52 43 53 44 void ScriptCallArgumentHandler::appendArgument(const String& argument) -
trunk/Source/JavaScriptCore/bindings/ScriptFunctionCall.h
r199619 r199642 47 47 ScriptCallArgumentHandler(JSC::ExecState* state) : m_exec(state) { } 48 48 49 void appendArgument(const ScriptObject&);50 void appendArgument(const ScriptValue&);51 49 void appendArgument(const char*); 52 50 void appendArgument(const String&); -
trunk/Source/JavaScriptCore/bindings/ScriptObject.h
r160457 r199642 30 30 */ 31 31 32 #ifndef ScriptObject_h 33 #define ScriptObject_h 32 #pragma once 34 33 35 34 #include "JSObject.h" … … 42 41 JS_EXPORT_PRIVATE ScriptObject(JSC::ExecState*, JSC::JSObject*); 43 42 JS_EXPORT_PRIVATE ScriptObject(JSC::ExecState*, const ScriptValue&); 44 ScriptObject() : m_scriptState(nullptr) { } 43 ScriptObject() { } 44 45 operator JSC::JSObject*() const { return jsObject(); } 45 46 46 47 JSC::JSObject* jsObject() const { return asObject(jsValue()); } 47 48 JSC::ExecState* scriptState() const { return m_scriptState; } 48 49 49 pr otected:50 JSC::ExecState* m_scriptState ;50 private: 51 JSC::ExecState* m_scriptState { nullptr }; 51 52 }; 52 53 53 54 } // namespace Deprecated 54 55 #endif // ScriptObject_h -
trunk/Source/JavaScriptCore/bindings/ScriptValue.h
r199619 r199642 44 44 class InspectorValue; 45 45 46 RefPtr<InspectorValue> toInspectorValue(JSC::ExecState&, JSC::JSValue);46 JS_EXPORT_PRIVATE RefPtr<InspectorValue> toInspectorValue(JSC::ExecState&, JSC::JSValue); 47 47 48 48 } -
trunk/Source/JavaScriptCore/inspector/InjectedScriptManager.cpp
r197614 r199642 132 132 } 133 133 134 Deprecated::ScriptObjectInjectedScriptManager::createInjectedScript(const String& source, ExecState* scriptState, int id)134 JSC::JSObject* InjectedScriptManager::createInjectedScript(const String& source, ExecState* scriptState, int id) 135 135 { 136 136 JSLockHolder lock(scriptState); … … 144 144 JSValue functionValue = evaluateHandler(scriptState, sourceCode, globalThisValue, evaluationException); 145 145 if (evaluationException) 146 return Deprecated::ScriptObject();146 return nullptr; 147 147 148 148 CallData callData; 149 149 CallType callType = getCallData(functionValue, callData); 150 150 if (callType == CallType::None) 151 return Deprecated::ScriptObject();151 return nullptr; 152 152 153 153 MarkedArgumentBuffer args; … … 158 158 JSValue result = JSC::call(scriptState, functionValue, callType, callData, globalThisValue, args); 159 159 scriptState->clearException(); 160 if (result.isObject()) 161 return Deprecated::ScriptObject(scriptState, result.getObject()); 162 163 return Deprecated::ScriptObject(); 160 return result.getObject(); 164 161 } 165 162 … … 177 174 178 175 int id = injectedScriptIdFor(inspectedExecState); 179 Deprecated::ScriptObjectinjectedScriptObject = createInjectedScript(injectedScriptSource(), inspectedExecState, id);180 if ( injectedScriptObject.scriptState() != inspectedExecState) {176 auto injectedScriptObject = createInjectedScript(injectedScriptSource(), inspectedExecState, id); 177 if (!injectedScriptObject) { 181 178 WTFLogAlways("Failed to parse/execute InjectedScriptSource.js!"); 182 179 WTFLogAlways("%s\n", injectedScriptSource().ascii().data()); … … 184 181 } 185 182 186 InjectedScript result( injectedScriptObject, &m_environment);183 InjectedScript result({ inspectedExecState, injectedScriptObject }, &m_environment); 187 184 m_idToInjectedScript.set(id, result); 188 185 didCreateInjectedScript(result); -
trunk/Source/JavaScriptCore/inspector/InjectedScriptManager.h
r192186 r199642 75 75 private: 76 76 String injectedScriptSource(); 77 Deprecated::ScriptObjectcreateInjectedScript(const String& source, JSC::ExecState*, int id);77 JSC::JSObject* createInjectedScript(const String& source, JSC::ExecState*, int id); 78 78 79 79 InspectorEnvironment& m_environment; -
trunk/Source/WebCore/ChangeLog
r199641 r199642 1 2016-04-17 Darin Adler <darin@apple.com> 2 3 Remove more uses of Deprecated::ScriptXXX 4 https://bugs.webkit.org/show_bug.cgi?id=156660 5 6 Reviewed by Antti Koivisto. 7 8 * Modules/mediacontrols/MediaControlsHost.h: Removed unneeded include. 9 10 * Modules/plugins/PluginReplacement.h: Removed unneeded include. 11 Changed argument to installReplacement into a reference. Changed return 12 value for creation function from PassRefPtr to Ref. 13 14 * Modules/plugins/QuickTimePluginReplacement.h: Removed unneeded includes and 15 forward declarations. Marked class final. Made almost everything private. 16 17 * Modules/plugins/QuickTimePluginReplacement.mm: 18 (WebCore::QuickTimePluginReplacement::create): Changed to return Ref. 19 (WebCore::QuickTimePluginReplacement::installReplacement): Changed to take 20 a reference. 21 22 * Modules/plugins/YouTubePluginReplacement.cpp: 23 (WebCore::YouTubePluginReplacement::create): Changed to return Ref. 24 (WebCore::YouTubePluginReplacement::installReplacement): Changed to take 25 a reference. 26 27 * Modules/plugins/YouTubePluginReplacement.h: Removed unneeded includes and 28 forward declarations. Marked class final. Changed return type of create. 29 30 * Modules/websockets/WebSocket.cpp: 31 (WebCore::WebSocket::didReceiveBinaryData): Removed local variable so the 32 MessageEvent::create function gets a Ref&& instead of a RefPtr without having 33 to add explicit WTFMove. 34 35 * bindings/js/DOMRequestState.h: Removed code that set m_exec twice. 36 37 * bindings/js/Dictionary.h: Reformatted function templates to use a single 38 line so they are easier to look at. 39 (WebCore::Dictionary::getEventListener): Rewrote this so it no longer uses 40 a Deprecated::ScriptValue and also make it a little more compact and terse. 41 42 * bindings/js/JSCommandLineAPIHostCustom.cpp: 43 (WebCore::JSCommandLineAPIHost::inspect): Rewrote to use JSValue instead of 44 Deprecated::ScriptValue. Considerably more efficient. 45 46 * bindings/js/JSMessageEventCustom.cpp: 47 (WebCore::JSMessageEvent::data): Streamlined to use Deprecated::ScriptValue 48 a little bit less. 49 50 * bindings/js/JSNodeCustom.cpp: Moved include here from header. 51 * bindings/js/JSNodeCustom.h: Moved include from here to cpp file. 52 53 * bindings/js/JSPopStateEventCustom.cpp: 54 (WebCore::JSPopStateEvent::state): Updated for changes to return value of the 55 state() and serializedState functions. 56 57 * bindings/js/ScriptState.h: Removed the ScriptState typedef. 58 59 * bindings/js/SerializedScriptValue.cpp: Moved include here from header. 60 * bindings/js/SerializedScriptValue.h: Moved include from here to cpp file. 61 62 * css/FontFace.cpp: 63 (WebCore::FontFace::create): Changed argument to JSValue instead of ScriptValue. 64 * css/FontFace.h: Ditto. 65 66 * dom/MessageEvent.cpp: Moved create functions in here from header file. 67 Removed some unused ones including one that took a Deprecated::ScriptValue. 68 * dom/MessageEvent.h: Streamlined create functions, removing unused functions, 69 unused arguments, and unused default values for arguments. Also moved them all 70 into the cpp file instead of inlining them. Also changed the return type of 71 dataAsScriptValue to JSValue. 72 73 * dom/NodeFilterCondition.h: Removed unneeded include. Tweaked formatting. 74 75 * dom/PopStateEvent.h: Changed return value of state to be a JSValue and of 76 serializedState to be a raw pointer, not a PassRefPtr. 77 78 * dom/Traversal.h: Removed unneeded include. Removed unnecessary use of 79 unsigned long instead of unsigned. Fixed indentation. 80 81 * html/HTMLPlugInElement.cpp: 82 (WebCore::HTMLPlugInElement::didAddUserAgentShadowRoot): Pass reference. 83 84 * inspector/InspectorDOMAgent.cpp: 85 (WebCore::InspectorDOMAgent::buildObjectForEventListener): Pass JSValue instead 86 of constructing a Deprecated::ScriptValue. 87 88 * inspector/InspectorFrontendHost.cpp: 89 (WebCore::FrontendMenuProvider::disconnect): Initialize without explicitly 90 mentioning the Deprecated::ScriptObject type. 91 92 * inspector/InspectorIndexedDBAgent.cpp: Removed unneeded include. 93 94 * inspector/InspectorInstrumentation.h: Removed unneeded include and also 95 declaration of two non-existent functions. 96 97 * page/DOMWindow.cpp: 98 (WebCore::PostMessageTimer::PostMessageTimer): Tweaked types a little bit to 99 match what is used in MessageEvent now. 100 (WebCore::PostMessageTimer::event): Streamlined a bit and changed type to 101 reference. 102 (WebCore::DOMWindow::postMessage): Updated for changes above. 103 (WebCore::DOMWindow::postMessageTimerFired): Ditto. 104 105 * page/EventSource.cpp: 106 (WebCore::EventSource::createMessageEvent): Removed now-unneeded 107 "false, false" from MessageEvent::create function call. 108 109 * page/csp/ContentSecurityPolicy.h: Removed unneeded include. 110 111 * page/csp/ContentSecurityPolicyDirectiveList.h: Removed unneeded 112 include and also unneeded non-copyable, since the class has a reference as 113 a data member and so is automatically non-copyable. 114 115 * testing/Internals.cpp: 116 (WebCore::Internals::description): Changed to take JSValue. 117 (WebCore::Internals::parserMetaData): Ditto. 118 (WebCore::Internals::serializeObject): Removed unnecessary copying of vector. 119 (WebCore::Internals::isFromCurrentWorld): Changed to take JSValue. 120 (WebCore::Internals::isReadableStreamDisturbed): Changed to not rely on the 121 ScriptState typedef and call it JSC::ExecState. 122 123 * testing/Internals.h: Removed unneeded includes. Removed unneeded and 124 inappropriate use of ASSERT_NO_EXCEPTION. 125 1 126 2016-04-17 Youenn Fablet <youenn.fablet@crf.canon.fr> 2 127 -
trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h
r196010 r199642 24 24 */ 25 25 26 #ifndef MediaControlsHost_h 27 #define MediaControlsHost_h 26 #pragma once 28 27 29 28 #if ENABLE(MEDIA_CONTROLS_SCRIPT) 30 29 31 #include "ScriptState.h"32 30 #include <bindings/ScriptObject.h> 33 31 #include <wtf/RefCounted.h> … … 91 89 92 90 #endif 93 94 #endif -
trunk/Source/WebCore/Modules/plugins/PluginReplacement.h
r183160 r199642 24 24 */ 25 25 26 #ifndef PluginReplacement_h 27 #define PluginReplacement_h 26 #pragma once 28 27 29 28 #include "RenderPtr.h" 30 #include <wtf/RefCounted.h>31 29 #include <wtf/text/WTFString.h> 32 30 … … 48 46 virtual ~PluginReplacement() { } 49 47 50 virtual bool installReplacement(ShadowRoot *) = 0;51 virtual JSC::JSObject* scriptObject() { return 0; }48 virtual bool installReplacement(ShadowRoot&) = 0; 49 virtual JSC::JSObject* scriptObject() { return nullptr; } 52 50 53 51 virtual bool willCreateRenderer() { return false; } 54 52 virtual RenderPtr<RenderElement> createElementRenderer(HTMLPlugInElement&, Ref<RenderStyle>&&, const RenderTreePosition&) = 0; 55 56 protected:57 PluginReplacement() { }58 53 }; 59 54 60 typedef PassRefPtr<PluginReplacement> (*CreatePluginReplacement)(HTMLPlugInElement&, const Vector<String>& paramNames, const Vector<String>& paramValues);55 typedef Ref<PluginReplacement> (*CreatePluginReplacement)(HTMLPlugInElement&, const Vector<String>& paramNames, const Vector<String>& paramValues); 61 56 typedef bool (*PluginReplacementSupportsType)(const String&); 62 57 typedef bool (*PluginReplacementSupportsFileExtension)(const String&); … … 81 76 } 82 77 83 PassRefPtr<PluginReplacement> create(HTMLPlugInElement& element, const Vector<String>& paramNames, const Vector<String>& paramValues) const { return m_constructor(element, paramNames, paramValues); }78 Ref<PluginReplacement> create(HTMLPlugInElement& element, const Vector<String>& paramNames, const Vector<String>& paramValues) const { return m_constructor(element, paramNames, paramValues); } 84 79 bool supportsType(const String& mimeType) const { return m_supportsType(mimeType); } 85 80 bool supportsFileExtension(const String& extension) const { return m_supportsFileExtension(extension); } … … 96 91 97 92 } 98 99 #endif -
trunk/Source/WebCore/Modules/plugins/QuickTimePluginReplacement.h
r197563 r199642 24 24 */ 25 25 26 #ifndef QuickTimePluginReplacement_h 27 #define QuickTimePluginReplacement_h 26 #pragma once 28 27 29 28 #include "PluginReplacement.h" 30 #include "ScriptState.h"31 #include <bindings/ScriptObject.h>32 #include <wtf/RefCounted.h>33 #include <wtf/text/WTFString.h>34 29 35 30 namespace WebCore { 36 31 37 class HTMLPlugInElement;32 class DOMWrapperWorld; 38 33 class HTMLVideoElement; 39 class RenderElement;40 class RenderStyle;41 class ShadowRoot;42 34 43 class QuickTimePluginReplacement : public PluginReplacement {35 class QuickTimePluginReplacement final : public PluginReplacement { 44 36 public: 45 37 static void registerPluginReplacement(PluginReplacementRegistrar); 46 static bool supportsMimeType(const String&);47 static bool supportsFileExtension(const String&);48 static bool supportsURL(const URL&) { return true; }49 50 static PassRefPtr<PluginReplacement> create(HTMLPlugInElement&, const Vector<String>& paramNames, const Vector<String>& paramValues);51 ~QuickTimePluginReplacement();52 38 53 bool installReplacement(ShadowRoot*) override; 54 JSC::JSObject* scriptObject() override { return m_scriptObject; } 55 56 bool willCreateRenderer() override { return m_mediaElement; } 57 RenderPtr<RenderElement> createElementRenderer(HTMLPlugInElement&, Ref<RenderStyle>&&, const RenderTreePosition&) override; 58 59 HTMLVideoElement* parentElement() { return m_mediaElement.get(); } 39 virtual ~QuickTimePluginReplacement(); 60 40 61 41 unsigned long long movieSize() const; 62 42 void postEvent(const String&); 63 43 44 HTMLVideoElement* parentElement() { return m_mediaElement.get(); } 45 64 46 private: 65 47 QuickTimePluginReplacement(HTMLPlugInElement&, const Vector<String>& paramNames, const Vector<String>& paramValues); 48 static Ref<PluginReplacement> create(HTMLPlugInElement&, const Vector<String>& paramNames, const Vector<String>& paramValues); 49 static bool supportsMimeType(const String&); 50 static bool supportsFileExtension(const String&); 51 static bool supportsURL(const URL&) { return true; } 52 53 bool installReplacement(ShadowRoot&) final; 54 JSC::JSObject* scriptObject() final { return m_scriptObject; } 55 56 bool willCreateRenderer() final { return m_mediaElement; } 57 RenderPtr<RenderElement> createElementRenderer(HTMLPlugInElement&, Ref<RenderStyle>&&, const RenderTreePosition&) final; 66 58 67 59 bool ensureReplacementScriptInjected(); … … 72 64 const Vector<String> m_names; 73 65 const Vector<String> m_values; 74 JSC::JSObject* m_scriptObject; 66 JSC::JSObject* m_scriptObject; // FIXME: Why is it safe to have this pointer here? What keeps it alive during GC? 75 67 }; 76 68 77 69 } 78 79 #endif -
trunk/Source/WebCore/Modules/plugins/QuickTimePluginReplacement.mm
r197794 r199642 76 76 } 77 77 78 PassRefPtr<PluginReplacement> QuickTimePluginReplacement::create(HTMLPlugInElement& plugin, const Vector<String>& paramNames, const Vector<String>& paramValues)79 { 80 return adoptRef( new QuickTimePluginReplacement(plugin, paramNames, paramValues));78 Ref<PluginReplacement> QuickTimePluginReplacement::create(HTMLPlugInElement& plugin, const Vector<String>& paramNames, const Vector<String>& paramValues) 79 { 80 return adoptRef(*new QuickTimePluginReplacement(plugin, paramNames, paramValues)); 81 81 } 82 82 … … 172 172 } 173 173 174 bool QuickTimePluginReplacement::installReplacement(ShadowRoot *root)174 bool QuickTimePluginReplacement::installReplacement(ShadowRoot& root) 175 175 { 176 176 if (!ensureReplacementScriptInjected()) … … 198 198 199 199 JSC::MarkedArgumentBuffer argList; 200 argList.append(toJS(exec, globalObject, root));200 argList.append(toJS(exec, globalObject, &root)); 201 201 argList.append(toJS(exec, globalObject, m_parentElement)); 202 202 argList.append(toJS(exec, globalObject, this)); -
trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp
r195951 r199642 44 44 } 45 45 46 PassRefPtr<PluginReplacement> YouTubePluginReplacement::create(HTMLPlugInElement& plugin, const Vector<String>& paramNames, const Vector<String>& paramValues)47 { 48 return adoptRef( new YouTubePluginReplacement(plugin, paramNames, paramValues));46 Ref<PluginReplacement> YouTubePluginReplacement::create(HTMLPlugInElement& plugin, const Vector<String>& paramNames, const Vector<String>& paramValues) 47 { 48 return adoptRef(*new YouTubePluginReplacement(plugin, paramNames, paramValues)); 49 49 } 50 50 … … 78 78 } 79 79 80 bool YouTubePluginReplacement::installReplacement(ShadowRoot *root)80 bool YouTubePluginReplacement::installReplacement(ShadowRoot& root) 81 81 { 82 82 m_embedShadowElement = YouTubeEmbedShadowElement::create(m_parentElement->document()); 83 83 84 root ->appendChild(*m_embedShadowElement);84 root.appendChild(*m_embedShadowElement); 85 85 86 86 Ref<HTMLIFrameElement> iframeElement = HTMLIFrameElement::create(HTMLNames::iframeTag, m_parentElement->document()); -
trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.h
r197563 r199642 24 24 */ 25 25 26 #ifndef YouTubePluginReplacement_h 27 #define YouTubePluginReplacement_h 26 #pragma once 28 27 29 28 #include "PluginReplacement.h" 30 31 29 #include <wtf/HashMap.h> 32 #include <wtf/RetainPtr.h>33 30 34 31 namespace WebCore { 35 32 36 class HTMLPlugInElement;37 class HTMLIFrameElement;38 class RenderElement;39 class RenderStyle;40 class ShadowRoot;41 33 class YouTubeEmbedShadowElement; 42 34 43 class YouTubePluginReplacement : public PluginReplacement {35 class YouTubePluginReplacement final : public PluginReplacement { 44 36 public: 45 37 static void registerPluginReplacement(PluginReplacementRegistrar); … … 49 41 private: 50 42 YouTubePluginReplacement(HTMLPlugInElement&, const Vector<String>& paramNames, const Vector<String>& paramValues); 51 43 static Ref<PluginReplacement> create(HTMLPlugInElement&, const Vector<String>& paramNames, const Vector<String>& paramValues); 52 44 static bool supportsMimeType(const String&); 53 45 static bool supportsFileExtension(const String&); 54 46 static bool supportsURL(const URL&); 55 56 static PassRefPtr<PluginReplacement> create(HTMLPlugInElement&, const Vector<String>& paramNames, const Vector<String>& paramValues);57 47 58 bool installReplacement(ShadowRoot *) override;59 48 bool installReplacement(ShadowRoot&) final; 49 60 50 String youTubeURL(const String& rawURL); 61 62 bool willCreateRenderer() override{ return m_embedShadowElement; }63 RenderPtr<RenderElement> createElementRenderer(HTMLPlugInElement&, Ref<RenderStyle>&&, const RenderTreePosition&) override;64 51 52 bool willCreateRenderer() final { return m_embedShadowElement; } 53 RenderPtr<RenderElement> createElementRenderer(HTMLPlugInElement&, Ref<RenderStyle>&&, const RenderTreePosition&) final; 54 65 55 HTMLPlugInElement* m_parentElement; 66 56 RefPtr<YouTubeEmbedShadowElement> m_embedShadowElement; … … 69 59 70 60 } 71 72 #endif -
trunk/Source/WebCore/Modules/websockets/WebSocket.cpp
r198869 r199642 566 566 LOG(Network, "WebSocket %p didReceiveBinaryData() %lu byte binary message", this, static_cast<unsigned long>(binaryData.size())); 567 567 switch (m_binaryType) { 568 case BinaryTypeBlob: {568 case BinaryTypeBlob: 569 569 // FIXME: We just received the data from NetworkProcess, and are sending it back. This is inefficient. 570 RefPtr<Blob> blob = Blob::create(WTFMove(binaryData), emptyString()); 571 dispatchEvent(MessageEvent::create(blob.release(), SecurityOrigin::create(m_url)->toString())); 570 dispatchEvent(MessageEvent::create(Blob::create(WTFMove(binaryData), emptyString()), SecurityOrigin::create(m_url)->toString())); 572 571 break; 573 }574 575 572 case BinaryTypeArrayBuffer: 576 573 dispatchEvent(MessageEvent::create(ArrayBuffer::create(binaryData.data(), binaryData.size()), SecurityOrigin::create(m_url)->toString())); -
trunk/Source/WebCore/bindings/js/DOMRequestState.h
r174089 r199642 26 26 */ 27 27 28 #ifndef DOMRequestState_h 29 #define DOMRequestState_h 28 #pragma once 30 29 31 30 #include "DOMWrapperWorld.h" … … 42 41 explicit DOMRequestState(ScriptExecutionContext* scriptExecutionContext) 43 42 : m_scriptExecutionContext(scriptExecutionContext) 44 , m_exec(nullptr)45 43 { 46 44 if (is<Document>(*m_scriptExecutionContext)) { … … 80 78 81 79 } 82 #endif -
trunk/Source/WebCore/bindings/js/Dictionary.h
r195954 r199642 25 25 */ 26 26 27 #ifndef Dictionary_h 28 #define Dictionary_h 27 #pragma once 29 28 30 29 #include "JSDictionary.h" … … 48 47 49 48 // Returns true if a value was found for the provided property. 50 template <typename Result> 51 bool get(const char* propertyName, Result&) const; 52 template <typename Result> 53 bool get(const String& propertyName, Result&) const; 49 template<typename Result> bool get(const char* propertyName, Result&) const; 50 template<typename Result> bool get(const String& propertyName, Result&) const; 54 51 55 template <typename Result> 56 Optional<Result> get(const char* propertyName) const; 52 template<typename Result> Optional<Result> get(const char* propertyName) const; 57 53 58 template <typename T> 59 RefPtr<EventListener> getEventListener(const char* propertyName, T* target) const; 60 template <typename T> 61 RefPtr<EventListener> getEventListener(const String& propertyName, T* target) const; 54 template<typename T> RefPtr<EventListener> getEventListener(const char* propertyName, T* target) const; 55 template<typename T> RefPtr<EventListener> getEventListener(const String& propertyName, T* target) const; 62 56 63 57 bool isObject() const { return m_dictionary.isValid(); } … … 70 64 71 65 private: 72 template <typename T> 73 JSC::JSObject* asJSObject(T*) const; 66 template<typename T> JSC::JSObject* asJSObject(T*) const; 74 67 75 68 JSDictionary m_dictionary; 76 69 }; 77 70 78 template <typename Result> 79 bool Dictionary::get(const char* propertyName, Result& result) const 71 template<typename Result> bool Dictionary::get(const char* propertyName, Result& result) const 80 72 { 81 if (!m_dictionary.isValid()) 82 return false; 83 84 return m_dictionary.get(propertyName, result); 73 return m_dictionary.isValid() && m_dictionary.get(propertyName, result); 85 74 } 86 75 87 template <typename Result> 88 bool Dictionary::get(const String& propertyName, Result& result) const 76 template<typename Result> bool Dictionary::get(const String& propertyName, Result& result) const 89 77 { 90 78 return get(propertyName.utf8().data(), result); 91 79 } 92 80 93 template<typename Result> 94 Optional<Result> Dictionary::get(const char* propertyName) const 81 template<typename Result> Optional<Result> Dictionary::get(const char* propertyName) const 95 82 { 96 83 Result result; 97 98 84 if (!get(propertyName, result)) 99 85 return Nullopt; 100 101 86 return result; 102 87 } 103 88 104 template <typename T> 105 RefPtr<EventListener> Dictionary::getEventListener(const char* propertyName, T* target) const 89 template<typename T> RefPtr<EventListener> Dictionary::getEventListener(const char* propertyName, T* target) const 106 90 { 107 if (!m_dictionary.isValid()) 91 JSC::JSValue eventListener; 92 if (!get(propertyName, eventListener) || !eventListener || !eventListener.isObject()) 108 93 return nullptr; 109 110 Deprecated::ScriptValue eventListener; 111 if (!m_dictionary.tryGetProperty(propertyName, eventListener)) 112 return nullptr; 113 if (eventListener.hasNoValue()) 114 return nullptr; 115 if (!eventListener.isObject()) 116 return nullptr; 117 118 return JSEventListener::create(asObject(eventListener.jsValue()), asJSObject(target), true, currentWorld(m_dictionary.execState())); 94 return JSEventListener::create(asObject(eventListener), asJSObject(target), true, currentWorld(execState())); 119 95 } 120 96 121 template <typename T> 122 RefPtr<EventListener> Dictionary::getEventListener(const String& propertyName, T* target) const 97 template<typename T> RefPtr<EventListener> Dictionary::getEventListener(const String& propertyName, T* target) const 123 98 { 124 99 return getEventListener(propertyName.utf8().data(), target); … … 126 101 127 102 } 128 129 #endif // Dictionary_h -
trunk/Source/WebCore/bindings/js/JSCommandLineAPIHostCustom.cpp
r199619 r199642 123 123 JSValue JSCommandLineAPIHost::inspect(ExecState& state) 124 124 { 125 if (state.argumentCount() >= 2) { 126 Deprecated::ScriptValue object(state.vm(), state.uncheckedArgument(0)); 127 Deprecated::ScriptValue hints(state.vm(), state.uncheckedArgument(1)); 128 wrapped().inspectImpl(object.toInspectorValue(&state), hints.toInspectorValue(&state)); 129 } 130 125 if (state.argumentCount() < 2) 126 return jsUndefined(); 127 wrapped().inspectImpl(Inspector::toInspectorValue(state, state.uncheckedArgument(0)), 128 Inspector::toInspectorValue(state, state.uncheckedArgument(1))); 131 129 return jsUndefined(); 132 130 } -
trunk/Source/WebCore/bindings/js/JSMessageEventCustom.cpp
r194496 r199642 58 58 switch (event.dataType()) { 59 59 case MessageEvent::DataTypeScriptValue: { 60 Deprecated::ScriptValue scriptValue = event.dataAsScriptValue();61 if ( scriptValue.hasNoValue())60 JSValue dataValue = event.dataAsScriptValue(); 61 if (!dataValue) 62 62 result = jsNull(); 63 63 else { 64 JSValue dataValue = scriptValue.jsValue();65 64 // We need to make sure MessageEvents do not leak objects in their state property across isolated DOM worlds. 66 65 // Ideally, we would check that the worlds have different privileges but that's not possible yet. … … 121 120 return jsUndefined(); 122 121 } 123 Deprecated::ScriptValue dataArg = Deprecated::ScriptValue(state.vm(), state.argument(3));122 Deprecated::ScriptValue dataArg(state.vm(), state.argument(3)); 124 123 if (state.hadException()) 125 124 return jsUndefined(); -
trunk/Source/WebCore/bindings/js/JSNodeCustom.cpp
r191887 r199642 62 62 #include "RegisteredEventListener.h" 63 63 #include "SVGElement.h" 64 #include "ScriptState.h" 64 65 #include "ShadowRoot.h" 65 66 #include "StyleSheet.h" -
trunk/Source/WebCore/bindings/js/JSNodeCustom.h
r172849 r199642 24 24 */ 25 25 26 #ifndef JSNodeCustom_h 27 #define JSNodeCustom_h 26 #pragma once 28 27 29 28 #include "JSDOMBinding.h" 30 29 #include "JSNode.h" 31 #include "ScriptState.h"32 30 #include "ShadowRoot.h" 33 31 … … 92 90 93 91 } // namespace WebCore 94 95 #endif // JSDOMNodeCustom_h -
trunk/Source/WebCore/bindings/js/JSPopStateEventCustom.cpp
r191887 r199642 59 59 PopStateEvent& event = wrapped(); 60 60 61 if ( !event.state().hasNoValue()) {61 if (auto eventState = event.state()) { 62 62 // We need to make sure a PopStateEvent does not leak objects in its state property across isolated DOM worlds. 63 63 // Ideally, we would check that the worlds have different privileges but that's not possible yet. 64 JSValue eventState = event.state().jsValue();65 64 if (eventState.isObject() && &worldForDOMObject(eventState.getObject()) != ¤tWorld(&state)) { 66 if ( RefPtr<SerializedScriptValue>serializedValue = event.trySerializeState(&state))65 if (auto serializedValue = event.trySerializeState(&state)) 67 66 eventState = serializedValue->deserialize(&state, globalObject(), nullptr); 68 67 else 69 68 eventState = jsNull(); 70 69 } 71 72 70 return cacheState(state, this, eventState); 73 71 } … … 83 81 // of using the correct one, and always share the same deserialization with history.state. 84 82 85 bool isSameState = history->isSameAsCurrentState(event.serializedState() .get());83 bool isSameState = history->isSameAsCurrentState(event.serializedState()); 86 84 JSValue result; 87 85 -
trunk/Source/WebCore/bindings/js/ScriptState.h
r173929 r199642 30 30 */ 31 31 32 #ifndef ScriptState_h 33 #define ScriptState_h 32 #pragma once 34 33 35 34 namespace JSC { … … 38 37 39 38 namespace WebCore { 39 40 40 class DOMWindow; 41 41 class DOMWrapperWorld; … … 45 45 class ScriptExecutionContext; 46 46 class WorkerGlobalScope; 47 48 // The idea is to expose "state-like" methods (hadException, and any other49 // methods where ExecState just dips into vm) of JSC::ExecState as a50 // separate abstraction.51 // For now, the separation is purely by convention.52 typedef JSC::ExecState ScriptState;53 47 54 48 DOMWindow* domWindowFromExecState(JSC::ExecState*); … … 63 57 64 58 } // namespace WebCore 65 66 #endif // ScriptState_h -
trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp
r199524 r199642 50 50 #include "JSNavigator.h" 51 51 #include "ScriptExecutionContext.h" 52 #include "ScriptState.h" 52 53 #include "SharedBuffer.h" 53 54 #include "WebCoreJSClientData.h" -
trunk/Source/WebCore/bindings/js/SerializedScriptValue.h
r199524 r199642 25 25 */ 26 26 27 #ifndef SerializedScriptValue_h 28 #define SerializedScriptValue_h 27 #pragma once 29 28 30 #include "ScriptState.h"31 29 #include <bindings/ScriptValue.h> 32 30 #include <heap/Strong.h> … … 116 114 117 115 } 118 119 #endif // SerializedScriptValue_h -
trunk/Source/WebCore/css/FontFace.cpp
r196954 r199642 58 58 } 59 59 60 RefPtr<FontFace> FontFace::create(JSC::ExecState& execState, ScriptExecutionContext& context, const String& family, const Deprecated::ScriptValue&source, const Dictionary& descriptors, ExceptionCode& ec)60 RefPtr<FontFace> FontFace::create(JSC::ExecState& execState, ScriptExecutionContext& context, const String& family, JSC::JSValue source, const Dictionary& descriptors, ExceptionCode& ec) 61 61 { 62 62 if (!context.isDocument()) { … … 67 67 Ref<FontFace> result = adoptRef(*new FontFace(execState, downcast<Document>(context).fontSelector())); 68 68 69 ec = 0; 69 70 result->setFamily(family, ec); 70 71 if (ec) 71 72 return nullptr; 72 73 73 if (source. jsValue().isString()) {74 String sourceString = source. jsValue().toString(&execState)->value(&execState);74 if (source.isString()) { 75 String sourceString = source.toString(&execState)->value(&execState); 75 76 auto value = FontFace::parseString(sourceString, CSSPropertySrc); 76 if (is<CSSValueList>(value.get())) { 77 CSSValueList& srcList = downcast<CSSValueList>(*value); 78 CSSFontFace::appendSources(result->backing(), srcList, &downcast<Document>(context), false); 79 } else { 77 if (!is<CSSValueList>(value.get())) { 80 78 ec = SYNTAX_ERR; 81 79 return nullptr; 82 80 } 81 CSSFontFace::appendSources(result->backing(), downcast<CSSValueList>(*value), &downcast<Document>(context), false); 83 82 } 84 83 -
trunk/Source/WebCore/css/FontFace.h
r197804 r199642 49 49 class FontFace final : public RefCounted<FontFace>, public CSSFontFace::Client { 50 50 public: 51 static RefPtr<FontFace> create(JSC::ExecState&, ScriptExecutionContext&, const String& family, const Deprecated::ScriptValue&source, const Dictionary& descriptors, ExceptionCode&);51 static RefPtr<FontFace> create(JSC::ExecState&, ScriptExecutionContext&, const String& family, JSC::JSValue source, const Dictionary& descriptors, ExceptionCode&); 52 52 static Ref<FontFace> create(JSC::ExecState&, CSSFontFace&); 53 53 virtual ~FontFace(); -
trunk/Source/WebCore/dom/MessageEvent.cpp
r198488 r199642 29 29 #include "MessageEvent.h" 30 30 31 #include "Blob.h" 32 #include "DOMWindow.h" 31 33 #include <runtime/JSCInlines.h> 32 34 … … 38 40 } 39 41 40 MessageEvent::MessageEvent()42 inline MessageEvent::MessageEvent() 41 43 : m_dataType(DataTypeScriptValue) 42 44 { 43 45 } 44 46 45 MessageEvent::MessageEvent(const AtomicString& type, const MessageEventInit& initializer)47 inline MessageEvent::MessageEvent(const AtomicString& type, const MessageEventInit& initializer) 46 48 : Event(type, initializer) 47 49 , m_dataType(DataTypeScriptValue) … … 54 56 } 55 57 56 MessageEvent::MessageEvent(const Deprecated::ScriptValue& data, const String& origin, const String& lastEventId, PassRefPtr<EventTarget>source, std::unique_ptr<MessagePortArray> ports)57 : Event(eventNames().messageEvent, false, false) 58 , m_dataType(DataTypeS criptValue)59 , m_dataAsS criptValue(data)58 inline MessageEvent::MessageEvent(RefPtr<SerializedScriptValue>&& data, const String& origin, const String& lastEventId, EventTarget* source, std::unique_ptr<MessagePortArray> ports) 59 : Event(eventNames().messageEvent, false, false) 60 , m_dataType(DataTypeSerializedScriptValue) 61 , m_dataAsSerializedScriptValue(WTFMove(data)) 60 62 , m_origin(origin) 61 63 , m_lastEventId(lastEventId) … … 63 65 , m_ports(WTFMove(ports)) 64 66 { 65 ASSERT(isValidSource( m_source.get()));66 } 67 68 MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<EventTarget> source, std::unique_ptr<MessagePortArray> ports)69 : Event( eventNames().messageEvent, false, false)67 ASSERT(isValidSource(source)); 68 } 69 70 inline MessageEvent::MessageEvent(const AtomicString& type, RefPtr<SerializedScriptValue>&& data, const String& origin, const String& lastEventId) 71 : Event(type, false, false) 70 72 , m_dataType(DataTypeSerializedScriptValue) 71 , m_dataAsSerializedScriptValue( data)73 , m_dataAsSerializedScriptValue(WTFMove(data)) 72 74 , m_origin(origin) 73 75 , m_lastEventId(lastEventId) 74 , m_source(source) 75 , m_ports(WTFMove(ports)) 76 { 77 ASSERT(isValidSource(m_source.get())); 78 } 79 80 MessageEvent::MessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId) 81 : Event(type, canBubble, cancelable) 82 , m_dataType(DataTypeSerializedScriptValue) 83 , m_dataAsSerializedScriptValue(data) 84 , m_origin(origin) 85 , m_lastEventId(lastEventId) 86 { 87 } 88 89 MessageEvent::MessageEvent(const String& data, const String& origin) 76 { 77 } 78 79 inline MessageEvent::MessageEvent(const String& data, const String& origin) 90 80 : Event(eventNames().messageEvent, false, false) 91 81 , m_dataType(DataTypeString) … … 95 85 } 96 86 97 MessageEvent::MessageEvent(PassRefPtr<Blob>data, const String& origin)87 inline MessageEvent::MessageEvent(Ref<Blob>&& data, const String& origin) 98 88 : Event(eventNames().messageEvent, false, false) 99 89 , m_dataType(DataTypeBlob) 100 , m_dataAsBlob( data)101 , m_origin(origin) 102 { 103 } 104 105 MessageEvent::MessageEvent(Ref<ArrayBuffer>&& data, const String& origin)90 , m_dataAsBlob(WTFMove(data)) 91 , m_origin(origin) 92 { 93 } 94 95 inline MessageEvent::MessageEvent(Ref<ArrayBuffer>&& data, const String& origin) 106 96 : Event(eventNames().messageEvent, false, false) 107 97 , m_dataType(DataTypeArrayBuffer) … … 109 99 , m_origin(origin) 110 100 { 101 } 102 103 Ref<MessageEvent> MessageEvent::create(std::unique_ptr<MessagePortArray> ports, RefPtr<SerializedScriptValue>&& data, const String& origin, const String& lastEventId, EventTarget* source) 104 { 105 return adoptRef(*new MessageEvent(WTFMove(data), origin, lastEventId, source, WTFMove(ports))); 106 } 107 108 Ref<MessageEvent> MessageEvent::create(const AtomicString& type, RefPtr<SerializedScriptValue>&& data, const String& origin, const String& lastEventId) 109 { 110 return adoptRef(*new MessageEvent(type, WTFMove(data), origin, lastEventId)); 111 } 112 113 Ref<MessageEvent> MessageEvent::create(const String& data, const String& origin) 114 { 115 return adoptRef(*new MessageEvent(data, origin)); 116 } 117 118 Ref<MessageEvent> MessageEvent::create(Ref<Blob>&& data, const String& origin) 119 { 120 return adoptRef(*new MessageEvent(WTFMove(data), origin)); 121 } 122 123 Ref<MessageEvent> MessageEvent::create(Ref<ArrayBuffer>&& data, const String& origin) 124 { 125 return adoptRef(*new MessageEvent(WTFMove(data), origin)); 126 } 127 128 Ref<MessageEvent> MessageEvent::createForBindings() 129 { 130 return adoptRef(*new MessageEvent); 131 } 132 133 Ref<MessageEvent> MessageEvent::createForBindings(const AtomicString& type, const MessageEventInit& initializer) 134 { 135 return adoptRef(*new MessageEvent(type, initializer)); 111 136 } 112 137 -
trunk/Source/WebCore/dom/MessageEvent.h
r198488 r199642 26 26 */ 27 27 28 #ifndef MessageEvent_h 29 #define MessageEvent_h 28 #pragma once 30 29 31 #include "Blob.h"32 #include "DOMWindow.h"33 30 #include "Event.h" 34 31 #include "MessagePort.h" 35 32 #include "SerializedScriptValue.h" 36 33 #include <bindings/ScriptValue.h> 37 #include <memory>38 #include <runtime/ArrayBuffer.h>39 34 40 35 namespace WebCore { 41 36 42 class EventTarget;37 class Blob; 43 38 44 39 struct MessageEventInit : public EventInit { … … 52 47 class MessageEvent final : public Event { 53 48 public: 54 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) 55 { 56 return adoptRef(*new MessageEvent(data, origin, lastEventId, source, WTFMove(ports))); 57 } 58 static Ref<MessageEvent> create(std::unique_ptr<MessagePortArray> ports, PassRefPtr<SerializedScriptValue> data, const String& origin = String(), const String& lastEventId = String(), PassRefPtr<EventTarget> source = nullptr) 59 { 60 return adoptRef(*new MessageEvent(data, origin, lastEventId, source, WTFMove(ports))); 61 } 62 static Ref<MessageEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId) 63 { 64 return adoptRef(*new MessageEvent(type, canBubble, cancelable, data, origin, lastEventId)); 65 } 66 static Ref<MessageEvent> create(const String& data, const String& origin = String()) 67 { 68 return adoptRef(*new MessageEvent(data, origin)); 69 } 70 static Ref<MessageEvent> create(PassRefPtr<Blob> data, const String& origin = String()) 71 { 72 return adoptRef(*new MessageEvent(data, origin)); 73 } 74 static Ref<MessageEvent> create(Ref<ArrayBuffer>&& data, const String& origin = String()) 75 { 76 return adoptRef(*new MessageEvent(WTFMove(data), origin)); 77 } 78 static Ref<MessageEvent> createForBindings() 79 { 80 return adoptRef(*new MessageEvent); 81 } 82 static Ref<MessageEvent> createForBindings(const AtomicString& type, const MessageEventInit& initializer) 83 { 84 return adoptRef(*new MessageEvent(type, initializer)); 85 } 49 static Ref<MessageEvent> create(std::unique_ptr<MessagePortArray>, RefPtr<SerializedScriptValue>&&, const String& origin = { }, const String& lastEventId = { }, EventTarget* source = nullptr); 50 static Ref<MessageEvent> create(const AtomicString& type, RefPtr<SerializedScriptValue>&&, const String& origin, const String& lastEventId); 51 static Ref<MessageEvent> create(const String& data, const String& origin = { }); 52 static Ref<MessageEvent> create(Ref<Blob>&& data, const String& origin); 53 static Ref<MessageEvent> create(Ref<ArrayBuffer>&& data, const String& origin = { }); 54 static Ref<MessageEvent> createForBindings(); 55 static Ref<MessageEvent> createForBindings(const AtomicString& type, const MessageEventInit&); 86 56 virtual ~MessageEvent(); 87 57 … … 111 81 }; 112 82 DataType dataType() const { return m_dataType; } 113 const Deprecated::ScriptValue&dataAsScriptValue() const { ASSERT(m_dataType == DataTypeScriptValue); return m_dataAsScriptValue; }83 JSC::JSValue dataAsScriptValue() const { ASSERT(m_dataType == DataTypeScriptValue); return m_dataAsScriptValue; } 114 84 PassRefPtr<SerializedScriptValue> dataAsSerializedScriptValue() const { ASSERT(m_dataType == DataTypeSerializedScriptValue); return m_dataAsSerializedScriptValue; } 115 85 String dataAsString() const { ASSERT(m_dataType == DataTypeString); return m_dataAsString; } … … 122 92 MessageEvent(); 123 93 MessageEvent(const AtomicString&, const MessageEventInit&); 124 MessageEvent(const Deprecated::ScriptValue& data, const String& origin, const String& lastEventId, PassRefPtr<EventTarget> source, std::unique_ptr<MessagePortArray>); 125 MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<EventTarget> source, std::unique_ptr<MessagePortArray>); 126 MessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId); 127 128 explicit MessageEvent(const String& data, const String& origin); 129 explicit MessageEvent(PassRefPtr<Blob> data, const String& origin); 130 explicit MessageEvent(Ref<ArrayBuffer>&& data, const String& origin); 94 MessageEvent(RefPtr<SerializedScriptValue>&& data, const String& origin, const String& lastEventId, EventTarget* source, std::unique_ptr<MessagePortArray>); 95 MessageEvent(const AtomicString& type, RefPtr<SerializedScriptValue>&& data, const String& origin, const String& lastEventId); 96 MessageEvent(const String& data, const String& origin); 97 MessageEvent(Ref<Blob>&& data, const String& origin); 98 MessageEvent(Ref<ArrayBuffer>&& data, const String& origin); 131 99 132 100 DataType m_dataType; … … 144 112 145 113 } // namespace WebCore 146 147 #endif // MessageEvent_h -
trunk/Source/WebCore/dom/NodeFilterCondition.h
r189230 r199642 23 23 */ 24 24 25 #ifndef NodeFilterCondition_h 26 #define NodeFilterCondition_h 25 #pragma once 27 26 28 #include "ScriptState.h"29 27 #include <wtf/RefCounted.h> 30 28 31 29 namespace JSC { 32 33 30 class SlotVisitor; 34 35 31 } 36 32 37 33 namespace WebCore { 38 34 39 class Node;35 class Node; 40 36 41 class NodeFilterCondition : public RefCounted<NodeFilterCondition> {42 public:43 virtual ~NodeFilterCondition() { }44 virtual short acceptNode(Node*) const = 0;45 virtual void visitAggregate(JSC::SlotVisitor&) { }46 };37 class NodeFilterCondition : public RefCounted<NodeFilterCondition> { 38 public: 39 virtual ~NodeFilterCondition() { } 40 virtual short acceptNode(Node*) const = 0; 41 virtual void visitAggregate(JSC::SlotVisitor&) { } 42 }; 47 43 48 44 } // namespace WebCore 49 50 #endif // NodeFilterCondition_h -
trunk/Source/WebCore/dom/PopStateEvent.h
r197563 r199642 25 25 */ 26 26 27 #ifndef PopStateEvent_h 28 #define PopStateEvent_h 27 #pragma once 29 28 30 29 #include "Event.h" 31 #include "SerializedScriptValue.h"32 30 #include <bindings/ScriptValue.h> 33 31 34 32 namespace WebCore { 35 33 34 class History; 35 class SerializedScriptValue; 36 36 37 struct PopStateEventInit : public EventInit { 37 38 Deprecated::ScriptValue state; 38 39 }; 39 40 class History;41 class SerializedScriptValue;42 40 43 41 class PopStateEvent final : public Event { … … 47 45 static Ref<PopStateEvent> createForBindings(const AtomicString&, const PopStateEventInit&); 48 46 49 PassRefPtr<SerializedScriptValue> serializedState() const { ASSERT(m_serializedState); return m_serializedState; } 50 47 JSC::JSValue state() const { return m_state; } 48 SerializedScriptValue* serializedState() const { return m_serializedState.get(); } 49 51 50 RefPtr<SerializedScriptValue> trySerializeState(JSC::ExecState*); 52 51 53 const Deprecated::ScriptValue& state() const { return m_state; }54 52 History* history() const { return m_history.get(); } 55 53 … … 67 65 68 66 } // namespace WebCore 69 70 #endif // PopStateEvent_h -
trunk/Source/WebCore/dom/Traversal.cpp
r194496 r199642 31 31 namespace WebCore { 32 32 33 NodeIteratorBase::NodeIteratorBase(Node& rootNode, unsigned longwhatToShow, RefPtr<NodeFilter>&& nodeFilter)33 NodeIteratorBase::NodeIteratorBase(Node& rootNode, unsigned whatToShow, RefPtr<NodeFilter>&& nodeFilter) 34 34 : m_root(&rootNode) 35 35 , m_whatToShow(whatToShow) -
trunk/Source/WebCore/dom/Traversal.h
r194324 r199642 23 23 */ 24 24 25 #ifndef Traversal_h 26 #define Traversal_h 25 #pragma once 27 26 28 #include "ScriptState.h"29 27 #include <wtf/RefPtr.h> 30 28 31 29 namespace WebCore { 32 30 33 class Node;34 class NodeFilter;31 class Node; 32 class NodeFilter; 35 33 36 class NodeIteratorBase {37 public:38 Node* root() const { return m_root.get(); }39 unsigned longwhatToShow() const { return m_whatToShow; }40 NodeFilter* filter() const { return m_filter.get(); }41 bool expandEntityReferences() const { return false; }34 class NodeIteratorBase { 35 public: 36 Node* root() const { return m_root.get(); } 37 unsigned whatToShow() const { return m_whatToShow; } 38 NodeFilter* filter() const { return m_filter.get(); } 39 bool expandEntityReferences() const { return false; } 42 40 43 protected:44 NodeIteratorBase(Node&, unsigned longwhatToShow, RefPtr<NodeFilter>&&);45 short acceptNode(Node*) const;41 protected: 42 NodeIteratorBase(Node&, unsigned whatToShow, RefPtr<NodeFilter>&&); 43 short acceptNode(Node*) const; 46 44 47 private:48 RefPtr<Node> m_root;49 unsigned longm_whatToShow;50 RefPtr<NodeFilter> m_filter;51 };45 private: 46 RefPtr<Node> m_root; 47 unsigned m_whatToShow; 48 RefPtr<NodeFilter> m_filter; 49 }; 52 50 53 51 } // namespace WebCore 54 55 #endif // Traversal_h -
trunk/Source/WebCore/html/HTMLPlugInElement.cpp
r196717 r199642 328 328 329 329 root->setResetStyleInheritance(true); 330 if (m_pluginReplacement->installReplacement( root)) {330 if (m_pluginReplacement->installReplacement(*root)) { 331 331 setDisplayState(DisplayingPluginReplacement); 332 332 setNeedsStyleRecalc(ReconstructRenderTree); -
trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp
r199619 r199642 1497 1497 InjectedScript injectedScript = m_injectedScriptManager.injectedScriptFor(state); 1498 1498 if (!injectedScript.hasNoValue()) 1499 value->setHandler(injectedScript.wrapObject( Deprecated::ScriptValue(state->vm(), handler), *objectGroupId));1499 value->setHandler(injectedScript.wrapObject(handler, *objectGroupId)); 1500 1500 } 1501 1501 if (!scriptID.isNull()) { -
trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp
r199619 r199642 69 69 void disconnect() 70 70 { 71 m_frontendApiObject = Deprecated::ScriptObject();71 m_frontendApiObject = { }; 72 72 m_frontendHost = nullptr; 73 73 } -
trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp
r199323 r199642 59 59 #include "InspectorPageAgent.h" 60 60 #include "InstrumentingAgents.h" 61 #include "ScriptState.h" 61 62 #include "SecurityOrigin.h" 62 63 #include <inspector/InjectedScript.h> -
trunk/Source/WebCore/inspector/InspectorInstrumentation.h
r198786 r199642 30 30 */ 31 31 32 #ifndef InspectorInstrumentation_h 33 #define InspectorInstrumentation_h 32 #pragma once 34 33 35 34 #include "CSSSelector.h" … … 42 41 #include "Page.h" 43 42 #include "ScriptExecutionContext.h" 44 #include "ScriptState.h"45 43 #include "StorageArea.h" 46 44 #include "WebSocketFrame.h" … … 254 252 static void didSendWebSocketFrame(Document*, unsigned long identifier, const WebSocketFrame&); 255 253 static void didReceiveWebSocketFrameError(Document*, unsigned long identifier, const String& errorMessage); 256 #endif257 258 static Deprecated::ScriptObject wrapCanvas2DRenderingContextForInstrumentation(Document*, const Deprecated::ScriptObject&);259 #if ENABLE(WEBGL)260 static Deprecated::ScriptObject wrapWebGLRenderingContextForInstrumentation(Document*, const Deprecated::ScriptObject&);261 254 #endif 262 255 … … 1293 1286 1294 1287 } // namespace WebCore 1295 1296 #endif // !defined(InspectorInstrumentation_h) -
trunk/Source/WebCore/page/DOMWindow.cpp
r199112 r199642 145 145 class PostMessageTimer : public TimerBase { 146 146 public: 147 PostMessageTimer(DOMWindow * window, PassRefPtr<SerializedScriptValue> message, const String& sourceOrigin, PassRefPtr<DOMWindow> source, std::unique_ptr<MessagePortChannelArray> channels, SecurityOrigin* targetOrigin, PassRefPtr<ScriptCallStack>stackTrace)147 PostMessageTimer(DOMWindow& window, PassRefPtr<SerializedScriptValue> message, const String& sourceOrigin, DOMWindow& source, std::unique_ptr<MessagePortChannelArray> channels, RefPtr<SecurityOrigin>&& targetOrigin, RefPtr<ScriptCallStack>&& stackTrace) 148 148 : m_window(window) 149 149 , m_message(message) … … 151 151 , m_source(source) 152 152 , m_channels(WTFMove(channels)) 153 , m_targetOrigin( targetOrigin)153 , m_targetOrigin(WTFMove(targetOrigin)) 154 154 , m_stackTrace(stackTrace) 155 155 { 156 156 } 157 157 158 Ref<MessageEvent> event(ScriptExecutionContext *context)158 Ref<MessageEvent> event(ScriptExecutionContext& context) 159 159 { 160 std::unique_ptr<MessagePortArray> messagePorts = MessagePort::entanglePorts(*context, WTFMove(m_channels)); 161 return MessageEvent::create(WTFMove(messagePorts), m_message, m_origin, String(), m_source); 160 return MessageEvent::create(MessagePort::entanglePorts(context, WTFMove(m_channels)), WTFMove(m_message), m_origin, { }, m_source.ptr()); 162 161 } 163 162 SecurityOrigin* targetOrigin() const { return m_targetOrigin.get(); } … … 172 171 } 173 172 174 Ref Ptr<DOMWindow> m_window;173 Ref<DOMWindow> m_window; 175 174 RefPtr<SerializedScriptValue> m_message; 176 175 String m_origin; 177 Ref Ptr<DOMWindow> m_source;176 Ref<DOMWindow> m_source; 178 177 std::unique_ptr<MessagePortChannelArray> m_channels; 179 178 RefPtr<SecurityOrigin> m_targetOrigin; … … 900 899 } 901 900 902 std::unique_ptr<MessagePortChannelArray>channels = MessagePort::disentanglePorts(ports, ec);901 auto channels = MessagePort::disentanglePorts(ports, ec); 903 902 if (ec) 904 903 return; … … 916 915 917 916 // Schedule the message. 918 PostMessageTimer* timer = new PostMessageTimer( this, message, sourceOrigin, &source, WTFMove(channels), target.get(), stackTrace.release());917 PostMessageTimer* timer = new PostMessageTimer(*this, message, sourceOrigin, source, WTFMove(channels), WTFMove(target), WTFMove(stackTrace)); 919 918 timer->startOneShot(0); 920 919 } … … 925 924 return; 926 925 927 dispatchMessageEventWithOriginCheck(timer.targetOrigin(), timer.event( document()), timer.stackTrace());926 dispatchMessageEventWithOriginCheck(timer.targetOrigin(), timer.event(*document()), timer.stackTrace()); 928 927 } 929 928 -
trunk/Source/WebCore/page/EventSource.cpp
r196400 r199642 414 414 Ref<MessageEvent> EventSource::createMessageEvent() 415 415 { 416 return MessageEvent::create(m_eventName.isEmpty() ? eventNames().messageEvent : AtomicString(m_eventName), false, false,SerializedScriptValue::create(String::adopt(m_data)), m_eventStreamOrigin, m_lastEventId);416 return MessageEvent::create(m_eventName.isEmpty() ? eventNames().messageEvent : AtomicString(m_eventName), SerializedScriptValue::create(String::adopt(m_data)), m_eventStreamOrigin, m_lastEventId); 417 417 } 418 418 -
trunk/Source/WebCore/page/csp/ContentSecurityPolicy.h
r199612 r199642 25 25 */ 26 26 27 #ifndef ContentSecurityPolicy_h 28 #define ContentSecurityPolicy_h 27 #pragma once 29 28 30 29 #include "ContentSecurityPolicyResponseHeaders.h" 31 #include "ScriptState.h"32 30 #include <wtf/OptionSet.h> 33 31 #include <wtf/Vector.h> 34 32 #include <wtf/text/TextPosition.h> 33 34 namespace JSC { 35 class ExecState; 36 } 35 37 36 38 namespace WTF { … … 44 46 class ContentSecurityPolicySource; 45 47 class DOMStringList; 48 class Frame; 46 49 class JSDOMWindowShell; 47 50 class ScriptExecutionContext; … … 185 188 186 189 } 187 188 #endif -
trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.h
r199612 r199642 25 25 */ 26 26 27 #ifndef ContentSecurityPolicyDirectiveList_h 28 #define ContentSecurityPolicyDirectiveList_h 27 #pragma once 29 28 30 29 #include "ContentSecurityPolicy.h" … … 33 32 #include "ContentSecurityPolicySourceListDirective.h" 34 33 #include "URL.h" 35 #include <wtf/Noncopyable.h>36 34 37 35 namespace WebCore { 38 36 37 class Frame; 38 39 39 class ContentSecurityPolicyDirectiveList { 40 40 WTF_MAKE_FAST_ALLOCATED; 41 WTF_MAKE_NONCOPYABLE(ContentSecurityPolicyDirectiveList)42 41 public: 43 42 static std::unique_ptr<ContentSecurityPolicyDirectiveList> create(ContentSecurityPolicy&, const String&, ContentSecurityPolicyHeaderType, ContentSecurityPolicy::PolicyFrom); … … 126 125 127 126 } // namespace WebCore 128 129 #endif /* ContentSecurityPolicyDirectiveList_h */ -
trunk/Source/WebCore/testing/Internals.cpp
r199539 r199642 506 506 } 507 507 508 String Internals::description( Deprecated::ScriptValue value)509 { 510 return toString(value .jsValue());508 String Internals::description(JSC::JSValue value) 509 { 510 return toString(value); 511 511 } 512 512 … … 1492 1492 }; 1493 1493 1494 String Internals::parserMetaData( Deprecated::ScriptValue value)1494 String Internals::parserMetaData(JSC::JSValue code) 1495 1495 { 1496 1496 JSC::VM& vm = contextDocument()->vm(); 1497 1497 JSC::ExecState* exec = vm.topCallFrame; 1498 JSC::JSValue code = value.jsValue();1499 1498 ScriptExecutable* executable; 1500 1499 … … 2526 2525 RefPtr<ArrayBuffer> Internals::serializeObject(PassRefPtr<SerializedScriptValue> value) const 2527 2526 { 2528 Vector<uint8_t>bytes = value->data();2527 auto& bytes = value->data(); 2529 2528 return ArrayBuffer::create(bytes.data(), bytes.size()); 2530 2529 } … … 2537 2536 } 2538 2537 2539 bool Internals::isFromCurrentWorld(Deprecated::ScriptValue value) const 2540 { 2541 ASSERT(!value.hasNoValue()); 2542 2543 JSC::ExecState* exec = contextDocument()->vm().topCallFrame; 2544 if (!value.isObject() || &worldForDOMObject(value.jsValue().getObject()) == ¤tWorld(exec)) 2545 return true; 2546 return false; 2538 bool Internals::isFromCurrentWorld(JSC::JSValue value) const 2539 { 2540 ASSERT(value); 2541 JSC::ExecState& state = *contextDocument()->vm().topCallFrame; 2542 return !value.isObject() || &worldForDOMObject(asObject(value)) == ¤tWorld(&state); 2547 2543 } 2548 2544 … … 3282 3278 #if ENABLE(STREAMS_API) 3283 3279 3284 bool Internals::isReadableStreamDisturbed( ScriptState& state, JSValue stream)3280 bool Internals::isReadableStreamDisturbed(JSC::ExecState& state, JSValue stream) 3285 3281 { 3286 3282 JSGlobalObject* globalObject = state.vmEntryGlobalObject(); -
trunk/Source/WebCore/testing/Internals.h
r199539 r199642 25 25 */ 26 26 27 #ifndef Internals_h 28 #define Internals_h 27 #pragma once 29 28 30 29 #include "CSSComputedStyleDeclaration.h" 31 30 #include "ContextDestructionObserver.h" 32 #include "ExceptionCodePlaceholder.h"33 #include "NodeList.h"34 31 #include "PageConsoleClient.h" 35 #include "ScriptState.h"36 #include <bindings/ScriptValue.h>37 #include <runtime/ArrayBuffer.h>38 32 #include <runtime/Float32Array.h> 39 #include <wtf/RefCounted.h>40 #include <wtf/text/WTFString.h>41 33 42 34 namespace WebCore { … … 66 58 class MockPageOverlay; 67 59 class Node; 60 class NodeList; 68 61 class Page; 69 62 class Range; … … 78 71 typedef int ExceptionCode; 79 72 80 class Internals : public RefCounted<Internals>, publicContextDestructionObserver {73 class Internals final : public RefCounted<Internals>, private ContextDestructionObserver { 81 74 public: 82 75 static Ref<Internals> create(Document&); … … 91 84 bool nodeNeedsStyleRecalc(Node&); 92 85 String styleChangeType(Node&); 93 String description( Deprecated::ScriptValue);86 String description(JSC::JSValue); 94 87 95 88 bool isPreloaded(const String& url); … … 209 202 unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent, ExceptionCode&) const; 210 203 211 String parserMetaData( Deprecated::ScriptValue = Deprecated::ScriptValue());204 String parserMetaData(JSC::JSValue = { }); 212 205 213 206 void updateEditorUINowIfScheduled(); … … 292 285 293 286 int numberOfPages(float pageWidthInPixels = 800, float pageHeightInPixels = 600); 294 String pageProperty(String, int, ExceptionCode& = ASSERT_NO_EXCEPTION) const;295 String pageSizeAndMarginsInPixels(int, int, int, int, int, int, int, ExceptionCode& = ASSERT_NO_EXCEPTION) const;287 String pageProperty(String, int, ExceptionCode&) const; 288 String pageSizeAndMarginsInPixels(int, int, int, int, int, int, int, ExceptionCode&) const; 296 289 297 290 void setPageScaleFactor(float scaleFactor, int x, int y, ExceptionCode&); … … 345 338 RefPtr<SerializedScriptValue> deserializeBuffer(ArrayBuffer&) const; 346 339 347 bool isFromCurrentWorld( Deprecated::ScriptValue) const;340 bool isFromCurrentWorld(JSC::JSValue) const; 348 341 349 342 void setUsesOverlayScrollbars(bool); … … 473 466 474 467 #if ENABLE(STREAMS_API) 475 bool isReadableStreamDisturbed( ScriptState&, JSC::JSValue);468 bool isReadableStreamDisturbed(JSC::ExecState&, JSC::JSValue); 476 469 #endif 477 470 … … 491 484 492 485 } // namespace WebCore 493 494 #endif
Note:
See TracChangeset
for help on using the changeset viewer.