Reviewed by Andreas Kling.
m_script is never NULL so we can just return a reference. Also remove some pointless null
checks as a result of doing this.
Source/WebCore:
* Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::connect):
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::toJS):
(WebCore::toJSDOMWindow):
* bindings/js/JSDOMWindowShell.cpp:
(WebCore::toJS):
(WebCore::toJSDOMWindowShell):
* bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::handleEvent):
* bindings/js/JSLazyEventListener.cpp:
(WebCore::JSLazyEventListener::initializeJSFunction):
* bindings/js/PageScriptDebugServer.cpp:
(WebCore::PageScriptDebugServer::setJavaScriptPaused):
* bindings/js/ScheduledAction.cpp:
(WebCore::ScheduledAction::execute):
* bindings/js/ScriptCachedFrameData.cpp:
(WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
(WebCore::ScriptCachedFrameData::restore):
* bindings/js/ScriptEventListener.cpp:
(WebCore::createAttributeEventListener):
(WebCore::eventListenerHandlerScriptState):
* bindings/js/ScriptState.cpp:
(WebCore::mainWorldScriptState):
(WebCore::scriptStateFromNode):
(WebCore::scriptStateFromPage):
* bindings/objc/DOM.mm:
(-[DOMNode JSC::Bindings::]):
* bindings/objc/DOMInternal.mm:
(-[WebScriptObject _initializeScriptDOMNodeImp]):
* dom/Document.cpp:
(WebCore::Document::disableEval):
(WebCore::Document::ensurePlugInsInjectedScript):
* dom/ScriptElement.cpp:
(WebCore::ScriptElement::prepareScript):
(WebCore::ScriptElement::executeScript):
* history/CachedFrame.cpp:
(WebCore::CachedFrameBase::restore):
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::createRenderer):
* html/HTMLElement.cpp:
(WebCore::HTMLElement::rendererIsNeeded):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::controls):
* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::getInstance):
(WebCore::HTMLPlugInElement::getNPObject):
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot):
* html/parser/HTMLParserOptions.cpp:
(WebCore::HTMLParserOptions::HTMLParserOptions):
* inspector/InspectorAgent.cpp:
(WebCore::InspectorAgent::didClearWindowObjectInWorld):
* inspector/InspectorClient.cpp:
(WebCore::InspectorClient::doDispatchMessageOnFrontendPage):
* inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::evaluateAsBoolean):
(WebCore::InspectorFrontendClientLocal::evaluateOnLoad):
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::evaluateInOverlay):
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::getScriptExecutionStatus):
(WebCore::InspectorPageAgent::didClearWindowObjectInWorld):
* inspector/PageRuntimeAgent.cpp:
(WebCore::PageRuntimeAgent::reportExecutionContextCreation):
* loader/DocumentWriter.cpp:
(WebCore::DocumentWriter::begin):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::urlSelected):
(WebCore::FrameLoader::submitForm):
(WebCore::FrameLoader::cancelAndClear):
(WebCore::FrameLoader::clear):
(WebCore::FrameLoader::prepareForCachedPageRestore):
(WebCore::FrameLoader::dispatchDidClearWindowObjectsInAllWorlds):
(WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
* loader/SubframeLoader.cpp:
(WebCore::SubframeLoader::requestFrame):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::canRequest):
* page/EventSource.cpp:
(WebCore::EventSource::create):
* page/Frame.cpp:
(WebCore::Frame::willDetachPage):
* page/Frame.h:
(WebCore::Frame::script):
* page/Navigator.cpp:
(WebCore::shouldHideFourDot):
* page/Page.cpp:
(WebCore::Page::setDebugger):
* platform/graphics/wince/MediaPlayerProxy.cpp:
(WebCore::WebMediaPlayerProxy::pluginInstance):
(WebCore::WebMediaPlayerProxy::invokeMethod):
* plugins/PluginView.cpp:
(WebCore::PluginView::~PluginView):
(WebCore::PluginView::performRequest):
(WebCore::PluginView::load):
(WebCore::PluginView::bindingInstance):
(WebCore::PluginView::getValue):
* plugins/efl/PluginViewEfl.cpp:
(WebCore::PluginView::platformGetValue):
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::open):
* xml/XMLTreeViewer.cpp:
(WebCore::XMLTreeViewer::transformDocumentToTreeView):
Source/WebKit/blackberry:
* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::load):
(BlackBerry::WebKit::WebPagePrivate::executeJavaScript):
(BlackBerry::WebKit::WebPagePrivate::executeJavaScriptInIsolatedWorld):
(BlackBerry::WebKit::WebPage::executeJavaScriptFunction):
(BlackBerry::WebKit::WebPage::globalContext):
* WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
(WebCore::FrameLoaderClientBlackBerry::dispatchDidClearWindowObjectInWorld):
Source/WebKit/efl:
* WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
(DumpRenderTreeSupportEfl::evaluateScriptInIsolatedWorld):
(DumpRenderTreeSupportEfl::globalContextRefForFrame):
* WebCoreSupport/FrameLoaderClientEfl.cpp:
(WebCore::FrameLoaderClientEfl::dispatchDidClearWindowObjectInWorld):
* ewk/ewk_frame.cpp:
(ewk_frame_script_execute):
* ewk/ewk_view.cpp:
(ewk_view_js_object_add):
Source/WebKit/gtk:
* WebCoreSupport/FrameLoaderClientGtk.cpp:
(WebKit::FrameLoaderClient::dispatchDidClearWindowObjectInWorld):
* webkit/webkitwebframe.cpp:
(webkit_web_frame_get_global_context):
* webkit/webkitwebview.cpp:
(webkit_web_view_execute_script):
Source/WebKit/mac:
* Plugins/Hosted/NetscapePluginInstanceProxy.mm:
(WebKit::NetscapePluginInstanceProxy::cleanup):
(WebKit::NetscapePluginInstanceProxy::getWindowNPObject):
(WebKit::NetscapePluginInstanceProxy::getPluginElementNPObject):
(WebKit::NetscapePluginInstanceProxy::evaluate):
(WebKit::NetscapePluginInstanceProxy::invoke):
(WebKit::NetscapePluginInstanceProxy::invokeDefault):
(WebKit::NetscapePluginInstanceProxy::construct):
(WebKit::NetscapePluginInstanceProxy::getProperty):
(WebKit::NetscapePluginInstanceProxy::setProperty):
(WebKit::NetscapePluginInstanceProxy::removeProperty):
(WebKit::NetscapePluginInstanceProxy::hasProperty):
(WebKit::NetscapePluginInstanceProxy::hasMethod):
(WebKit::NetscapePluginInstanceProxy::enumerate):
(WebKit::NetscapePluginInstanceProxy::demarshalValueFromArray):
* Plugins/WebNetscapePluginView.mm:
(-[WebNetscapePluginView getVariable:value:]):
(-[WebNetscapePluginView _destroyPlugin]):
* Plugins/WebPluginController.mm:
* WebCoreSupport/WebFrameLoaderClient.mm:
* WebCoreSupport/WebInspectorClient.mm:
(WebInspectorFrontendClient::save):
(WebInspectorFrontendClient::append):
* WebView/WebFrame.mm:
(-[WebFrame _attachScriptDebugger]):
(-[WebFrame _stringByEvaluatingJavaScriptFromString:forceUserGesture:]):
(-[WebFrame _stringByEvaluatingJavaScriptFromString:withGlobalObject:inScriptWorld:]):
(-[WebFrame _globalContextForScriptWorld:]):
(-[WebFrame jsWrapperForNode:inScriptWorld:]):
(-[WebFrame windowObject]):
(-[WebFrame globalContext]):
(-[WebFrame javaScriptContext]):
* WebView/WebScriptDebugger.mm:
(WebScriptDebugger::initGlobalCallFrame):
(WebScriptDebugger::callEvent):
* WebView/WebView.mm:
(-[WebView windowScriptObject]):
(-[WebView aeDescByEvaluatingJavaScriptFromString:]):
Source/WebKit/qt:
* Api/qwebelement.cpp:
(setupScriptContext):
(QWebElement::evaluateJavaScript):
* WebCoreSupport/DumpRenderTreeSupportQt.cpp:
(DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld):
* WebCoreSupport/QWebFrameAdapter.cpp:
(QWebFrameAdapter::evaluateJavaScript):
(QWebFrameAdapter::addToJavaScriptWindowObject):
Source/WebKit/win:
* WebFrame.cpp:
(WebFrame::globalContext):
(WebFrame::globalContextForScriptWorld):
(WebFrame::dispatchDidClearWindowObjectInWorld):
(WebFrame::stringByEvaluatingJavaScriptInScriptWorld):
* WebView.cpp:
(WebView::stringByEvaluatingJavaScriptFromString):
Source/WebKit2:
* WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
(WebKit::NPRuntimeObjectMap::globalObject):
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::performJavaScriptURLRequest):
(WebKit::PluginView::windowScriptNPObject):
(WebKit::PluginView::pluginElementNPObject):
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::jsContext):
(WebKit::WebFrame::jsContextForWorld):
(WebKit::WebFrame::jsWrapperForWorld):
* WebProcess/WebPage/WebInspector.cpp:
(WebKit::WebInspector::didSave):
(WebKit::WebInspector::didAppend):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::runJavaScriptInMainFrame):
Tools:
* DumpRenderTree/blackberry/DumpRenderTree.cpp:
(BlackBerry::WebKit::DumpRenderTree::resetToConsistentStateBeforeTesting):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154192
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2013-08-16 Pratik Solanki <psolanki@apple.com>
+
+ <https://webkit.org/b/119852> Frame::scriptController() should return a reference
+
+ Reviewed by Andreas Kling.
+
+ m_script is never NULL so we can just return a reference. Also remove some pointless null
+ checks as a result of doing this.
+
+ * Modules/websockets/WebSocket.cpp:
+ (WebCore::WebSocket::connect):
+ * bindings/js/JSDOMWindowBase.cpp:
+ (WebCore::toJS):
+ (WebCore::toJSDOMWindow):
+ * bindings/js/JSDOMWindowShell.cpp:
+ (WebCore::toJS):
+ (WebCore::toJSDOMWindowShell):
+ * bindings/js/JSEventListener.cpp:
+ (WebCore::JSEventListener::handleEvent):
+ * bindings/js/JSLazyEventListener.cpp:
+ (WebCore::JSLazyEventListener::initializeJSFunction):
+ * bindings/js/PageScriptDebugServer.cpp:
+ (WebCore::PageScriptDebugServer::setJavaScriptPaused):
+ * bindings/js/ScheduledAction.cpp:
+ (WebCore::ScheduledAction::execute):
+ * bindings/js/ScriptCachedFrameData.cpp:
+ (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
+ (WebCore::ScriptCachedFrameData::restore):
+ * bindings/js/ScriptEventListener.cpp:
+ (WebCore::createAttributeEventListener):
+ (WebCore::eventListenerHandlerScriptState):
+ * bindings/js/ScriptState.cpp:
+ (WebCore::mainWorldScriptState):
+ (WebCore::scriptStateFromNode):
+ (WebCore::scriptStateFromPage):
+ * bindings/objc/DOM.mm:
+ (-[DOMNode JSC::Bindings::]):
+ * bindings/objc/DOMInternal.mm:
+ (-[WebScriptObject _initializeScriptDOMNodeImp]):
+ * dom/Document.cpp:
+ (WebCore::Document::disableEval):
+ (WebCore::Document::ensurePlugInsInjectedScript):
+ * dom/ScriptElement.cpp:
+ (WebCore::ScriptElement::prepareScript):
+ (WebCore::ScriptElement::executeScript):
+ * history/CachedFrame.cpp:
+ (WebCore::CachedFrameBase::restore):
+ * html/HTMLCanvasElement.cpp:
+ (WebCore::HTMLCanvasElement::createRenderer):
+ * html/HTMLElement.cpp:
+ (WebCore::HTMLElement::rendererIsNeeded):
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::controls):
+ * html/HTMLPlugInElement.cpp:
+ (WebCore::HTMLPlugInElement::getInstance):
+ (WebCore::HTMLPlugInElement::getNPObject):
+ * html/HTMLPlugInImageElement.cpp:
+ (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot):
+ * html/parser/HTMLParserOptions.cpp:
+ (WebCore::HTMLParserOptions::HTMLParserOptions):
+ * inspector/InspectorAgent.cpp:
+ (WebCore::InspectorAgent::didClearWindowObjectInWorld):
+ * inspector/InspectorClient.cpp:
+ (WebCore::InspectorClient::doDispatchMessageOnFrontendPage):
+ * inspector/InspectorFrontendClientLocal.cpp:
+ (WebCore::InspectorFrontendClientLocal::evaluateAsBoolean):
+ (WebCore::InspectorFrontendClientLocal::evaluateOnLoad):
+ * inspector/InspectorOverlay.cpp:
+ (WebCore::InspectorOverlay::evaluateInOverlay):
+ * inspector/InspectorPageAgent.cpp:
+ (WebCore::InspectorPageAgent::getScriptExecutionStatus):
+ (WebCore::InspectorPageAgent::didClearWindowObjectInWorld):
+ * inspector/PageRuntimeAgent.cpp:
+ (WebCore::PageRuntimeAgent::reportExecutionContextCreation):
+ * loader/DocumentWriter.cpp:
+ (WebCore::DocumentWriter::begin):
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::urlSelected):
+ (WebCore::FrameLoader::submitForm):
+ (WebCore::FrameLoader::cancelAndClear):
+ (WebCore::FrameLoader::clear):
+ (WebCore::FrameLoader::prepareForCachedPageRestore):
+ (WebCore::FrameLoader::dispatchDidClearWindowObjectsInAllWorlds):
+ (WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
+ * loader/SubframeLoader.cpp:
+ (WebCore::SubframeLoader::requestFrame):
+ * loader/cache/CachedResourceLoader.cpp:
+ (WebCore::CachedResourceLoader::canRequest):
+ * page/EventSource.cpp:
+ (WebCore::EventSource::create):
+ * page/Frame.cpp:
+ (WebCore::Frame::willDetachPage):
+ * page/Frame.h:
+ (WebCore::Frame::script):
+ * page/Navigator.cpp:
+ (WebCore::shouldHideFourDot):
+ * page/Page.cpp:
+ (WebCore::Page::setDebugger):
+ * platform/graphics/wince/MediaPlayerProxy.cpp:
+ (WebCore::WebMediaPlayerProxy::pluginInstance):
+ (WebCore::WebMediaPlayerProxy::invokeMethod):
+ * plugins/PluginView.cpp:
+ (WebCore::PluginView::~PluginView):
+ (WebCore::PluginView::performRequest):
+ (WebCore::PluginView::load):
+ (WebCore::PluginView::bindingInstance):
+ (WebCore::PluginView::getValue):
+ * plugins/efl/PluginViewEfl.cpp:
+ (WebCore::PluginView::platformGetValue):
+ * xml/XMLHttpRequest.cpp:
+ (WebCore::XMLHttpRequest::open):
+ * xml/XMLTreeViewer.cpp:
+ (WebCore::XMLTreeViewer::transformDocumentToTreeView):
+
2013-08-16 Andreas Kling <akling@apple.com>
Attempt to fix the Qt/MountainLion build after r154142.
bool shouldBypassMainWorldContentSecurityPolicy = false;
if (scriptExecutionContext()->isDocument()) {
Document* document = toDocument(scriptExecutionContext());
- shouldBypassMainWorldContentSecurityPolicy = document->frame()->script()->shouldBypassMainWorldContentSecurityPolicy();
+ shouldBypassMainWorldContentSecurityPolicy = document->frame()->script().shouldBypassMainWorldContentSecurityPolicy();
}
if (!shouldBypassMainWorldContentSecurityPolicy && !scriptExecutionContext()->contentSecurityPolicy()->allowConnectToSource(m_url)) {
m_state = CLOSED;
Frame* frame = domWindow->frame();
if (!frame)
return jsNull();
- return frame->script()->windowShell(currentWorld(exec));
+ return frame->script().windowShell(currentWorld(exec));
}
JSDOMWindow* toJSDOMWindow(Frame* frame, DOMWrapperWorld* world)
{
if (!frame)
return 0;
- return frame->script()->windowShell(world)->window();
+ return frame->script().windowShell(world)->window();
}
JSDOMWindow* toJSDOMWindow(JSValue value)
{
if (!frame)
return jsNull();
- return frame->script()->windowShell(currentWorld(exec));
+ return frame->script().windowShell(currentWorld(exec));
}
JSDOMWindowShell* toJSDOMWindowShell(Frame* frame, DOMWrapperWorld* isolatedWorld)
{
if (!frame)
return 0;
- return frame->script()->windowShell(isolatedWorld);
+ return frame->script().windowShell(isolatedWorld);
}
} // namespace WebCore
if (!window->impl()->isCurrentlyDisplayedInFrame())
return;
// FIXME: Is this check needed for other contexts?
- ScriptController* script = window->impl()->frame()->script();
- if (!script->canExecuteScripts(AboutToExecuteScript) || script->isPaused())
+ ScriptController& script = window->impl()->frame()->script();
+ if (!script.canExecuteScripts(AboutToExecuteScript) || script.isPaused())
return;
}
if (!document->contentSecurityPolicy()->allowInlineEventHandlers(m_sourceURL, m_position.m_line))
return 0;
- ScriptController* script = document->frame()->script();
- if (!script->canExecuteScripts(AboutToExecuteScript) || script->isPaused())
+ ScriptController& script = document->frame()->script();
+ if (!script.canExecuteScripts(AboutToExecuteScript) || script.isPaused())
return 0;
JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(executionContext, isolatedWorld());
{
ASSERT_ARG(frame, frame);
- if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript))
+ if (!frame->script().canExecuteScripts(NotAboutToExecuteScript))
return;
- frame->script()->setPaused(paused);
+ frame->script().setPaused(paused);
Document* document = frame->document();
if (paused) {
return;
RefPtr<Frame> frame = window->impl()->frame();
- if (!frame || !frame->script()->canExecuteScripts(AboutToExecuteScript))
+ if (!frame || !frame->script().canExecuteScripts(AboutToExecuteScript))
return;
if (m_function)
executeFunctionInContext(window, window->shell(), document);
else
- frame->script()->executeScriptInWorld(m_isolatedWorld.get(), m_code);
+ frame->script().executeScriptInWorld(m_isolatedWorld.get(), m_code);
}
#if ENABLE(WORKERS)
{
JSLockHolder lock(JSDOMWindowBase::commonVM());
- ScriptController* scriptController = frame->script();
- ScriptController::ShellMap& windowShells = scriptController->m_windowShells;
+ ScriptController& scriptController = frame->script();
+ ScriptController::ShellMap& windowShells = scriptController.m_windowShells;
ScriptController::ShellMap::iterator windowShellsEnd = windowShells.end();
for (ScriptController::ShellMap::iterator iter = windowShells.begin(); iter != windowShellsEnd; ++iter) {
m_windows.add(iter->key.get(), Strong<JSDOMWindow>(window->vm(), window));
}
- scriptController->attachDebugger(0);
+ scriptController.attachDebugger(0);
}
ScriptCachedFrameData::~ScriptCachedFrameData()
{
JSLockHolder lock(JSDOMWindowBase::commonVM());
- ScriptController* scriptController = frame->script();
- ScriptController::ShellMap& windowShells = scriptController->m_windowShells;
+ ScriptController& scriptController = frame->script();
+ ScriptController::ShellMap& windowShells = scriptController.m_windowShells;
ScriptController::ShellMap::iterator windowShellsEnd = windowShells.end();
for (ScriptController::ShellMap::iterator iter = windowShells.begin(); iter != windowShellsEnd; ++iter) {
windowShell->setWindow(domWindow);
if (Page* page = frame->page()) {
- scriptController->attachDebugger(windowShell, page->debugger());
+ scriptController.attachDebugger(windowShell, page->debugger());
windowShell->window()->setProfileGroup(page->group().identifier());
}
}
// FIXME: We should be able to provide accurate source information for frameless documents, too (e.g. for importing nodes from XMLHttpRequest.responseXML).
if (Frame* frame = node->document()->frame()) {
- ScriptController* scriptController = frame->script();
- if (!scriptController->canExecuteScripts(AboutToExecuteScript))
+ ScriptController& scriptController = frame->script();
+ if (!scriptController.canExecuteScripts(AboutToExecuteScript))
return 0;
- position = scriptController->eventHandlerPosition();
+ position = scriptController.eventHandlerPosition();
sourceURL = node->document()->url().string();
}
if (value.isNull())
return 0;
- ScriptController* scriptController = frame->script();
- if (!scriptController->canExecuteScripts(AboutToExecuteScript))
+ ScriptController& scriptController = frame->script();
+ if (!scriptController.canExecuteScripts(AboutToExecuteScript))
return 0;
- TextPosition position = scriptController->eventHandlerPosition();
+ TextPosition position = scriptController.eventHandlerPosition();
String sourceURL = frame->document()->url().string();
JSObject* wrapper = toJSDOMWindow(frame, mainThreadNormalWorld());
return JSLazyEventListener::create(name.localName().string(), eventParameterName(frame->document()->isSVGDocument()), value, 0, sourceURL, position, wrapper, mainThreadNormalWorld());
ASSERT(jsListener);
if (!jsListener)
return 0;
- if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript))
+ if (!frame->script().canExecuteScripts(NotAboutToExecuteScript))
return 0;
DOMWrapperWorld* world = jsListener->isolatedWorld();
- return frame->script()->globalObject(world)->globalExec();
+ return frame->script().globalObject(world)->globalExec();
}
bool eventListenerHandlerLocation(Document* document, EventListener* eventListener, String& sourceName, String& scriptId, int& lineNumber)
{
if (!frame)
return 0;
- JSDOMWindowShell* shell = frame->script()->windowShell(mainThreadNormalWorld());
+ JSDOMWindowShell* shell = frame->script().windowShell(mainThreadNormalWorld());
return shell->window()->globalExec();
}
Frame* frame = document->frame();
if (!frame)
return 0;
- if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript))
+ if (!frame->script().canExecuteScripts(NotAboutToExecuteScript))
return 0;
- return frame->script()->globalObject(world)->globalExec();
+ return frame->script().globalObject(world)->globalExec();
}
ScriptState* scriptStateFromPage(DOMWrapperWorld* world, Page* page)
{
- return page->mainFrame()->script()->globalObject(world)->globalExec();
+ return page->mainFrame()->script().globalObject(world)->globalExec();
}
#if ENABLE(WORKERS)
WebCore::Frame* frame = core(self)->document()->frame();
if (!frame)
return 0;
- return frame->script()->bindingRootObject();
+ return frame->script().bindingRootObject();
}
@end
return;
// The global object which should own this node - FIXME: does this need to be isolated-world aware?
- WebCore::JSDOMGlobalObject* globalObject = frame->script()->globalObject(WebCore::mainThreadNormalWorld());
+ WebCore::JSDOMGlobalObject* globalObject = frame->script().globalObject(WebCore::mainThreadNormalWorld());
JSC::ExecState *exec = globalObject->globalExec();
// Get (or create) a cached JS object for the DOM node.
JSC::JSObject *scriptImp = asObject(WebCore::toJS(exec, globalObject, nodeImpl));
- JSC::Bindings::RootObject* rootObject = frame->script()->bindingRootObject();
+ JSC::Bindings::RootObject* rootObject = frame->script().bindingRootObject();
[self _setImp:scriptImp originRootObject:rootObject rootObject:rootObject];
}
if (!frame())
return;
- frame()->script()->disableEval(errorMessage);
+ frame()->script().disableEval(errorMessage);
}
bool Document::canNavigate(Frame* targetFrame)
if (!jsString)
jsString = plugInsJavaScript;
- page()->mainFrame()->script()->evaluateInWorld(ScriptSourceCode(jsString), world);
+ page()->mainFrame()->script().evaluateInWorld(ScriptSourceCode(jsString), world);
m_hasInjectedPlugInsScript = true;
}
if (!document->frame())
return false;
- if (!document->frame()->script()->canExecuteScripts(AboutToExecuteScript))
+ if (!document->frame()->script().canExecuteScripts(AboutToExecuteScript))
return false;
if (!isScriptForEventSupported())
// Create a script from the script element node, using the script
// block's source and the script block's type.
// Note: This is where the script is compiled and actually executed.
- frame->script()->evaluate(sourceCode);
+ frame->script().evaluate(sourceCode);
}
}
}
// It is necessary to update any platform script objects after restoring the
// cached page.
- frame.script()->updatePlatformScriptObjects();
+ frame.script().updatePlatformScriptObjects();
#if USE(ACCELERATED_COMPOSITING)
if (m_isComposited)
RenderObject* HTMLCanvasElement::createRenderer(RenderArena* arena, RenderStyle* style)
{
Frame* frame = document()->frame();
- if (frame && frame->script()->canExecuteScripts(NotAboutToExecuteScript)) {
+ if (frame && frame->script().canExecuteScripts(NotAboutToExecuteScript)) {
m_rendererIsCanvas = true;
return new (arena) RenderHTMLCanvas(this);
}
{
if (hasLocalName(noscriptTag)) {
Frame* frame = document()->frame();
- if (frame && frame->script()->canExecuteScripts(NotAboutToExecuteScript))
+ if (frame && frame->script().canExecuteScripts(NotAboutToExecuteScript))
return false;
} else if (hasLocalName(noembedTag)) {
Frame* frame = document()->frame();
Frame* frame = document()->frame();
// always show controls when scripting is disabled
- if (frame && !frame->script()->canExecuteScripts(NotAboutToExecuteScript))
+ if (frame && !frame->script().canExecuteScripts(NotAboutToExecuteScript))
return true;
// always show controls for video when fullscreen playback is required.
return m_instance;
if (Widget* widget = pluginWidget())
- m_instance = frame->script()->createScriptInstanceForWidget(widget);
+ m_instance = frame->script().createScriptInstanceForWidget(widget);
return m_instance;
}
{
ASSERT(document()->frame());
if (!m_NPObject)
- m_NPObject = document()->frame()->script()->createScriptObjectForPluginElement(this);
+ m_NPObject = document()->frame()->script().createScriptObjectForPluginElement(this);
return m_NPObject;
}
static DOMWrapperWorld* isolatedWorld = DOMWrapperWorld::create(JSDOMWindow::commonVM()).leakRef();
document()->ensurePlugInsInjectedScript(isolatedWorld);
- ScriptController* scriptController = page->mainFrame()->script();
- JSDOMGlobalObject* globalObject = JSC::jsCast<JSDOMGlobalObject*>(scriptController->globalObject(isolatedWorld));
+ ScriptController& scriptController = page->mainFrame()->script();
+ JSDOMGlobalObject* globalObject = JSC::jsCast<JSDOMGlobalObject*>(scriptController.globalObject(isolatedWorld));
JSC::ExecState* exec = globalObject->globalExec();
JSC::JSLockHolder lock(exec);
HTMLParserOptions::HTMLParserOptions(Document* document)
{
Frame* frame = document ? document->frame() : 0;
- scriptEnabled = frame && frame->script()->canExecuteScripts(NotAboutToExecuteScript);
+ scriptEnabled = frame && frame->script().canExecuteScripts(NotAboutToExecuteScript);
pluginsEnabled = frame && frame->loader().subframeLoader()->allowPlugins(NotAboutToInstantiatePlugin);
Settings* settings = document ? document->settings() : 0;
scriptSource.append("(");
scriptSource.appendNumber(injectedScriptId);
scriptSource.append(")");
- frame->script()->executeScript(scriptSource.toString());
+ frame->script().executeScript(scriptSource.toString());
}
void InspectorAgent::setFrontend(InspectorFrontend* inspectorFrontend)
if (!frame)
return false;
- ScriptController* scriptController = frame->script();
- if (!scriptController)
- return false;
-
String dispatchToFrontend = "InspectorFrontendAPI.dispatchMessageAsync(" + message + ");";
// FIXME: This should execute the script in the appropriate world.
- scriptController->evaluate(ScriptSourceCode(dispatchToFrontend));
+ frame->script().evaluate(ScriptSourceCode(dispatchToFrontend));
return true;
}
{
if (!m_frontendPage->mainFrame())
return false;
- ScriptValue value = m_frontendPage->mainFrame()->script()->executeScript(expression);
+ ScriptValue value = m_frontendPage->mainFrame()->script().executeScript(expression);
return value.toString(mainWorldScriptState(m_frontendPage->mainFrame())) == "true";
}
void InspectorFrontendClientLocal::evaluateOnLoad(const String& expression)
{
if (m_frontendLoaded)
- m_frontendPage->mainFrame()->script()->executeScript("InspectorFrontendAPI.dispatch(" + expression + ")");
+ m_frontendPage->mainFrame()->script().executeScript("InspectorFrontendAPI.dispatch(" + expression + ")");
else
m_evaluateOnLoad.append(expression);
}
RefPtr<InspectorArray> command = InspectorArray::create();
command->pushString(method);
command->pushString(argument);
- overlayPage()->mainFrame()->script()->evaluate(ScriptSourceCode(makeString("dispatch(", command->toJSONString(), ")")));
+ overlayPage()->mainFrame()->script().evaluate(ScriptSourceCode(makeString("dispatch(", command->toJSONString(), ")")));
}
void InspectorOverlay::evaluateInOverlay(const String& method, PassRefPtr<InspectorValue> argument)
RefPtr<InspectorArray> command = InspectorArray::create();
command->pushString(method);
command->pushValue(argument);
- overlayPage()->mainFrame()->script()->evaluate(ScriptSourceCode(makeString("dispatch(", command->toJSONString(), ")")));
+ overlayPage()->mainFrame()->script().evaluate(ScriptSourceCode(makeString("dispatch(", command->toJSONString(), ")")));
}
void InspectorOverlay::freePage()
bool disabledInSettings = false;
Frame* frame = mainFrame();
if (frame) {
- disabledByScriptController = !frame->script()->canExecuteScripts(NotAboutToExecuteScript);
+ disabledByScriptController = !frame->script().canExecuteScripts(NotAboutToExecuteScript);
if (frame->settings())
disabledInSettings = !frame->settings()->isScriptEnabled();
}
for (InspectorObject::const_iterator it = scripts->begin(); it != end; ++it) {
String scriptText;
if (it->value->asString(&scriptText))
- frame->script()->executeScript(scriptText);
+ frame->script().executeScript(scriptText);
}
}
if (!m_scriptToEvaluateOnLoadOnce.isEmpty())
- frame->script()->executeScript(m_scriptToEvaluateOnLoadOnce);
+ frame->script().executeScript(m_scriptToEvaluateOnLoadOnce);
}
void InspectorPageAgent::domContentEventFired()
{
Vector<std::pair<ScriptState*, SecurityOrigin*> > isolatedContexts;
for (Frame* frame = m_inspectedPage->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
- if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript))
+ if (!frame->script().canExecuteScripts(NotAboutToExecuteScript))
continue;
String frameId = m_pageAgent->frameId(frame);
ScriptState* scriptState = mainWorldScriptState(frame);
notifyContextCreated(frameId, scriptState, 0, true);
- frame->script()->collectIsolatedContexts(isolatedContexts);
+ frame->script().collectIsolatedContexts(isolatedContexts);
if (isolatedContexts.isEmpty())
continue;
for (size_t i = 0; i< isolatedContexts.size(); i++)
clear();
if (!shouldReuseDefaultView)
- m_frame->script()->updatePlatformScriptObjects();
+ m_frame->script().updatePlatformScriptObjects();
m_frame->loader().setOutgoingReferrer(url);
m_frame->setDocument(document);
RefPtr<Frame> protect(m_frame);
FrameLoadRequest frameRequest(passedRequest);
- if (m_frame->script()->executeIfJavaScriptURL(frameRequest.resourceRequest().url(), shouldReplaceDocumentIfJavaScriptURL))
+ if (m_frame->script().executeIfJavaScriptURL(frameRequest.resourceRequest().url(), shouldReplaceDocumentIfJavaScriptURL))
return;
if (frameRequest.frameName().isEmpty())
if (!m_frame->document()->contentSecurityPolicy()->allowFormAction(KURL(submission->action())))
return;
m_isExecutingJavaScriptFormAction = true;
- m_frame->script()->executeIfJavaScriptURL(submission->action(), DoNotReplaceDocumentIfJavaScriptURL);
+ m_frame->script().executeIfJavaScriptURL(submission->action(), DoNotReplaceDocumentIfJavaScriptURL);
m_isExecutingJavaScriptFormAction = false;
return;
}
closeURL();
clear(m_frame->document(), false);
- m_frame->script()->updatePlatformScriptObjects();
+ m_frame->script().updatePlatformScriptObjects();
}
void FrameLoader::clear(Document* newDocument, bool clearWindowProperties, bool clearScriptObjects, bool clearFrameView)
if (clearWindowProperties) {
InspectorInstrumentation::frameWindowDiscarded(m_frame, m_frame->document()->domWindow());
m_frame->document()->domWindow()->resetUnlessSuspendedForPageCache();
- m_frame->script()->clearWindowShell(newDocument->domWindow(), m_frame->document()->inPageCache());
+ m_frame->script().clearWindowShell(newDocument->domWindow(), m_frame->document()->inPageCache());
}
m_frame->selection()->prepareForDestruction();
m_subframeLoader.clear();
if (clearScriptObjects)
- m_frame->script()->clearScriptObjects();
+ m_frame->script().clearScriptObjects();
- m_frame->script()->enableEval();
+ m_frame->script().enableEval();
m_frame->navigationScheduler()->clear();
closeURL();
// Delete old status bar messages (if it _was_ activated on last URL).
- if (m_frame->script()->canExecuteScripts(NotAboutToExecuteScript)) {
+ if (m_frame->script().canExecuteScripts(NotAboutToExecuteScript)) {
DOMWindow* window = m_frame->document()->domWindow();
window->setStatus(String());
window->setDefaultStatus(String());
void FrameLoader::dispatchDidClearWindowObjectsInAllWorlds()
{
- if (!m_frame->script()->canExecuteScripts(NotAboutToExecuteScript))
+ if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript))
return;
Vector<RefPtr<DOMWrapperWorld> > worlds;
void FrameLoader::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* world)
{
- if (!m_frame->script()->canExecuteScripts(NotAboutToExecuteScript) || !m_frame->script()->existingWindowShell(world))
+ if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript) || !m_frame->script().existingWindowShell(world))
return;
m_client->dispatchDidClearWindowObjectInWorld(world);
return false;
if (!scriptURL.isEmpty())
- frame->script()->executeIfJavaScriptURL(scriptURL);
+ frame->script().executeIfJavaScriptURL(scriptURL);
return true;
}
}
// FIXME: Convert this to check the isolated world's Content Security Policy once webkit.org/b/104520 is solved.
- bool shouldBypassMainWorldContentSecurityPolicy = (frame() && frame()->script()->shouldBypassMainWorldContentSecurityPolicy());
+ bool shouldBypassMainWorldContentSecurityPolicy = (frame() && frame()->script().shouldBypassMainWorldContentSecurityPolicy());
// Some types of resources can be loaded only from the same origin. Other
// types of resources, like Images, Scripts, and CSS, can be loaded from
bool shouldBypassMainWorldContentSecurityPolicy = false;
if (context->isDocument()) {
Document* document = toDocument(context);
- shouldBypassMainWorldContentSecurityPolicy = document->frame()->script()->shouldBypassMainWorldContentSecurityPolicy();
+ shouldBypassMainWorldContentSecurityPolicy = document->frame()->script().shouldBypassMainWorldContentSecurityPolicy();
}
if (!shouldBypassMainWorldContentSecurityPolicy && !context->contentSecurityPolicy()->allowConnectToSource(fullURL)) {
// FIXME: Should this be throwing an exception?
if (page() && page()->scrollingCoordinator() && m_view)
page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get());
- script()->clearScriptObjects();
- script()->updatePlatformScriptObjects();
+ script().clearScriptObjects();
+ script().updatePlatformScriptObjects();
}
void Frame::disconnectOwnerElement()
FrameSelection* selection() const;
FrameTree* tree() const;
AnimationController* animation() const;
- ScriptController* script();
+ ScriptController& script();
RenderView* contentRenderer() const; // Root of the render tree for the document contained in this frame.
RenderPart* ownerRenderer() const; // Renderer for the element that contains this frame.
return m_view.get();
}
- inline ScriptController* Frame::script()
+ inline ScriptController& Frame::script()
{
- return m_script.get();
+ return *m_script;
}
inline Document* Frame::document() const
// sites such as nwa.com -- the library thinks Safari is Netscape 4 if we don't do this!
static bool shouldHideFourDot(Frame* frame)
{
- const String* sourceURL = frame->script()->sourceURL();
+ const String* sourceURL = frame->script().sourceURL();
if (!sourceURL)
return false;
if (!(sourceURL->endsWith("/dqm_script.js") || sourceURL->endsWith("/dqm_loader.js") || sourceURL->endsWith("/tdqm_loader.js")))
m_debugger = debugger;
for (Frame* frame = m_mainFrame.get(); frame; frame = frame->tree()->traverseNext())
- frame->script()->attachDebugger(m_debugger);
+ frame->script().attachDebugger(m_debugger);
}
StorageNamespace* Page::sessionStorage(bool optionalCreate)
RenderWidget* renderWidget = static_cast<RenderWidget*>(element()->renderer());
if (renderWidget && renderWidget->widget())
- m_instance = frame->script()->createScriptInstanceForWidget(renderWidget->widget());
+ m_instance = frame->script().createScriptInstanceForWidget(renderWidget->widget());
}
return m_instance;
void WebMediaPlayerProxy::invokeMethod(const String& methodName)
{
Frame* frame = element()->document()->frame();
- RootObject *root = frame->script()->bindingRootObject();
+ RootObject* root = frame->script().bindingRootObject();
if (!root)
return;
ExecState *exec = root->globalObject()->globalExec();
platformDestroy();
- m_parentFrame->script()->cleanupScriptObjectsForPlugin(this);
+ m_parentFrame->script().cleanupScriptObjectsForPlugin(this);
if (m_plugin && !(m_plugin->quirks().contains(PluginQuirkDontUnloadPlugin)))
m_plugin->unload();
// Executing a script can cause the plugin view to be destroyed, so we keep a reference to it.
RefPtr<PluginView> protector(this);
- ScriptValue result = m_parentFrame->script()->executeScript(jsString, request->shouldAllowPopups());
+ ScriptValue result = m_parentFrame->script().executeScript(jsString, request->shouldAllowPopups());
if (targetFrameName.isNull()) {
String resultString;
- ScriptState* scriptState = m_parentFrame->script()->globalObject(pluginWorld())->globalExec();
+ ScriptState* scriptState = m_parentFrame->script().globalObject(pluginWorld())->globalExec();
CString cstr;
if (result.getString(scriptState, resultString))
cstr = resultString.utf8();
if (!jsString.isNull()) {
// Return NPERR_GENERIC_ERROR if JS is disabled. This is what Mozilla does.
- if (!m_parentFrame->script()->canExecuteScripts(NotAboutToExecuteScript))
+ if (!m_parentFrame->script().canExecuteScripts(NotAboutToExecuteScript))
return NPERR_GENERIC_ERROR;
// For security reasons, only allow JS requests to be made on the frame that contains the plug-in.
return 0;
}
- RefPtr<JSC::Bindings::RootObject> root = m_parentFrame->script()->createRootObject(this);
+ RefPtr<JSC::Bindings::RootObject> root = m_parentFrame->script().createRootObject(this);
RefPtr<JSC::Bindings::Instance> instance = JSC::Bindings::CInstance::create(object, root.release());
_NPN_ReleaseObject(object);
if (m_isJavaScriptPaused)
return NPERR_GENERIC_ERROR;
- NPObject* windowScriptObject = m_parentFrame->script()->windowScriptNPObject();
+ NPObject* windowScriptObject = m_parentFrame->script().windowScriptNPObject();
// Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
if (windowScriptObject)
return true;
}
- NPObject* windowScriptObject = m_parentFrame->script()->windowScriptNPObject();
+ NPObject* windowScriptObject = m_parentFrame->script().windowScriptNPObject();
// Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
if (windowScriptObject)
if (scriptExecutionContext()->isDocument()) {
Document* document = static_cast<Document*>(scriptExecutionContext());
if (document->frame())
- shouldBypassMainWorldContentSecurityPolicy = document->frame()->script()->shouldBypassMainWorldContentSecurityPolicy();
+ shouldBypassMainWorldContentSecurityPolicy = document->frame()->script().shouldBypassMainWorldContentSecurityPolicy();
}
if (!shouldBypassMainWorldContentSecurityPolicy && !scriptExecutionContext()->contentSecurityPolicy()->allowConnectToSource(url)) {
// FIXME: Should this be throwing an exception?
{
m_document->setIsViewSource(true);
String scriptString(reinterpret_cast<const char*>(XMLViewer_js), sizeof(XMLViewer_js));
- m_document->frame()->script()->evaluate(ScriptSourceCode(scriptString));
+ m_document->frame()->script().evaluate(ScriptSourceCode(scriptString));
String noStyleMessage("This XML file does not appear to have any style information associated with it. The document tree is shown below.");
- m_document->frame()->script()->evaluate(ScriptSourceCode("prepareWebKitXMLViewer('" + noStyleMessage + "');"));
+ m_document->frame()->script().evaluate(ScriptSourceCode("prepareWebKitXMLViewer('" + noStyleMessage + "');"));
String cssString(reinterpret_cast<const char*>(XMLViewer_css), sizeof(XMLViewer_css));
RefPtr<Text> text = m_document->createTextNode(cssString);
private:
virtual void performInternal(WebPagePrivate* webPagePrivate)
{
- webPagePrivate->m_mainFrame->script()->executeIfJavaScriptURL(webPagePrivate->m_cachedManualScript, DoNotReplaceDocumentIfJavaScriptURL);
+ webPagePrivate->m_mainFrame->script().executeIfJavaScriptURL(webPagePrivate->m_cachedManualScript, DoNotReplaceDocumentIfJavaScriptURL);
}
};
if (m_page->defersLoading())
m_deferredTasks.append(adoptPtr(new DeferredTaskLoadManualScript(this, kurl)));
else
- m_mainFrame->script()->executeIfJavaScriptURL(kurl, DoNotReplaceDocumentIfJavaScriptURL);
+ m_mainFrame->script().executeIfJavaScriptURL(kurl, DoNotReplaceDocumentIfJavaScriptURL);
return;
}
return true;
}
- ScriptValue result = m_mainFrame->script()->executeScript(script, false);
+ ScriptValue result = m_mainFrame->script().executeScript(script, false);
JSC::JSValue value = result.jsValue();
if (!value) {
returnType = JSException;
returnType = JSUndefined;
if (returnType == JSBoolean || returnType == JSNumber || returnType == JSString || returnType == JSObject) {
- JSC::ExecState* exec = m_mainFrame->script()->globalObject(mainThreadNormalWorld())->globalExec();
+ JSC::ExecState* exec = m_mainFrame->script().globalObject(mainThreadNormalWorld())->globalExec();
returnValue = result.toString(exec);
}
bool WebPagePrivate::executeJavaScriptInIsolatedWorld(const ScriptSourceCode& sourceCode, JavaScriptDataType& returnType, BlackBerry::Platform::String& returnValue)
{
if (!m_isolatedWorld)
- m_isolatedWorld = m_mainFrame->script()->createWorld();
+ m_isolatedWorld = m_mainFrame->script().createWorld();
// Use evaluateInWorld to avoid canExecuteScripts check.
- ScriptValue result = m_mainFrame->script()->evaluateInWorld(sourceCode, m_isolatedWorld.get());
+ ScriptValue result = m_mainFrame->script().evaluateInWorld(sourceCode, m_isolatedWorld.get());
JSC::JSValue value = result.jsValue();
if (!value) {
returnType = JSException;
returnType = JSUndefined;
if (returnType == JSBoolean || returnType == JSNumber || returnType == JSString || returnType == JSObject) {
- JSC::ExecState* exec = m_mainFrame->script()->globalObject(mainThreadNormalWorld())->globalExec();
+ JSC::ExecState* exec = m_mainFrame->script().globalObject(mainThreadNormalWorld())->globalExec();
returnValue = result.toString(exec);
}
return;
}
- JSC::Bindings::RootObject* root = d->m_mainFrame->script()->bindingRootObject();
+ JSC::Bindings::RootObject* root = d->m_mainFrame->script().bindingRootObject();
if (!root) {
returnValue.setType(JavaScriptVariant::Exception);
return;
for (unsigned i = 0; i < args.size(); ++i)
argListRef[i] = BlackBerryJavaScriptVariantToJSValueRef(ctx, args[i]);
- JSValueRef windowObjectValue = toRef(d->m_mainFrame->script()->globalObject(mainThreadNormalWorld()));
+ JSValueRef windowObjectValue = toRef(d->m_mainFrame->script().globalObject(mainThreadNormalWorld()));
JSObjectRef obj = JSValueToObject(ctx, windowObjectValue, 0);
JSObjectRef thisObject = obj;
for (unsigned i = 0; i < function.size(); ++i) {
if (!d->m_mainFrame)
return 0;
- return toGlobalRef(d->m_mainFrame->script()->globalObject(mainThreadNormalWorld())->globalExec());
+ return toGlobalRef(d->m_mainFrame->script().globalObject(mainThreadNormalWorld())->globalExec());
}
// Serialize only the members of HistoryItem which are needed by the client,
+2013-08-16 Pratik Solanki <psolanki@apple.com>
+
+ <https://webkit.org/b/119852> Frame::scriptController() should return a reference
+
+ Reviewed by Andreas Kling.
+
+ m_script is never NULL so we can just return a reference. Also remove some pointless null
+ checks as a result of doing this.
+
+ * Api/WebPage.cpp:
+ (BlackBerry::WebKit::WebPagePrivate::load):
+ (BlackBerry::WebKit::WebPagePrivate::executeJavaScript):
+ (BlackBerry::WebKit::WebPagePrivate::executeJavaScriptInIsolatedWorld):
+ (BlackBerry::WebKit::WebPage::executeJavaScriptFunction):
+ (BlackBerry::WebKit::WebPage::globalContext):
+ * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
+ (WebCore::FrameLoaderClientBlackBerry::dispatchDidClearWindowObjectInWorld):
+
2013-08-15 Anders Carlsson <andersca@apple.com>
<https://webkit.org/b/119859> Frame::loader() should return a reference
m_webPagePrivate->m_client->notifyWindowObjectCleared();
if (m_webPagePrivate->m_dumpRenderTree) {
- JSGlobalContextRef context = toGlobalRef(m_frame->script()->globalObject(mainThreadNormalWorld())->globalExec());
- JSObjectRef windowObject = toRef(m_frame->script()->globalObject(mainThreadNormalWorld()));
+ JSGlobalContextRef context = toGlobalRef(m_frame->script().globalObject(mainThreadNormalWorld())->globalExec());
+ JSObjectRef windowObject = toRef(m_frame->script().globalObject(mainThreadNormalWorld()));
ASSERT(windowObject);
m_webPagePrivate->m_dumpRenderTree->didClearWindowObjectInWorld(world, context, windowObject);
}
+2013-08-16 Pratik Solanki <psolanki@apple.com>
+
+ <https://webkit.org/b/119852> Frame::scriptController() should return a reference
+
+ Reviewed by Andreas Kling.
+
+ m_script is never NULL so we can just return a reference. Also remove some pointless null
+ checks as a result of doing this.
+
+ * WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
+ (DumpRenderTreeSupportEfl::evaluateScriptInIsolatedWorld):
+ (DumpRenderTreeSupportEfl::globalContextRefForFrame):
+ * WebCoreSupport/FrameLoaderClientEfl.cpp:
+ (WebCore::FrameLoaderClientEfl::dispatchDidClearWindowObjectInWorld):
+ * ewk/ewk_frame.cpp:
+ (ewk_frame_script_execute):
+ * ewk/ewk_view.cpp:
+ (ewk_view_js_object_add):
+
2013-08-15 Ryuan Choi <ryuan.choi@samsung.com>
[EFL] Unreviewed build fix after r154142 and r154144.
DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame);
// Comment from mac: Start off with some guess at a frame and a global object, we'll try to do better...!
- WebCore::JSDOMWindow* anyWorldGlobalObject = frame->script()->globalObject(WebCore::mainThreadNormalWorld());
+ WebCore::JSDOMWindow* anyWorldGlobalObject = frame->script().globalObject(WebCore::mainThreadNormalWorld());
// Comment from mac: The global object is probably a shell object? - if so, we know how to use this!
JSC::JSObject* globalObjectObj = toJS(globalObject);
{
DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, 0);
- return toGlobalRef(frame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec());
+ return toGlobalRef(frame->script().globalObject(WebCore::mainThreadNormalWorld())->globalExec());
}
void DumpRenderTreeSupportEfl::setMockScrollbarsEnabled(bool enable)
return;
Ewk_Window_Object_Cleared_Event event;
- event.context = toGlobalRef(coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec());
- event.windowObject = toRef(coreFrame->script()->globalObject(mainThreadNormalWorld()));
+ event.context = toGlobalRef(coreFrame->script().globalObject(mainThreadNormalWorld())->globalExec());
+ event.windowObject = toRef(coreFrame->script().globalObject(mainThreadNormalWorld()));
event.frame = m_frame;
evas_object_smart_callback_call(m_view, "window,object,cleared", &event);
EINA_SAFETY_ON_NULL_RETURN_VAL(script, 0);
WTF::String resultString;
- JSC::JSValue result = smartData->frame->script()->executeScript(WTF::String::fromUTF8(script), true).jsValue();
+ JSC::JSValue result = smartData->frame->script().executeScript(WTF::String::fromUTF8(script), true).jsValue();
if (!smartData->frame) // In case the script removed our frame from the page.
return 0;
if (!result || (!result.isBoolean() && !result.isString() && !result.isNumber()))
return 0;
- JSC::ExecState* exec = smartData->frame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec();
+ JSC::ExecState* exec = smartData->frame->script().globalObject(WebCore::mainThreadNormalWorld())->globalExec();
JSC::JSLockHolder lock(exec);
resultString = result.toString(exec)->value(exec);
return eina_stringshare_add(resultString.utf8().data());
WebCore::JSDOMWindow* window = toJSDOMWindow(priv->mainFrame, WebCore::mainThreadNormalWorld());
JSC::JSLockHolder lock(window->globalExec());
JSC::Bindings::RootObject* root;
- root = priv->mainFrame->script()->bindingRootObject();
+ root = priv->mainFrame->script().bindingRootObject();
if (!window) {
ERR("Warning: couldn't get window object");
+2013-08-16 Pratik Solanki <psolanki@apple.com>
+
+ <https://webkit.org/b/119852> Frame::scriptController() should return a reference
+
+ Reviewed by Andreas Kling.
+
+ m_script is never NULL so we can just return a reference. Also remove some pointless null
+ checks as a result of doing this.
+
+ * WebCoreSupport/FrameLoaderClientGtk.cpp:
+ (WebKit::FrameLoaderClient::dispatchDidClearWindowObjectInWorld):
+ * webkit/webkitwebframe.cpp:
+ (webkit_web_frame_get_global_context):
+ * webkit/webkitwebview.cpp:
+ (webkit_web_view_execute_script):
+
2013-08-15 Zan Dobersek <zdobersek@igalia.com>
Unreviewed GTK build fix for debug configurations.
// TODO: Consider using g_signal_has_handler_pending() to avoid the overhead
// when there are no handlers.
- JSGlobalContextRef context = toGlobalRef(coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec());
- JSObjectRef windowObject = toRef(coreFrame->script()->globalObject(mainThreadNormalWorld()));
+ JSGlobalContextRef context = toGlobalRef(coreFrame->script().globalObject(mainThreadNormalWorld())->globalExec());
+ JSObjectRef windowObject = toRef(coreFrame->script().globalObject(mainThreadNormalWorld()));
ASSERT(windowObject);
WebKitWebView* webView = getViewFromFrame(m_frame);
if (!coreFrame)
return 0;
- return toGlobalRef(coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec());
+ return toGlobalRef(coreFrame->script().globalObject(mainThreadNormalWorld())->globalExec());
}
/**
g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
g_return_if_fail(script);
- core(webView)->mainFrame()->script()->executeScript(String::fromUTF8(script), true);
+ core(webView)->mainFrame()->script().executeScript(String::fromUTF8(script), true);
}
/**
+2013-08-16 Pratik Solanki <psolanki@apple.com>
+
+ <https://webkit.org/b/119852> Frame::scriptController() should return a reference
+
+ Reviewed by Andreas Kling.
+
+ m_script is never NULL so we can just return a reference. Also remove some pointless null
+ checks as a result of doing this.
+
+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+ (WebKit::NetscapePluginInstanceProxy::cleanup):
+ (WebKit::NetscapePluginInstanceProxy::getWindowNPObject):
+ (WebKit::NetscapePluginInstanceProxy::getPluginElementNPObject):
+ (WebKit::NetscapePluginInstanceProxy::evaluate):
+ (WebKit::NetscapePluginInstanceProxy::invoke):
+ (WebKit::NetscapePluginInstanceProxy::invokeDefault):
+ (WebKit::NetscapePluginInstanceProxy::construct):
+ (WebKit::NetscapePluginInstanceProxy::getProperty):
+ (WebKit::NetscapePluginInstanceProxy::setProperty):
+ (WebKit::NetscapePluginInstanceProxy::removeProperty):
+ (WebKit::NetscapePluginInstanceProxy::hasProperty):
+ (WebKit::NetscapePluginInstanceProxy::hasMethod):
+ (WebKit::NetscapePluginInstanceProxy::enumerate):
+ (WebKit::NetscapePluginInstanceProxy::demarshalValueFromArray):
+ * Plugins/WebNetscapePluginView.mm:
+ (-[WebNetscapePluginView getVariable:value:]):
+ (-[WebNetscapePluginView _destroyPlugin]):
+ * Plugins/WebPluginController.mm:
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ * WebCoreSupport/WebInspectorClient.mm:
+ (WebInspectorFrontendClient::save):
+ (WebInspectorFrontendClient::append):
+ * WebView/WebFrame.mm:
+ (-[WebFrame _attachScriptDebugger]):
+ (-[WebFrame _stringByEvaluatingJavaScriptFromString:forceUserGesture:]):
+ (-[WebFrame _stringByEvaluatingJavaScriptFromString:withGlobalObject:inScriptWorld:]):
+ (-[WebFrame _globalContextForScriptWorld:]):
+ (-[WebFrame jsWrapperForNode:inScriptWorld:]):
+ (-[WebFrame windowObject]):
+ (-[WebFrame globalContext]):
+ (-[WebFrame javaScriptContext]):
+ * WebView/WebScriptDebugger.mm:
+ (WebScriptDebugger::initGlobalCallFrame):
+ (WebScriptDebugger::callEvent):
+ * WebView/WebView.mm:
+ (-[WebView windowScriptObject]):
+ (-[WebView aeDescByEvaluatingJavaScriptFromString:]):
+
2013-08-15 Anders Carlsson <andersca@apple.com>
<https://webkit.org/b/119859> Frame::loader() should return a reference
m_localObjects.clear();
if (Frame* frame = core([m_pluginView webFrame]))
- frame->script()->cleanupScriptObjectsForPlugin(m_pluginView);
+ frame->script().cleanupScriptObjectsForPlugin(m_pluginView);
ProxyInstanceSet instances;
instances.swap(m_instances);
if (!frame)
return false;
- if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript))
+ if (!frame->script().canExecuteScripts(NotAboutToExecuteScript))
objectID = 0;
else
- objectID = m_localObjects.idForObject(*pluginWorld()->vm(), frame->script()->windowShell(pluginWorld())->window());
+ objectID = m_localObjects.idForObject(*pluginWorld()->vm(), frame->script().windowShell(pluginWorld())->window());
return true;
}
if (!frame)
return false;
- if (JSObject* object = frame->script()->jsObjectForPluginElement([m_pluginView element]))
+ if (JSObject* object = frame->script().jsObjectForPluginElement([m_pluginView element]))
objectID = m_localObjects.idForObject(*pluginWorld()->vm(), object);
else
objectID = 0;
return false;
JSLockHolder lock(pluginWorld()->vm());
- Strong<JSGlobalObject> globalObject(*pluginWorld()->vm(), frame->script()->globalObject(pluginWorld()));
+ Strong<JSGlobalObject> globalObject(*pluginWorld()->vm(), frame->script().globalObject(pluginWorld()));
ExecState* exec = globalObject->globalExec();
UserGestureIndicator gestureIndicator(allowPopups ? DefinitelyProcessingUserGesture : PossiblyProcessingUserGesture);
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
+ ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec();
JSLockHolder lock(exec);
JSValue function = object->get(exec, methodName);
CallData callData;
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
+ ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec();
JSLockHolder lock(exec);
CallData callData;
CallType callType = object->methodTable()->getCallData(object, callData);
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
+ ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec();
JSLockHolder lock(exec);
ConstructData constructData;
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
+ ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec();
JSLockHolder lock(exec);
JSValue value = object->get(exec, propertyName);
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
+ ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec();
JSLockHolder lock(exec);
JSValue value = object->get(exec, propertyName);
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
+ ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec();
JSLockHolder lock(exec);
JSValue value = demarshalValue(exec, valueData, valueLength);
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
+ ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec();
JSLockHolder lock(exec);
JSValue value = demarshalValue(exec, valueData, valueLength);
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
+ ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec();
JSLockHolder lock(exec);
if (!object->hasProperty(exec, propertyName)) {
exec->clearException();
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
+ ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec();
JSLockHolder lock(exec);
if (!object->hasProperty(exec, propertyName)) {
exec->clearException();
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
+ ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec();
bool result = object->hasProperty(exec, propertyName);
exec->clearException();
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
+ ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec();
bool result = object->hasProperty(exec, propertyName);
exec->clearException();
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
+ ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec();
JSLockHolder lock(exec);
JSValue func = object->get(exec, methodName);
exec->clearException();
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
+ ExecState* exec = frame->script().globalObject(pluginWorld())->globalExec();
JSLockHolder lock(exec);
PropertyNameArray propertyNames(exec);
if (!frame)
return false;
- if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript))
+ if (!frame->script().canExecuteScripts(NotAboutToExecuteScript))
return false;
- RefPtr<RootObject> rootObject = frame->script()->createRootObject(m_pluginView);
+ RefPtr<RootObject> rootObject = frame->script().createRootObject(m_pluginView);
if (!rootObject)
return false;
case NPNVWindowNPObject:
{
Frame* frame = core([self webFrame]);
- NPObject* windowScriptObject = frame ? frame->script()->windowScriptNPObject() : 0;
+ NPObject* windowScriptObject = frame ? frame->script().windowScriptNPObject() : 0;
// Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugins/npruntime.html#browseraccess>
if (windowScriptObject)
LOG(Plugins, "NPP_Destroy: %d", npErr);
if (Frame* frame = core([self webFrame]))
- frame->script()->cleanupScriptObjectsForPlugin(self);
+ frame->script().cleanupScriptObjectsForPlugin(self);
free(plugin);
plugin = NULL;
#if ENABLE(NETSCAPE_PLUGIN_API)
if (Frame* frame = core([self webFrame]))
- frame->script()->cleanupScriptObjectsForPlugin(self);
+ frame->script().cleanupScriptObjectsForPlugin(self);
#endif
[pluginViews removeObject:view];
#if ENABLE(NETSCAPE_PLUGIN_API)
if (Frame* frame = core([self webFrame]))
- frame->script()->cleanupScriptObjectsForPlugin(self);
+ frame->script().cleanupScriptObjectsForPlugin(self);
#endif
[pluginViews removeObject:aView];
return;
Frame *frame = core(m_webFrame.get());
- ScriptController *script = frame->script();
+ ScriptController& script = frame->script();
#if JSC_OBJC_API_ENABLED
if (implementations->didCreateJavaScriptContextForFrameFunc) {
CallFrameLoadDelegate(implementations->didCreateJavaScriptContextForFrameFunc, webView, @selector(webView:didCreateJavaScriptContext:forFrame:),
- script->javaScriptContext(), m_webFrame.get());
+ script.javaScriptContext(), m_webFrame.get());
} else if (implementations->didClearWindowObjectForFrameFunc) {
#else
if (implementations->didClearWindowObjectForFrameFunc) {
#endif
CallFrameLoadDelegate(implementations->didClearWindowObjectForFrameFunc, webView, @selector(webView:didClearWindowObject:forFrame:),
- script->windowScriptObject(), m_webFrame.get());
+ script.windowScriptObject(), m_webFrame.get());
} else if (implementations->windowScriptObjectAvailableFunc) {
CallFrameLoadDelegate(implementations->windowScriptObjectAvailableFunc, webView, @selector(webView:windowScriptObjectAvailable:),
- script->windowScriptObject());
+ script.windowScriptObject());
}
if ([webView scriptDebugDelegate]) {
m_suggestedToActualURLMap.set(suggestedURLCopy, actualURL);
[contentCopy writeToURL:actualURL atomically:YES encoding:NSUTF8StringEncoding error:NULL];
- core([m_windowController webView])->mainFrame()->script()->executeScript([NSString stringWithFormat:@"InspectorFrontendAPI.savedURL(\"%@\")", actualURL.absoluteString]);
+ core([m_windowController webView])->mainFrame()->script().executeScript([NSString stringWithFormat:@"InspectorFrontendAPI.savedURL(\"%@\")", actualURL.absoluteString]);
};
if (!forceSaveDialog) {
[handle writeData:[content dataUsingEncoding:NSUTF8StringEncoding]];
[handle closeFile];
- core([m_windowController webView])->mainFrame()->script()->executeScript([NSString stringWithFormat:@"InspectorFrontendAPI.appendedToURL(\"%@\")", [actualURL absoluteString]]);
+ core([m_windowController webView])->mainFrame()->script().executeScript([NSString stringWithFormat:@"InspectorFrontendAPI.appendedToURL(\"%@\")", [actualURL absoluteString]]);
}
// MARK: -
- (void)_attachScriptDebugger
{
- ScriptController* scriptController = _private->coreFrame->script();
+ ScriptController& scriptController = _private->coreFrame->script();
// Calling ScriptController::globalObject() would create a window shell, and dispatch corresponding callbacks, which may be premature
// if the script debugger is attached before a document is created. These calls use the debuggerWorld(), we will need to pass a world
// to be able to debug isolated worlds.
- if (!scriptController->existingWindowShell(debuggerWorld()))
+ if (!scriptController.existingWindowShell(debuggerWorld()))
return;
- JSGlobalObject* globalObject = scriptController->globalObject(debuggerWorld());
+ JSGlobalObject* globalObject = scriptController.globalObject(debuggerWorld());
if (!globalObject)
return;
ASSERT(_private->coreFrame->document());
RetainPtr<WebFrame> protect(self); // Executing arbitrary JavaScript can destroy the frame.
- JSC::JSValue result = _private->coreFrame->script()->executeScript(string, forceUserGesture).jsValue();
+ JSC::JSValue result = _private->coreFrame->script().executeScript(string, forceUserGesture).jsValue();
if (!_private->coreFrame) // In case the script removed our frame from the page.
return @"";
if (!result || (!result.isBoolean() && !result.isString() && !result.isNumber()))
return @"";
- JSC::ExecState* exec = _private->coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec();
+ JSC::ExecState* exec = _private->coreFrame->script().globalObject(mainThreadNormalWorld())->globalExec();
JSC::JSLockHolder lock(exec);
return result.toWTFString(exec);
}
return @"";
// Start off with some guess at a frame and a global object, we'll try to do better...!
- JSDOMWindow* anyWorldGlobalObject = _private->coreFrame->script()->globalObject(mainThreadNormalWorld());
+ JSDOMWindow* anyWorldGlobalObject = _private->coreFrame->script().globalObject(mainThreadNormalWorld());
// The global object is probably a shell object? - if so, we know how to use this!
JSC::JSObject* globalObjectObj = toJS(globalObjectRef);
ASSERT(frame->document());
RetainPtr<WebFrame> webFrame(kit(frame)); // Running arbitrary JavaScript can destroy the frame.
- JSC::JSValue result = frame->script()->executeScriptInWorld(core(world), string, true).jsValue();
+ JSC::JSValue result = frame->script().executeScriptInWorld(core(world), string, true).jsValue();
if (!webFrame->_private->coreFrame) // In case the script removed our frame from the page.
return @"";
DOMWrapperWorld* coreWorld = core(world);
if (!coreWorld)
return 0;
- return toGlobalRef(coreFrame->script()->globalObject(coreWorld)->globalExec());
+ return toGlobalRef(coreFrame->script().globalObject(coreWorld)->globalExec());
}
#if JSC_OBJC_API_ENABLED
if (!coreFrame)
return 0;
- JSDOMWindow* globalObject = coreFrame->script()->globalObject(core(world));
+ JSDOMWindow* globalObject = coreFrame->script().globalObject(core(world));
JSC::ExecState* exec = globalObject->globalExec();
JSC::JSLockHolder lock(exec);
Frame* coreFrame = _private->coreFrame;
if (!coreFrame)
return 0;
- return coreFrame->script()->windowScriptObject();
+ return coreFrame->script().windowScriptObject();
}
- (JSGlobalContextRef)globalContext
Frame* coreFrame = _private->coreFrame;
if (!coreFrame)
return 0;
- return toGlobalRef(coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec());
+ return toGlobalRef(coreFrame->script().globalObject(mainThreadNormalWorld())->globalExec());
}
#if JSC_OBJC_API_ENABLED
Frame* coreFrame = _private->coreFrame;
if (!coreFrame)
return 0;
- return coreFrame->script()->javaScriptContext();
+ return coreFrame->script().javaScriptContext();
}
#endif
WebFrame *webFrame = toWebFrame(debuggerCallFrame.dynamicGlobalObject());
- m_topCallFrame = adoptNS([[WebScriptCallFrame alloc] _initWithGlobalObject:core(webFrame)->script()->windowScriptObject() debugger:this caller:m_topCallFrame.get() debuggerCallFrame:debuggerCallFrame]);
+ m_topCallFrame = adoptNS([[WebScriptCallFrame alloc] _initWithGlobalObject:core(webFrame)->script().windowScriptObject() debugger:this caller:m_topCallFrame.get() debuggerCallFrame:debuggerCallFrame]);
m_globalCallFrame = m_topCallFrame;
WebView *webView = [webFrame webView];
WebFrame *webFrame = toWebFrame(debuggerCallFrame.dynamicGlobalObject());
- m_topCallFrame = adoptNS([[WebScriptCallFrame alloc] _initWithGlobalObject:core(webFrame)->script()->windowScriptObject() debugger:this caller:m_topCallFrame.get() debuggerCallFrame:debuggerCallFrame]);
+ m_topCallFrame = adoptNS([[WebScriptCallFrame alloc] _initWithGlobalObject:core(webFrame)->script().windowScriptObject() debugger:this caller:m_topCallFrame.get() debuggerCallFrame:debuggerCallFrame]);
WebView *webView = [webFrame webView];
WebScriptDebugDelegateImplementationCache* implementations = WebViewGetScriptDebugDelegateImplementations(webView);
Frame* coreFrame = [self _mainCoreFrame];
if (!coreFrame)
return nil;
- return coreFrame->script()->windowScriptObject();
+ return coreFrame->script().windowScriptObject();
}
- (String)_userAgentString
return nil;
if (!coreFrame->document())
return nil;
- JSC::JSValue result = coreFrame->script()->executeScript(script, true).jsValue();
+ JSC::JSValue result = coreFrame->script().executeScript(script, true).jsValue();
if (!result) // FIXME: pass errors
return 0;
- JSLockHolder lock(coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec());
- return aeDescFromJSValue(coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec(), result);
+ JSLockHolder lock(coreFrame->script().globalObject(mainThreadNormalWorld())->globalExec());
+ return aeDescFromJSValue(coreFrame->script().globalObject(mainThreadNormalWorld())->globalExec(), result);
}
- (BOOL)canMarkAllTextMatches
return frameAdapter->apiHandle();
}
-static bool setupScriptContext(WebCore::Element* element, ScriptState*& state, ScriptController*& scriptController)
+static bool setupScriptContext(WebCore::Element* element, ScriptState*& state)
{
if (!element)
return false;
if (!frame)
return false;
- scriptController = frame->script();
- if (!scriptController)
- return false;
-
- state = scriptController->globalObject(mainThreadNormalWorld())->globalExec();
+ state = frame->script().globalObject(mainThreadNormalWorld())->globalExec();
if (!state)
return false;
return QVariant();
ScriptState* state = 0;
- ScriptController* scriptController = 0;
- if (!setupScriptContext(m_element, state, scriptController))
+ if (!setupScriptContext(m_element, state))
return QVariant();
JSC::JSLockHolder lock(state);
+2013-08-16 Pratik Solanki <psolanki@apple.com>
+
+ <https://webkit.org/b/119852> Frame::scriptController() should return a reference
+
+ Reviewed by Andreas Kling.
+
+ m_script is never NULL so we can just return a reference. Also remove some pointless null
+ checks as a result of doing this.
+
+ * Api/qwebelement.cpp:
+ (setupScriptContext):
+ (QWebElement::evaluateJavaScript):
+ * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
+ (DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld):
+ * WebCoreSupport/QWebFrameAdapter.cpp:
+ (QWebFrameAdapter::evaluateJavaScript):
+ (QWebFrameAdapter::addToJavaScriptWindowObject):
+
2013-08-15 Anders Carlsson <andersca@apple.com>
<https://webkit.org/b/119859> Frame::loader() should return a reference
WebCore::Frame* coreFrame = adapter->frame;
- ScriptController* proxy = coreFrame->script();
-
- if (!proxy)
- return;
- proxy->executeScriptInWorld(scriptWorld->world(), script, true);
+ ScriptController& proxy = coreFrame->script();
+ proxy.executeScriptInWorld(scriptWorld->world(), script, true);
}
void DumpRenderTreeSupportQt::addUserStyleSheet(QWebPageAdapter* adapter, const QString& sourceCode)
QVariant QWebFrameAdapter::evaluateJavaScript(const QString &scriptSource)
{
- ScriptController* scriptController = frame->script();
+ ScriptController& scriptController = frame->script();
QVariant rc;
- if (scriptController) {
- int distance = 0;
- ScriptValue value = scriptController->executeScript(ScriptSourceCode(scriptSource));
- JSC::ExecState* exec = scriptController->globalObject(mainThreadNormalWorld())->globalExec();
- JSValueRef* ignoredException = 0;
- exec->vm().apiLock().lock();
- JSValueRef valueRef = toRef(exec, value.jsValue());
- exec->vm().apiLock().unlock();
- rc = JSC::Bindings::convertValueToQVariant(toRef(exec), valueRef, QMetaType::Void, &distance, ignoredException);
- }
+ int distance = 0;
+ ScriptValue value = scriptController.executeScript(ScriptSourceCode(scriptSource));
+ JSC::ExecState* exec = scriptController.globalObject(mainThreadNormalWorld())->globalExec();
+ JSValueRef* ignoredException = 0;
+ exec->vm().apiLock().lock();
+ JSValueRef valueRef = toRef(exec, value.jsValue());
+ exec->vm().apiLock().unlock();
+ rc = JSC::Bindings::convertValueToQVariant(toRef(exec), valueRef, QMetaType::Void, &distance, ignoredException);
return rc;
}
JSDOMWindow* window = toJSDOMWindow(frame, mainThreadNormalWorld());
JSC::Bindings::RootObject* root;
if (valueOwnership == JSC::Bindings::QtInstance::QtOwnership)
- root = frame->script()->cacheableBindingRootObject();
+ root = frame->script().cacheableBindingRootObject();
else
- root = frame->script()->bindingRootObject();
+ root = frame->script().bindingRootObject();
if (!window) {
qDebug() << "Warning: couldn't get window object";
+2013-08-16 Pratik Solanki <psolanki@apple.com>
+
+ <https://webkit.org/b/119852> Frame::scriptController() should return a reference
+
+ Reviewed by Andreas Kling.
+
+ m_script is never NULL so we can just return a reference. Also remove some pointless null
+ checks as a result of doing this.
+
+ * WebFrame.cpp:
+ (WebFrame::globalContext):
+ (WebFrame::globalContextForScriptWorld):
+ (WebFrame::dispatchDidClearWindowObjectInWorld):
+ (WebFrame::stringByEvaluatingJavaScriptInScriptWorld):
+ * WebView.cpp:
+ (WebView::stringByEvaluatingJavaScriptFromString):
+
2013-08-16 Andreas Kling <akling@apple.com>
Windows build juice.
if (!coreFrame)
return 0;
- return toGlobalRef(coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec());
+ return toGlobalRef(coreFrame->script().globalObject(mainThreadNormalWorld())->globalExec());
}
JSGlobalContextRef WebFrame::globalContextForScriptWorld(IWebScriptWorld* iWorld)
if (!world)
return 0;
- return toGlobalRef(coreFrame->script()->globalObject(world->world())->globalExec());
+ return toGlobalRef(coreFrame->script().globalObject(world->world())->globalExec());
}
HRESULT STDMETHODCALLTYPE WebFrame::loadRequest(
if (world != mainThreadNormalWorld())
return;
- JSContextRef context = toRef(coreFrame->script()->globalObject(world)->globalExec());
- JSObjectRef windowObject = toRef(coreFrame->script()->globalObject(world));
+ JSContextRef context = toRef(coreFrame->script().globalObject(world)->globalExec());
+ JSObjectRef windowObject = toRef(coreFrame->script().globalObject(world));
ASSERT(windowObject);
if (FAILED(frameLoadDelegate->didClearWindowObject(d->webView, context, windowObject, this)))
String string = String(script, SysStringLen(script));
// Start off with some guess at a frame and a global object, we'll try to do better...!
- JSDOMWindow* anyWorldGlobalObject = coreFrame->script()->globalObject(mainThreadNormalWorld());
+ JSDOMWindow* anyWorldGlobalObject = coreFrame->script().globalObject(mainThreadNormalWorld());
// The global object is probably a shell object? - if so, we know how to use this!
JSC::JSObject* globalObjectObj = toJS(globalObjectRef);
// Get the frame frome the global object we've settled on.
Frame* frame = anyWorldGlobalObject->impl()->frame();
ASSERT(frame->document());
- JSValue result = frame->script()->executeScriptInWorld(world->world(), string, true).jsValue();
+ JSValue result = frame->script().executeScriptInWorld(world->world(), string, true).jsValue();
if (!frame) // In case the script removed our frame from the page.
return S_OK;
if (!coreFrame)
return E_FAIL;
- JSC::JSValue scriptExecutionResult = coreFrame->script()->executeScript(WTF::String(script), true).jsValue();
+ JSC::JSValue scriptExecutionResult = coreFrame->script().executeScript(WTF::String(script), true).jsValue();
if (!scriptExecutionResult)
return E_FAIL;
else if (scriptExecutionResult.isString()) {
- JSC::ExecState* exec = coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec();
+ JSC::ExecState* exec = coreFrame->script().globalObject(mainThreadNormalWorld())->globalExec();
JSC::JSLockHolder lock(exec);
*result = BString(scriptExecutionResult.getString(exec));
}
+2013-08-16 Pratik Solanki <psolanki@apple.com>
+
+ <https://webkit.org/b/119852> Frame::scriptController() should return a reference
+
+ Reviewed by Andreas Kling.
+
+ m_script is never NULL so we can just return a reference. Also remove some pointless null
+ checks as a result of doing this.
+
+ * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
+ (WebKit::NPRuntimeObjectMap::globalObject):
+ * WebProcess/Plugins/PluginView.cpp:
+ (WebKit::PluginView::performJavaScriptURLRequest):
+ (WebKit::PluginView::windowScriptNPObject):
+ (WebKit::PluginView::pluginElementNPObject):
+ * WebProcess/WebPage/WebFrame.cpp:
+ (WebKit::WebFrame::jsContext):
+ (WebKit::WebFrame::jsContextForWorld):
+ (WebKit::WebFrame::jsWrapperForWorld):
+ * WebProcess/WebPage/WebInspector.cpp:
+ (WebKit::WebInspector::didSave):
+ (WebKit::WebInspector::didAppend):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::runJavaScriptInMainFrame):
+
2013-08-16 Brady Eidson <beidson@apple.com>
(NetworkProcess) Sync XHRs should load using async ResourceHandles, not ResourceHandle::loadResourceSynchronously
if (!frame)
return 0;
- return frame->script()->globalObject(pluginWorld());
+ return frame->script().globalObject(pluginWorld());
}
ExecState* NPRuntimeObjectMap::globalExec() const
// Evaluate the JavaScript code. Note that running JavaScript here could cause the plug-in to be destroyed, so we
// grab references to the plug-in here.
RefPtr<Plugin> plugin = m_plugin;
- ScriptValue result = frame->script()->executeScript(jsString, request->allowPopups());
+ ScriptValue result = frame->script().executeScript(jsString, request->allowPopups());
// Check if evaluating the JavaScript destroyed the plug-in.
if (!plugin->controller())
if (!request->target().isNull())
return;
- ScriptState* scriptState = frame->script()->globalObject(pluginWorld())->globalExec();
+ ScriptState* scriptState = frame->script().globalObject(pluginWorld())->globalExec();
String resultString;
result.getString(scriptState, resultString);
if (!frame())
return 0;
- if (!frame()->script()->canExecuteScripts(NotAboutToExecuteScript)) {
+ if (!frame()->script().canExecuteScripts(NotAboutToExecuteScript)) {
// FIXME: Investigate if other browsers allow plug-ins to access JavaScript objects even if JavaScript is disabled.
return 0;
}
- return m_npRuntimeObjectMap.getOrCreateNPObject(*pluginWorld()->vm(), frame()->script()->windowShell(pluginWorld())->window());
+ return m_npRuntimeObjectMap.getOrCreateNPObject(*pluginWorld()->vm(), frame()->script().windowShell(pluginWorld())->window());
}
NPObject* PluginView::pluginElementNPObject()
if (!frame())
return 0;
- if (!frame()->script()->canExecuteScripts(NotAboutToExecuteScript)) {
+ if (!frame()->script().canExecuteScripts(NotAboutToExecuteScript)) {
// FIXME: Investigate if other browsers allow plug-ins to access JavaScript objects even if JavaScript is disabled.
return 0;
}
- JSObject* object = frame()->script()->jsObjectForPluginElement(m_pluginElement.get());
+ JSObject* object = frame()->script().jsObjectForPluginElement(m_pluginElement.get());
ASSERT(object);
return m_npRuntimeObjectMap.getOrCreateNPObject(*pluginWorld()->vm(), object);
JSGlobalContextRef WebFrame::jsContext()
{
- return toGlobalRef(m_coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec());
+ return toGlobalRef(m_coreFrame->script().globalObject(mainThreadNormalWorld())->globalExec());
}
JSGlobalContextRef WebFrame::jsContextForWorld(InjectedBundleScriptWorld* world)
{
- return toGlobalRef(m_coreFrame->script()->globalObject(world->coreWorld())->globalExec());
+ return toGlobalRef(m_coreFrame->script().globalObject(world->coreWorld())->globalExec());
}
bool WebFrame::handlesPageScaleGesture() const
if (!m_coreFrame)
return 0;
- JSDOMWindow* globalObject = m_coreFrame->script()->globalObject(world->coreWorld());
+ JSDOMWindow* globalObject = m_coreFrame->script().globalObject(world->coreWorld());
ExecState* exec = globalObject->globalExec();
JSLockHolder lock(exec);
if (!m_coreFrame)
return 0;
- JSDOMWindow* globalObject = m_coreFrame->script()->globalObject(world->coreWorld());
+ JSDOMWindow* globalObject = m_coreFrame->script().globalObject(world->coreWorld());
ExecState* exec = globalObject->globalExec();
JSLockHolder lock(exec);
void WebInspector::didSave(const String& url)
{
ASSERT(m_inspectorPage);
- m_inspectorPage->corePage()->mainFrame()->script()->executeScript(makeString("InspectorFrontendAPI.savedURL(\"", url, "\")"));
+ m_inspectorPage->corePage()->mainFrame()->script().executeScript(makeString("InspectorFrontendAPI.savedURL(\"", url, "\")"));
}
void WebInspector::didAppend(const String& url)
{
ASSERT(m_inspectorPage);
- m_inspectorPage->corePage()->mainFrame()->script()->executeScript(makeString("InspectorFrontendAPI.appendedToURL(\"", url, "\")"));
+ m_inspectorPage->corePage()->mainFrame()->script().executeScript(makeString("InspectorFrontendAPI.appendedToURL(\"", url, "\")"));
}
void WebInspector::attachedBottom()
CoreIPC::DataReference dataReference;
JSLockHolder lock(JSDOMWindow::commonVM());
- if (JSValue resultValue = m_mainFrame->coreFrame()->script()->executeScript(script, true).jsValue()) {
- if ((serializedResultValue = SerializedScriptValue::create(m_mainFrame->jsContext(), toRef(m_mainFrame->coreFrame()->script()->globalObject(mainThreadNormalWorld())->globalExec(), resultValue), 0)))
+ if (JSValue resultValue = m_mainFrame->coreFrame()->script().executeScript(script, true).jsValue()) {
+ if ((serializedResultValue = SerializedScriptValue::create(m_mainFrame->jsContext(), toRef(m_mainFrame->coreFrame()->script().globalObject(mainThreadNormalWorld())->globalExec(), resultValue), 0)))
dataReference = serializedResultValue->data();
}
+2013-08-16 Pratik Solanki <psolanki@apple.com>
+
+ <https://webkit.org/b/119852> Frame::scriptController() should return a reference
+
+ Reviewed by Andreas Kling.
+
+ m_script is never NULL so we can just return a reference. Also remove some pointless null
+ checks as a result of doing this.
+
+ * DumpRenderTree/blackberry/DumpRenderTree.cpp:
+ (BlackBerry::WebKit::DumpRenderTree::resetToConsistentStateBeforeTesting):
+
2013-08-15 Alexey Proskuryakov <ap@apple.com>
[WK2] NetworkProcess should use a temporary storage session for test
mainFrame->tree()->clearName();
mainFrame->loader()->setOpener(0);
// [WebKit bug #86899] Reset JS state settings.
- JSGlobalContextRef jsContext = toGlobalRef(mainFrame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec());
+ JSGlobalContextRef jsContext = toGlobalRef(mainFrame->script().globalObject(WebCore::mainThreadNormalWorld())->globalExec());
WebCoreTestSupport::resetInternalsObject(jsContext);
}
}