void FrameLoaderClient::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* world) { if (world != mainThreadNormalWorld()) return; // Is this obsolete now? g_signal_emit_by_name(m_frame, "cleared"); Frame* coreFrame = core(m_frame); ASSERT(coreFrame); Settings* settings = coreFrame->settings(); if (!settings || !settings->isJavaScriptEnabled()) return; // 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())); ASSERT(windowObject); WebKitWebView* webView = getViewFromFrame(m_frame); g_signal_emit_by_name(webView, "window-object-cleared", m_frame, context, windowObject); // TODO: Re-attach debug clients if present. // The Win port has an example of how we might do this. }
JSGlobalContextRef WebFrame::jsContextForWorld(InjectedBundleScriptWorld* world) { #if 0 //CMP_ERROR_TODO InjectedBundle return toGlobalRef(m_coreFrame->script().globalObject(world->coreWorld())->globalExec()); #else return 0; #endif }
JSGlobalContextRef WebFrame::jsContext() { #if 0 //CMP_ERROR_TODO InjectedBundle return toGlobalRef(m_coreFrame->script().globalObject(mainThreadNormalWorld())->globalExec()); #else return 0; #endif }
JSGlobalContextRef DumpRenderTreeSupportEfl::globalContextRefForFrame(const Evas_Object* ewkFrame) { WebCore::Frame* coreFrame = EWKPrivate::coreFrame(ewkFrame); if (!coreFrame) return 0; return toGlobalRef(coreFrame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec()); }
void FrameLoaderClientWx::windowObjectCleared() { if (m_webView) { wxWebViewWindowObjectClearedEvent wkEvent(m_webView); Frame* coreFrame = m_webView->GetMainFrame()->GetFrame(); JSGlobalContextRef context = toGlobalRef(coreFrame->script()->globalObject()->globalExec()); JSObjectRef windowObject = toRef(coreFrame->script()->globalObject()); wkEvent.SetJSContext(context); wkEvent.SetWindowObject(windowObject); m_webView->GetEventHandler()->ProcessEvent(wkEvent); } }
void FrameLoaderClientWx::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* world) { if (world != mainThreadNormalWorld()) return; if (m_webView) { wxWebViewWindowObjectClearedEvent wkEvent(m_webView); Frame* coreFrame = m_webView->GetMainFrame()->GetFrame(); JSGlobalContextRef context = toGlobalRef(coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec()); JSObjectRef windowObject = toRef(coreFrame->script()->globalObject(mainThreadNormalWorld())); wkEvent.SetJSContext(context); wkEvent.SetWindowObject(windowObject); m_webView->GetEventHandler()->ProcessEvent(wkEvent); } }
void FrameLoaderClientBlackBerry::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* world) { if (world != mainThreadNormalWorld()) return; // Provide the extension object first in case the client or others want to use it. // FIXME: Conditionally attach extension object based on some flag or whether or not we // are browser or something else. attachExtensionObjectToFrame(m_frame, m_webPagePrivate->m_client); 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())); ASSERT(windowObject); m_webPagePrivate->m_dumpRenderTree->didClearWindowObjectInWorld(world, context, windowObject); } }
void FrameLoaderClientEfl::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld& world) { if (&world != &mainThreadNormalWorld()) return; Frame* coreFrame = EWKPrivate::coreFrame(m_frame); ASSERT(coreFrame); if (!coreFrame->settings().isScriptEnabled()) return; Ewk_Window_Object_Cleared_Event event; 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); #if ENABLE(NETSCAPE_PLUGIN_API) ewk_view_js_window_object_clear(m_view, m_frame); #endif }
JSGlobalContextRef WebFrame::jsContextForWorld(InjectedBundleScriptWorld* world) { return toGlobalRef(m_coreFrame->script().globalObject(world->coreWorld())->globalExec()); }
JSGlobalContextRef WebFrame::jsContext() { return toGlobalRef(m_coreFrame->script().globalObject(mainThreadNormalWorld())->globalExec()); }
JSGlobalContextRef DumpRenderTreeSupportEfl::globalContextRefForFrame(const Evas_Object* ewkFrame) { DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, 0); return toGlobalRef(frame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec()); }
void DumpRenderTree::resetToConsistentStateBeforeTesting(const String& url, const String& imageHash) { gTestRunner = TestRunner::create(url.utf8().data(), imageHash.utf8().data()); if (shouldDumpAsText(url)) { gTestRunner->setDumpAsText(true); gTestRunner->setGeneratePixelResults(false); } gTestRunner->setIconDatabaseEnabled(false); DumpRenderTreeSupport::resetGeolocationMock(m_page); topLoadingFrame = 0; m_loadFinished = false; m_policyDelegateEnabled = false; waitForPolicy = false; testDone = false; WorkQueue::shared()->clear(); WorkQueue::shared()->setFrozen(false); WebSettings* settings = m_page->settings(); // Apply new settings to current page, see more in the destructor of WebSettingsTransaction. WebSettingsTransaction webSettingTransaction(settings); settings->setTextReflowMode(WebSettings::TextReflowDisabled); settings->setJavaScriptEnabled(true); settings->setLoadsImagesAutomatically(true); settings->setJavaScriptOpenWindowsAutomatically(true); settings->setZoomToFitOnLoad(false); settings->setDefaultFontSize(16); settings->setDefaultFixedFontSize(13); settings->setMinimumFontSize(1); settings->setSerifFontFamily("Times"); settings->setFixedFontFamily("Courier New"); settings->setSansSerifFontFamily("Arial"); settings->setStandardFontFamily("Times"); settings->setXSSAuditorEnabled(false); settings->setMaximumPagesInCache(0); settings->setPluginsEnabled(true); BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->clearBackForwardList(false); setAcceptsEditing(true); DumpRenderTreeSupport::setLinksIncludedInFocusChain(true); #if ENABLE(STYLE_SCOPED) DumpRenderTreeSupport::setStyleScopedEnabled(true); #endif m_page->setVirtualViewportSize(Platform::IntSize(800, 600)); m_page->resetVirtualViewportOnCommitted(false); m_page->setUserScalable(true); m_page->setJavaScriptCanAccessClipboard(true); if (WebCore::Page* page = DumpRenderTreeSupport::corePage(m_page)) { page->setTabKeyCyclesThroughElements(true); // FIXME: Remove this once BlackBerry uses resetInternalsObject: https://bugs.webkit.org/show_bug.cgi?id=86899. page->settings()->setEditingBehaviorType(WebCore::EditingUnixBehavior); page->settings()->setDOMPasteAllowed(true); page->settings()->setValidationMessageTimerMagnification(-1); page->settings()->setInteractiveFormValidationEnabled(true); page->settings()->setAllowFileAccessFromFileURLs(true); page->settings()->setAllowUniversalAccessFromFileURLs(true); page->settings()->setAuthorAndUserStylesEnabled(true); page->settings()->setUsePreHTML5ParserQuirks(false); // FIXME: Other ports also clear history/backForwardList allong with visited links. page->group().removeVisitedLinks(); if (mainFrame = page->mainFrame()) { mainFrame->tree()->clearName(); mainFrame->loader()->setOpener(0); // [WebKit bug #86899] Reset JS state settings. JSGlobalContextRef jsContext = toGlobalRef(mainFrame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec()); WebCoreTestSupport::resetInternalsObject(jsContext); } } // For now we manually garbage collect between each test to make sure the device won't run out of memory due to lazy collection. DumpRenderTreeSupport::garbageCollectorCollect(); }