Ignore:
Timestamp:
Apr 15, 2016, 7:25:56 PM (9 years ago)
Author:
Darin Adler
Message:

Reduce use of Deprecated::ScriptXXX classes
https://bugs.webkit.org/show_bug.cgi?id=156632

Reviewed by Alex Christensen.

Source/JavaScriptCore:

  • bindings/ScriptFunctionCall.cpp:

(Deprecated::ScriptCallArgumentHandler::appendArgument): Deleted version that takes a Deprecated::ScriptValue.
(Deprecated::ScriptFunctionCall::call): Changed to return a JSValue.

  • bindings/ScriptFunctionCall.h: Updated for the above.
  • bindings/ScriptValue.cpp:

(Inspector::jsToInspectorValue): Moved from Deprecated namespace to Inspector namespace. Later, we should
move this to another source file in the inspector directory.
(Inspector::toInspectorValue): Added.
(Deprecated::ScriptValue::toInspectorValue): Updated for change to underlying function.

  • bindings/ScriptValue.h: Update for the above.
  • inspector/InjectedScript.cpp:

(Inspector::InjectedScript::evaluateOnCallFrame): Changed arguments and return values from
Deprecated::ScriptValue to JSC::JSValue.
(Inspector::InjectedScript::functionDetails): Ditto.
(Inspector::InjectedScript::wrapCallFrames): Ditto.
(Inspector::InjectedScript::wrapObject): Ditto.
(Inspector::InjectedScript::wrapTable): Ditto.
(Inspector::InjectedScript::previewValue): Ditto.
(Inspector::InjectedScript::setExceptionValue): Ditto.
(Inspector::InjectedScript::findObjectById): Ditto.
(Inspector::InjectedScript::inspectObject): Ditto.

  • inspector/InjectedScript.h: Ditto.
  • inspector/InjectedScriptBase.cpp:

(Inspector::InjectedScriptBase::callFunctionWithEvalEnabled): Ditto.
(Inspector::InjectedScriptBase::makeCall): Ditto.

  • inspector/InjectedScriptBase.h: Ditto.
  • inspector/InjectedScriptModule.cpp:

(Inspector::InjectedScriptModule::ensureInjected): Ditto.

  • inspector/ScriptDebugListener.h: Ditto.
  • inspector/ScriptDebugServer.cpp:

(Inspector::ScriptDebugServer::evaluateBreakpointAction): Ditto.
(Inspector::ScriptDebugServer::dispatchDidPause): Ditto.
(Inspector::ScriptDebugServer::dispatchBreakpointActionProbe): Ditto.
(Inspector::ScriptDebugServer::exceptionOrCaughtValue): Ditto.

  • inspector/ScriptDebugServer.h: Ditto.
  • inspector/agents/InspectorDebuggerAgent.cpp:

(Inspector::InspectorDebuggerAgent::buildExceptionPauseReason): Ditto.
(Inspector::InspectorDebuggerAgent::didPause): Ditto.
(Inspector::InspectorDebuggerAgent::breakpointActionProbe): Ditto.
(Inspector::InspectorDebuggerAgent::didContinue): Ditto.
(Inspector::InspectorDebuggerAgent::clearDebuggerBreakpointState): Ditto.

  • inspector/agents/InspectorDebuggerAgent.h: Ditto.
  • inspector/agents/InspectorHeapAgent.cpp:

(Inspector::InspectorHeapAgent::getPreview): Ditto.
(Inspector::InspectorHeapAgent::getRemoteObject): Ditto.

Source/WebCore:

  • Modules/mediastream/SDPProcessor.cpp: Removed unneeded include.
  • bindings/js/JSCommandLineAPIHostCustom.cpp:

(WebCore::JSCommandLineAPIHost::inspectedObject): Use JSValue.

  • bindings/js/JSCustomEventCustom.cpp:

(WebCore::JSCustomEvent::detail): Ditto.

  • bindings/js/ScriptController.cpp:

(WebCore::ScriptController::evaluateInWorld): Ditto.
(WebCore::ScriptController::evaluate): Ditto.
(WebCore::ScriptController::executeScriptInWorld): Ditto.
(WebCore::ScriptController::executeScript): Ditto.
(WebCore::ScriptController::executeIfJavaScriptURL): Ditto.

  • bindings/js/ScriptController.h: Ditto.
  • bindings/js/ScriptGlobalObject.cpp: Removed unused overload of set,

and unused remove and folded handleException function into its one call site.
(WebCore::ScriptGlobalObject::set): Take references instead of pointers.
(WebCore::ScriptGlobalObject::get): Use JSObject instead of Deprecated::ScriptObject.

  • bindings/js/ScriptGlobalObject.h: Updated for the above.
  • dom/CustomEvent.cpp:

(WebCore::CustomEvent::initCustomEvent): Take JSValue and ExecState instead of
Deprecated::ScriptValue.
(WebCore::CustomEvent::trySerializeDetail): Take a reference instead of a pointer.
Also removed an unneeded null check.

  • dom/CustomEvent.h: Use JSValue.
  • dom/CustomEvent.idl: Updated for the above.
  • html/HTMLMediaElement.cpp: Remove unneeded include.
  • inspector/CommandLineAPIHost.cpp:

