static void resetWebViewToConsistentStateBeforeTesting() { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; webView->setPolicyDelegate(0); policyDelegate->setPermissive(false); policyDelegate->setControllerToNotifyDone(0); COMPtr<IWebIBActions> webIBActions(Query, webView); if (webIBActions) { webIBActions->makeTextStandardSize(0); webIBActions->resetPageZoom(0); } COMPtr<IWebPreferences> preferences; if (SUCCEEDED(webView->preferences(&preferences))) resetDefaultsToConsistentValues(preferences.get()); if (gTestRunner) { JSGlobalContextRef context = frame->globalContext(); WebCoreTestSupport::resetInternalsObject(context); } COMPtr<IWebViewEditing> viewEditing; if (SUCCEEDED(webView->QueryInterface(&viewEditing))) viewEditing->setSmartInsertDeleteEnabled(TRUE); COMPtr<IWebViewPrivate> webViewPrivate(Query, webView); if (!webViewPrivate) return; double minimumInterval = 0; if (SUCCEEDED(webViewPrivate->defaultMinimumTimerInterval(&minimumInterval))) webViewPrivate->setMinimumTimerInterval(minimumInterval); HWND viewWindow; if (SUCCEEDED(webViewPrivate->viewWindow(reinterpret_cast<OLE_HANDLE*>(&viewWindow))) && viewWindow) SetFocus(viewWindow); webViewPrivate->clearMainFrameName(); webViewPrivate->resetOriginAccessWhitelists(); BSTR groupName; if (SUCCEEDED(webView->groupName(&groupName))) { webViewPrivate->removeAllUserContentFromGroup(groupName); SysFreeString(groupName); } sharedUIDelegate->resetUndoManager(); sharedFrameLoadDelegate->resetToConsistentState(); COMPtr<IWebFramePrivate> framePrivate; if (SUCCEEDED(frame->QueryInterface(&framePrivate))) framePrivate->clearOpener(); }
static void resetWebViewToConsistentStateBeforeTesting() { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; webView->setPolicyDelegate(0); policyDelegate->setPermissive(false); policyDelegate->setControllerToNotifyDone(0); COMPtr<IWebIBActions> webIBActions(Query, webView); if (webIBActions) { webIBActions->makeTextStandardSize(0); webIBActions->resetPageZoom(0); } COMPtr<IWebPreferences> preferences; if (SUCCEEDED(webView->preferences(&preferences))) resetDefaultsToConsistentValues(preferences.get()); COMPtr<IWebViewEditing> viewEditing; if (SUCCEEDED(webView->QueryInterface(&viewEditing))) viewEditing->setSmartInsertDeleteEnabled(TRUE); COMPtr<IWebViewPrivate> webViewPrivate(Query, webView); if (!webViewPrivate) return; COMPtr<IWebInspector> inspector; if (SUCCEEDED(webViewPrivate->inspector(&inspector))) inspector->setJavaScriptProfilingEnabled(FALSE); HWND viewWindow; if (SUCCEEDED(webViewPrivate->viewWindow(reinterpret_cast<OLE_HANDLE*>(&viewWindow))) && viewWindow) SetFocus(viewWindow); webViewPrivate->clearMainFrameName(); webViewPrivate->resetOriginAccessWhiteLists(); BSTR groupName; if (SUCCEEDED(webView->groupName(&groupName))) { webViewPrivate->removeAllUserContentFromGroup(groupName); SysFreeString(groupName); } sharedUIDelegate->resetUndoManager(); sharedFrameLoadDelegate->resetToConsistentState(); }