(WebCore::CommandLineAPIHost::InspectableObject::get): Take reference instead of
pointer and return JSValue.

  • inspector/CommandLineAPIHost.h: Updated for the above.
  • inspector/InspectorDOMAgent.cpp:

(WebCore::InspectorDOMAgent::setDocument): Use "document" instead of "doc".
(WebCore::InspectorDOMAgent::setAttributesAsText): Omit redundant class name.
(WebCore::InspectorDOMAgent::focusNode): Ditto. Pass reference instead of pointer.
(WebCore::InspectorDOMAgent::undo): Ditto.
(WebCore::InspectorDOMAgent::redo): Ditto.
(WebCore::InspectorDOMAgent::nodeForObjectId): Stop using Deprecated::ScriptValue.
(WebCore::InspectorDOMAgent::resolveNode): Ditto.
(WebCore::InspectorDOMAgent::scriptValueAsNode): Removed unneeded isObject check,
which is already done by JSNode::toWrapped. Use JSValue.
(WebCore::InspectorDOMAgent::nodeAsScriptValue): Use JSValue.

  • inspector/InspectorDOMAgent.h: Updated for the above.
  • inspector/InspectorFrontendClientLocal.cpp:

(WebCore::InspectorFrontendClientLocal::windowObjectCleared): Use references instead of
pointers and removed unneeded local.
(WebCore::InspectorFrontendClientLocal::evaluateAsBoolean): More of the same.

  • inspector/InspectorFrontendHost.cpp:

(WebCore::InspectorFrontendHost::showContextMenu): Ditto.

  • inspector/InspectorTimelineAgent.cpp:

(WebCore::InspectorTimelineAgent::breakpointActionProbe): Updated to take
reference instead of pointer and JSValue instead of ScriptValue.

  • inspector/InspectorTimelineAgent.h: Ditto.
  • inspector/PageConsoleAgent.cpp: Ditto.
  • inspector/PageDebuggerAgent.cpp:

(WebCore::PageDebuggerAgent::breakpointActionLog): Ditto.

  • inspector/PageDebuggerAgent.h: Ditto.

Source/WebKit/mac:

  • WebView/WebFrame.mm:

(-[WebFrame _stringByEvaluatingJavaScriptFromString:forceUserGesture:]): Use references instead
of pointers.
(-[WebFrame _stringByEvaluatingJavaScriptFromString:withGlobalObject:inScriptWorld:]): Updated
since return value is a JSValue.

  • WebView/WebView.mm:

(-[WebView aeDescByEvaluatingJavaScriptFromString:]): Ditto.

Source/WebKit/win:

  • Plugins/PluginView.cpp:

(WebCore::PluginView::performRequest): Use JSValue.

  • WebFrame.cpp:

(WebFrame::stringByEvaluatingJavaScriptInScriptWorld): Ditto.

  • WebView.cpp:

(WebView::stringByEvaluatingJavaScriptFromString): Ditto.

Source/WebKit2:

  • WebProcess/Plugins/PluginView.cpp:

(WebKit::PluginView::performJavaScriptURLRequest): Use JSValue.

  • WebProcess/WebPage/WebInspectorUI.cpp:

(WebKit::WebInspectorUI::windowObjectCleared): Use references.

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::runJavaScriptInMainFrame): Use JSValue.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bindings/ScriptFunctionCall.cpp

    r197614 r199619  
    4949    }
    5050    m_arguments.append(argument.jsObject());
    51 }
    52 
    53 void ScriptCallArgumentHandler::appendArgument(const Deprecated::ScriptValue& argument)
    54 {
    55     m_arguments.append(argument.jsValue());
    5651}
    5752
     
    116111}
    117112
    118 Deprecated::ScriptValue ScriptFunctionCall::call(bool& hadException)
     113JSValue ScriptFunctionCall::call(bool& hadException)
    119114{
    120115    JSObject* thisObject = m_thisObject.jsObject();
     
    125120    if (m_exec->hadException()) {
    126121        hadException = true;
    127         return Deprecated::ScriptValue();
     122        return { };
    128123    }
    129124
     
    131126    CallType callType = getCallData(function, callData);
    132127    if (callType == CallType::None)
    133         return Deprecated::ScriptValue();
     128        return { };
    134129
    135130    JSValue result;
     
    143138        // Do not treat a terminated execution exception as having an exception. Just treat it as an empty result.
    144139        hadException = !isTerminatedExecutionException(exception);
    145         return Deprecated::ScriptValue();
     140        return { };
    146141    }
    147142
    148     return Deprecated::ScriptValue(m_exec->vm(), result);
     143    return result;
    149144}
    150145
    151 Deprecated::ScriptValue ScriptFunctionCall::call()
     146JSC::JSValue ScriptFunctionCall::call()
    152147{
    153     bool hadException = false;
     148    bool hadException;
    154149    return call(hadException);
    155150}
Note: See TracChangeset for help on using the changeset viewer.