Delete Frame::domWindow() and Frame::existingDOMWindow()
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Aug 2012 22:34:01 +0000 (22:34 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Aug 2012 22:34:01 +0000 (22:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=93990

Reviewed by Eric Seidel.

Source/WebCore:

These functions just call through to document()->domWindow(). This
patch updates the callers so it's clearer what's going on.

* bindings/js/JSDOMBinding.cpp:
(WebCore::shouldAllowAccessToFrame):
(WebCore::printErrorMessageForFrame):
* bindings/js/JSDocumentCustom.cpp:
(WebCore::JSDocument::location):
(WebCore::JSDocument::setLocation):
* bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::handleEvent):
* bindings/js/ScriptCachedFrameData.cpp:
(WebCore::ScriptCachedFrameData::restore):
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::createWindowShell):
* bindings/objc/DOMAbstractView.mm:
(core):
* bindings/v8/NPV8Object.cpp:
(WebCore::toV8Context):
* bindings/v8/ScriptController.cpp:
(WebCore::createScriptObject):
(WebCore::ScriptController::createScriptObjectForPluginElement):
* bindings/v8/V8DOMWindowShell.cpp:
(WebCore::V8DOMWindowShell::initContextIfNeeded):
* bindings/v8/V8IsolatedContext.cpp:
(WebCore::V8IsolatedContext::V8IsolatedContext):
* bindings/v8/V8Proxy.cpp:
(WebCore::V8Proxy::retrieveFrame):
* bindings/v8/custom/V8DOMWindowCustom.cpp:
(WebCore::V8DOMWindow::indexedPropertyGetter):
(WebCore::V8DOMWindow::namedPropertyGetter):
* bindings/v8/custom/V8DocumentLocationCustom.cpp:
(WebCore::V8Document::locationAccessorGetter):
(WebCore::V8Document::locationAccessorSetter):
* bindings/v8/custom/V8HTMLDocumentCustom.cpp:
(WebCore::V8HTMLDocument::GetNamedProperty):
* bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp:
(WebCore::V8HTMLFrameSetElement::namedPropertyGetter):
* dom/Document.cpp:
(WebCore::printNavigationErrorMessage):
* dom/ViewportArguments.cpp:
(WebCore::reportViewportWarning):
* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::insertDictatedText):
* editing/Editor.cpp:
(WebCore::Editor::pasteAsPlainText):
(WebCore::Editor::pasteAsFragment):
(WebCore::Editor::setComposition):
* history/PageCache.cpp:
(WebCore::logCanCacheFrameDecision):
(WebCore::PageCache::canCachePageContainingThisFrame):
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::validateInteractively):
* html/HTMLFrameOwnerElement.cpp:
(WebCore::HTMLFrameOwnerElement::contentWindow):
* html/canvas/WebGLRenderingContext.cpp:
(WebCore):
(WebCore::WebGLRenderingContext::printWarningToConsole):
* inspector/InspectorDOMStorageAgent.cpp:
(WebCore::InspectorDOMStorageAgent::storageId):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::checkLoadComplete):
* loader/DocumentWriter.cpp:
(WebCore::DocumentWriter::begin):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::stopLoading):
(WebCore::FrameLoader::didOpenURL):
(WebCore::FrameLoader::checkIfDisplayInsecureContent):
(WebCore::FrameLoader::checkIfRunInsecureContent):
(WebCore::FrameLoader::reportLocalLoadFailed):
(WebCore::FrameLoader::prepareForCachedPageRestore):
(WebCore::FrameLoader::open):
(WebCore::FrameLoader::fireBeforeUnloadEvent):
* loader/MainResourceLoader.cpp:
(WebCore::MainResourceLoader::didReceiveResponse):
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::abort):
(WebCore::ApplicationCacheGroup::didReceiveResponse):
(WebCore::ApplicationCacheGroup::didFinishLoading):
(WebCore::ApplicationCacheGroup::didFail):
(WebCore::ApplicationCacheGroup::didReceiveManifestResponse):
(WebCore::ApplicationCacheGroup::didFinishLoadingManifest):
(WebCore::ApplicationCacheGroup::checkIfLoadIsComplete):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::printAccessDeniedMessage):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::isCurrentlyDisplayedInFrame):
(WebCore::DOMWindow::self):
(WebCore::DOMWindow::opener):
(WebCore::DOMWindow::parent):
(WebCore::DOMWindow::top):
(WebCore::DOMWindow::createWindow):
(WebCore::DOMWindow::open):
* page/DOMWindowProperty.cpp:
(WebCore::DOMWindowProperty::DOMWindowProperty):
(WebCore::DOMWindowProperty::reconnectFrameFromPageCache):
* page/DragController.cpp:
(WebCore::DragController::dispatchTextInputEventFor):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleTextInputEvent):
* page/Frame.cpp:
* page/Frame.h:
(Frame):
* page/Location.cpp:
(WebCore::Location::replace):
(WebCore::Location::reload):
(WebCore::Location::setLocation):
* storage/StorageEventDispatcher.cpp:
(WebCore::StorageEventDispatcher::dispatch):
* svg/SVGDocumentExtensions.cpp:
(WebCore::reportMessage):
* xml/XSLStyleSheetLibxslt.cpp:
(WebCore::XSLStyleSheet::parseString):
* xml/XSLTProcessorLibxslt.cpp:
(WebCore::docLoaderFunc):
* xml/XSLTProcessorQt.cpp:
(WebCore::XSLTMessageHandler::handleMessage):

Source/WebKit/blackberry:

* WebCoreSupport/ChromeClientBlackBerry.cpp:
(WebCore::toOriginString):
(WebCore::ChromeClientBlackBerry::runJavaScriptAlert):
(WebCore::ChromeClientBlackBerry::runJavaScriptConfirm):
(WebCore::ChromeClientBlackBerry::runJavaScriptPrompt):
(WebCore::ChromeClientBlackBerry::runBeforeUnloadConfirmPanel):
(WebCore::ChromeClientBlackBerry::requestWebGLPermission):

Source/WebKit/chromium:

* src/StorageAreaProxy.cpp:
(WebCore::StorageAreaProxy::dispatchLocalStorageEvent):
(WebCore::StorageAreaProxy::dispatchSessionStorageEvent):
* src/WebDOMMessageEvent.cpp:
(WebKit::WebDOMMessageEvent::initMessageEvent):
* src/WebFrameImpl.cpp:
(WebKit::WebFrameImpl::performance):
(WebKit::WebFrameImpl::addMessageToConsole):
(WebKit::WebFrameImpl::unloadListenerCount):
(WebKit::WebFrameImpl::addEventListener):
(WebKit::WebFrameImpl::removeEventListener):
(WebKit::WebFrameImpl::dispatchEvent):
(WebKit::WebFrameImpl::dispatchMessageEventWithOriginCheck):
(WebKit::WebFrameImpl::deliverIntent):
* src/WebPagePopupImpl.cpp:
(WebKit::WebPagePopupImpl::initPage):

Source/WebKit/efl:

* WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
(DumpRenderTreeSupportEfl::pendingUnloadEventCount):
* ewk/ewk_frame.cpp:
(ewk_frame_intent_deliver):

Source/WebKit/gtk:

* WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
(DumpRenderTreeSupportGtk::getPendingUnloadEventCount):

Source/WebKit/mac:

* WebView/WebFrame.mm:
(-[WebFrame _pendingFrameUnloadEventCount]):
(-[WebFrame _cacheabilityDictionary]):

Source/WebKit/qt:

* WebCoreSupport/FrameLoaderClientQt.cpp:
(WebCore::FrameLoaderClientQt::dispatchDidFinishDocumentLoad):

Source/WebKit/win:

* WebFrame.cpp:
(WebFrame::DOMWindow):
(WebFrame::pendingFrameUnloadEventCount):

Source/WebKit2:

* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::deliverIntent):
(WebKit::WebFrame::pendingUnloadCount):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@125615 268f45cc-cd09-0410-ab3c-d52691b4dbfc

64 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/bindings/js/JSDOMBinding.cpp
Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
Source/WebCore/bindings/js/JSDocumentCustom.cpp
Source/WebCore/bindings/js/JSEventListener.cpp
Source/WebCore/bindings/js/ScriptCachedFrameData.cpp
Source/WebCore/bindings/js/ScriptController.cpp
Source/WebCore/bindings/objc/DOMAbstractView.mm
Source/WebCore/bindings/v8/NPV8Object.cpp
Source/WebCore/bindings/v8/ScriptController.cpp
Source/WebCore/bindings/v8/V8DOMWindowShell.cpp
Source/WebCore/bindings/v8/V8IsolatedContext.cpp
Source/WebCore/bindings/v8/V8Proxy.cpp
Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
Source/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp
Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
Source/WebCore/bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/ViewportArguments.cpp
Source/WebCore/editing/AlternativeTextController.cpp
Source/WebCore/editing/Editor.cpp
Source/WebCore/history/PageCache.cpp
Source/WebCore/html/HTMLFormElement.cpp
Source/WebCore/html/HTMLFrameOwnerElement.cpp
Source/WebCore/html/canvas/WebGLRenderingContext.cpp
Source/WebCore/inspector/InspectorDOMStorageAgent.cpp
Source/WebCore/loader/DocumentLoader.cpp
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/MainResourceLoader.cpp
Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp
Source/WebCore/loader/cache/CachedResourceLoader.cpp
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/DOMWindowProperty.cpp
Source/WebCore/page/DragController.cpp
Source/WebCore/page/EventHandler.cpp
Source/WebCore/page/Frame.cpp
Source/WebCore/page/Frame.h
Source/WebCore/page/Location.cpp
Source/WebCore/storage/StorageEventDispatcher.cpp
Source/WebCore/svg/SVGDocumentExtensions.cpp
Source/WebCore/xml/XSLStyleSheetLibxslt.cpp
Source/WebCore/xml/XSLTProcessorLibxslt.cpp
Source/WebCore/xml/XSLTProcessorQt.cpp
Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/StorageAreaProxy.cpp
Source/WebKit/chromium/src/WebDOMMessageEvent.cpp
Source/WebKit/chromium/src/WebFrameImpl.cpp
Source/WebKit/chromium/src/WebPagePopupImpl.cpp
Source/WebKit/efl/ChangeLog
Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp
Source/WebKit/efl/ewk/ewk_frame.cpp
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebFrame.mm
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebFrame.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/WebFrame.cpp

index f05a37c..5940659 100644 (file)
@@ -1,3 +1,128 @@
+2012-08-14  Adam Barth  <abarth@webkit.org>
+
+        Delete Frame::domWindow() and Frame::existingDOMWindow()
+        https://bugs.webkit.org/show_bug.cgi?id=93990
+
+        Reviewed by Eric Seidel.
+
+        These functions just call through to document()->domWindow(). This
+        patch updates the callers so it's clearer what's going on.
+
+        * bindings/js/JSDOMBinding.cpp:
+        (WebCore::shouldAllowAccessToFrame):
+        (WebCore::printErrorMessageForFrame):
+        * bindings/js/JSDocumentCustom.cpp:
+        (WebCore::JSDocument::location):
+        (WebCore::JSDocument::setLocation):
+        * bindings/js/JSEventListener.cpp:
+        (WebCore::JSEventListener::handleEvent):
+        * bindings/js/ScriptCachedFrameData.cpp:
+        (WebCore::ScriptCachedFrameData::restore):
+        * bindings/js/ScriptController.cpp:
+        (WebCore::ScriptController::createWindowShell):
+        * bindings/objc/DOMAbstractView.mm:
+        (core):
+        * bindings/v8/NPV8Object.cpp:
+        (WebCore::toV8Context):
+        * bindings/v8/ScriptController.cpp:
+        (WebCore::createScriptObject):
+        (WebCore::ScriptController::createScriptObjectForPluginElement):
+        * bindings/v8/V8DOMWindowShell.cpp:
+        (WebCore::V8DOMWindowShell::initContextIfNeeded):
+        * bindings/v8/V8IsolatedContext.cpp:
+        (WebCore::V8IsolatedContext::V8IsolatedContext):
+        * bindings/v8/V8Proxy.cpp:
+        (WebCore::V8Proxy::retrieveFrame):
+        * bindings/v8/custom/V8DOMWindowCustom.cpp:
+        (WebCore::V8DOMWindow::indexedPropertyGetter):
+        (WebCore::V8DOMWindow::namedPropertyGetter):
+        * bindings/v8/custom/V8DocumentLocationCustom.cpp:
+        (WebCore::V8Document::locationAccessorGetter):
+        (WebCore::V8Document::locationAccessorSetter):
+        * bindings/v8/custom/V8HTMLDocumentCustom.cpp:
+        (WebCore::V8HTMLDocument::GetNamedProperty):
+        * bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp:
+        (WebCore::V8HTMLFrameSetElement::namedPropertyGetter):
+        * dom/Document.cpp:
+        (WebCore::printNavigationErrorMessage):
+        * dom/ViewportArguments.cpp:
+        (WebCore::reportViewportWarning):
+        * editing/AlternativeTextController.cpp:
+        (WebCore::AlternativeTextController::insertDictatedText):
+        * editing/Editor.cpp:
+        (WebCore::Editor::pasteAsPlainText):
+        (WebCore::Editor::pasteAsFragment):
+        (WebCore::Editor::setComposition):
+        * history/PageCache.cpp:
+        (WebCore::logCanCacheFrameDecision):
+        (WebCore::PageCache::canCachePageContainingThisFrame):
+        * html/HTMLFormElement.cpp:
+        (WebCore::HTMLFormElement::validateInteractively):
+        * html/HTMLFrameOwnerElement.cpp:
+        (WebCore::HTMLFrameOwnerElement::contentWindow):
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore):
+        (WebCore::WebGLRenderingContext::printWarningToConsole):
+        * inspector/InspectorDOMStorageAgent.cpp:
+        (WebCore::InspectorDOMStorageAgent::storageId):
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::checkLoadComplete):
+        * loader/DocumentWriter.cpp:
+        (WebCore::DocumentWriter::begin):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::stopLoading):
+        (WebCore::FrameLoader::didOpenURL):
+        (WebCore::FrameLoader::checkIfDisplayInsecureContent):
+        (WebCore::FrameLoader::checkIfRunInsecureContent):
+        (WebCore::FrameLoader::reportLocalLoadFailed):
+        (WebCore::FrameLoader::prepareForCachedPageRestore):
+        (WebCore::FrameLoader::open):
+        (WebCore::FrameLoader::fireBeforeUnloadEvent):
+        * loader/MainResourceLoader.cpp:
+        (WebCore::MainResourceLoader::didReceiveResponse):
+        * loader/appcache/ApplicationCacheGroup.cpp:
+        (WebCore::ApplicationCacheGroup::abort):
+        (WebCore::ApplicationCacheGroup::didReceiveResponse):
+        (WebCore::ApplicationCacheGroup::didFinishLoading):
+        (WebCore::ApplicationCacheGroup::didFail):
+        (WebCore::ApplicationCacheGroup::didReceiveManifestResponse):
+        (WebCore::ApplicationCacheGroup::didFinishLoadingManifest):
+        (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete):
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::printAccessDeniedMessage):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::isCurrentlyDisplayedInFrame):
+        (WebCore::DOMWindow::self):
+        (WebCore::DOMWindow::opener):
+        (WebCore::DOMWindow::parent):
+        (WebCore::DOMWindow::top):
+        (WebCore::DOMWindow::createWindow):
+        (WebCore::DOMWindow::open):
+        * page/DOMWindowProperty.cpp:
+        (WebCore::DOMWindowProperty::DOMWindowProperty):
+        (WebCore::DOMWindowProperty::reconnectFrameFromPageCache):
+        * page/DragController.cpp:
+        (WebCore::DragController::dispatchTextInputEventFor):
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::handleTextInputEvent):
+        * page/Frame.cpp:
+        * page/Frame.h:
+        (Frame):
+        * page/Location.cpp:
+        (WebCore::Location::replace):
+        (WebCore::Location::reload):
+        (WebCore::Location::setLocation):
+        * storage/StorageEventDispatcher.cpp:
+        (WebCore::StorageEventDispatcher::dispatch):
+        * svg/SVGDocumentExtensions.cpp:
+        (WebCore::reportMessage):
+        * xml/XSLStyleSheetLibxslt.cpp:
+        (WebCore::XSLStyleSheet::parseString):
+        * xml/XSLTProcessorLibxslt.cpp:
+        (WebCore::docLoaderFunc):
+        * xml/XSLTProcessorQt.cpp:
+        (WebCore::XSLTMessageHandler::handleMessage):
+
 2012-08-14  Mike West  <mkwst@chromium.org>
 
         Tighten up parsing the 'script-nonce' CSP directive value.
index b116a99..821961d 100644 (file)
@@ -1297,7 +1297,6 @@ __ZNK7WebCore5Frame16frameScaleFactorEv
 __ZNK7WebCore5Frame18documentTypeStringEv
 __ZNK7WebCore5Frame31displayStringModifiedByEncodingERKN3WTF6StringE
 __ZNK7WebCore5Frame8settingsEv
-__ZNK7WebCore5Frame9domWindowEv
 __ZNK7WebCore5Range11startOffsetERi
 __ZNK7WebCore5Range12endContainerERi
 __ZNK7WebCore5Range12pastLastNodeEv
index 1550f99..59f55ae 100644 (file)
@@ -224,7 +224,7 @@ bool shouldAllowAccessToFrame(ExecState* exec, Frame* frame, String& message)
         return false;
     bool result = BindingSecurity::shouldAllowAccessToFrame(exec, frame, DoNotReportSecurityError);
     // FIXME: The following line of code should move somewhere that it can be shared with immediatelyReportUnsafeAccessTo.
-    message = frame->domWindow()->crossDomainAccessErrorMessage(activeDOMWindow(exec));
+    message = frame->document()->domWindow()->crossDomainAccessErrorMessage(activeDOMWindow(exec));
     return result;
 }
 
@@ -232,7 +232,7 @@ void printErrorMessageForFrame(Frame* frame, const String& message)
 {
     if (!frame)
         return;
-    frame->domWindow()->printErrorMessage(message);
+    frame->document()->domWindow()->printErrorMessage(message);
 }
 
 JSValue objectToStringFunctionGetter(ExecState* exec, JSValue, PropertyName propertyName)
index bb3d791..2d75ac0 100644 (file)
@@ -99,12 +99,12 @@ JSValue nonCachingStaticFunctionGetter(ExecState* exec, JSValue, PropertyName pr
 
 static JSValue childFrameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
 {
-    return toJS(exec, jsCast<JSDOMWindow*>(asObject(slotBase))->impl()->frame()->tree()->scopedChild(propertyNameToAtomicString(propertyName))->domWindow());
+    return toJS(exec, jsCast<JSDOMWindow*>(asObject(slotBase))->impl()->frame()->tree()->scopedChild(propertyNameToAtomicString(propertyName))->document()->domWindow());
 }
 
 static JSValue indexGetter(ExecState* exec, JSValue slotBase, unsigned index)
 {
-    return toJS(exec, jsCast<JSDOMWindow*>(asObject(slotBase))->impl()->frame()->tree()->scopedChild(index)->domWindow());
+    return toJS(exec, jsCast<JSDOMWindow*>(asObject(slotBase))->impl()->frame()->tree()->scopedChild(index)->document()->domWindow());
 }
 
 static JSValue namedItemGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
index b6de162..647b446 100644 (file)
@@ -54,7 +54,7 @@ JSValue JSDocument::location(ExecState* exec) const
     if (!frame)
         return jsNull();
 
-    Location* location = frame->domWindow()->location();
+    Location* location = frame->document()->domWindow()->location();
     if (JSDOMWrapper* wrapper = getCachedWrapper(currentWorld(exec), location))
         return wrapper;
 
@@ -73,7 +73,7 @@ void JSDocument::setLocation(ExecState* exec, JSValue value)
     if (exec->hadException())
         return;
 
-    if (Location* location = frame->domWindow()->location())
+    if (Location* location = frame->document()->domWindow()->location())
         location->setHref(ustringToString(locationString), activeDOMWindow(exec), firstDOMWindow(exec));
 }
 
index 0a557f7..779e8d7 100644 (file)
@@ -85,18 +85,12 @@ void JSEventListener::handleEvent(ScriptExecutionContext* scriptExecutionContext
     if (!globalObject)
         return;
 
-    Frame* frame = 0;
     if (scriptExecutionContext->isDocument()) {
         JSDOMWindow* window = jsCast<JSDOMWindow*>(globalObject);
-        frame = window->impl()->frame();
-        if (!frame)
-            return;
-        // The window must still be active in its frame. See <https://bugs.webkit.org/show_bug.cgi?id=21921>.
-        // FIXME: A better fix for this may be to change DOMWindow::frame() to not return a frame the detached window used to be in.
-        if (frame->domWindow() != window->impl())
+        if (!window->impl()->isCurrentlyDisplayedInFrame())
             return;
         // FIXME: Is this check needed for other contexts?
-        ScriptController* script = frame->script();
+        ScriptController* script = window->impl()->frame()->script();
         if (!script->canExecuteScripts(AboutToExecuteScript) || script->isPaused())
             return;
     }
index 9cf4e99..a69af39 100644 (file)
@@ -80,7 +80,7 @@ void ScriptCachedFrameData::restore(Frame* frame)
         if (JSDOMWindow* window = m_windows.get(world).get())
             windowShell->setWindow(window->globalData(), window);
         else {
-            windowShell->setWindow(frame->domWindow());
+            windowShell->setWindow(frame->document()->domWindow());
 
             if (Page* page = frame->page()) {
                 scriptController->attachDebugger(windowShell, page->debugger());
index 79c1274..9fa8542 100644 (file)
@@ -111,7 +111,7 @@ JSDOMWindowShell* ScriptController::createWindowShell(DOMWrapperWorld* world)
 {
     ASSERT(!m_windowShells.contains(world));
     Structure* structure = JSDOMWindowShell::createStructure(*world->globalData(), jsNull());
-    Strong<JSDOMWindowShell> windowShell(*world->globalData(), JSDOMWindowShell::create(m_frame->domWindow(), structure, world));
+    Strong<JSDOMWindowShell> windowShell(*world->globalData(), JSDOMWindowShell::create(m_frame->document()->domWindow(), structure, world));
     Strong<JSDOMWindowShell> windowShell2(windowShell);
     m_windowShells.add(world, windowShell);
     world->didCreateWindowShell(this);
index 0b79aa9..d2d3dd5 100644 (file)
@@ -50,7 +50,7 @@
 {
     if (!_internal)
         return nil;
-    return kit(IMPL->domWindow()->document());
+    return kit(IMPL->document());
 }
 
 @end
@@ -72,7 +72,7 @@ WebCore::DOMWindow* core(DOMAbstractView *wrapper)
         return 0;
     if (!wrapper->_internal)
         return 0;
-    return reinterpret_cast<WebCore::Frame*>(wrapper->_internal)->domWindow();
+    return reinterpret_cast<WebCore::Frame*>(wrapper->_internal)->document()->domWindow();
 }
 
 DOMAbstractView *kit(WebCore::DOMWindow* value)
index f6b9f1a..c00082d 100644 (file)
@@ -63,8 +63,8 @@ typedef HashMap<int, V8NPObjectVector> V8NPObjectMap;
 static v8::Local<v8::Context> toV8Context(NPP npp, NPObject* npObject)
 {
     V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject);
-    DOMWindow* domWindow = object->rootObject;
-    if (!domWindow || !domWindow->frame() || domWindow != domWindow->frame()->domWindow())
+    DOMWindow* window = object->rootObject;
+    if (!window || !window->isCurrentlyDisplayedInFrame())
         return v8::Local<v8::Context>();
     return V8Proxy::mainWorldContext(object->rootObject->frame());
 }
index ba75e3b..0692e3d 100644 (file)
@@ -428,7 +428,7 @@ static NPObject* createScriptObject(Frame* frame)
         return createNoScriptObject();
 
     v8::Context::Scope scope(v8Context);
-    DOMWindow* window = frame->domWindow();
+    DOMWindow* window = frame->document()->domWindow();
     v8::Handle<v8::Value> global = toV8(window);
     ASSERT(global->IsObject());
     return npCreateV8ScriptObject(0, v8::Handle<v8::Object>::Cast(global), window);
@@ -468,7 +468,7 @@ NPObject* ScriptController::createScriptObjectForPluginElement(HTMLPlugInElement
         return createNoScriptObject();
     v8::Context::Scope scope(v8Context);
 
-    DOMWindow* window = m_frame->domWindow();
+    DOMWindow* window = m_frame->document()->domWindow();
     v8::Handle<v8::Value> v8plugin = toV8(static_cast<HTMLEmbedElement*>(plugin));
     if (!v8plugin->IsObject())
         return createNoScriptObject();
index 2e3f6cc..e87dc7d 100644 (file)
@@ -334,7 +334,7 @@ bool V8DOMWindowShell::initContextIfNeeded()
         return false;
     }
 
-    if (!installDOMWindow(v8Context, m_frame->domWindow())) {
+    if (!installDOMWindow(v8Context, m_frame->document()->domWindow())) {
         disposeContextHandles();
         return false;
     }
index a600139..10aadba 100644 (file)
@@ -91,7 +91,7 @@ V8IsolatedContext::V8IsolatedContext(V8Proxy* proxy, int extensionGroup, int wor
     m_perContextData->init();
 
     // FIXME: This will go away once we have a windowShell for the isolated world.
-    proxy->windowShell()->installDOMWindow(m_context->get(), m_frame->domWindow());
+    proxy->windowShell()->installDOMWindow(m_context->get(), m_frame->document()->domWindow());
 
     // Using the default security token means that the canAccess is always
     // called, which is slow.
index e4b75a7..25a3606 100644 (file)
@@ -367,9 +367,8 @@ DOMWindow* V8Proxy::retrieveWindow(v8::Handle<v8::Context> context)
 Frame* V8Proxy::retrieveFrame(v8::Handle<v8::Context> context)
 {
     DOMWindow* window = retrieveWindow(context);
-    Frame* frame = window->frame();
-    if (frame && frame->domWindow() == window)
-        return frame;
+    if (window->isCurrentlyDisplayedInFrame())
+        return window->frame();
     // We return 0 here because |context| is detached from the Frame.  If we
     // did return |frame| we could get in trouble because the frame could be
     // navigated to another security origin.
index 9c421fb..b8aa4fa 100644 (file)
@@ -479,7 +479,7 @@ v8::Handle<v8::Value> V8DOMWindow::indexedPropertyGetter(uint32_t index, const v
 
     Frame* child = frame->tree()->scopedChild(index);
     if (child)
-        return toV8(child->domWindow(), info.GetIsolate());
+        return toV8(child->document()->domWindow(), info.GetIsolate());
 
     return v8Undefined();
 }
@@ -502,7 +502,7 @@ v8::Handle<v8::Value> V8DOMWindow::namedPropertyGetter(v8::Local<v8::String> nam
     AtomicString propName = toWebCoreAtomicString(name);
     Frame* child = frame->tree()->scopedChild(propName);
     if (child)
-        return toV8(child->domWindow(), info.GetIsolate());
+        return toV8(child->document()->domWindow(), info.GetIsolate());
 
     // Search IDL functions defined in the prototype
     if (!info.Holder()->GetRealNamedProperty(name).IsEmpty())
index b2d81e8..7613a14 100644 (file)
@@ -40,7 +40,7 @@ v8::Handle<v8::Value> V8Document::locationAccessorGetter(v8::Local<v8::String> n
     if (!document->frame())
         return v8::Null(info.GetIsolate());
 
-    DOMWindow* window = document->frame()->domWindow();
+    DOMWindow* window = document->domWindow();
     return toV8(window->location(), info.GetIsolate());
 }
 
@@ -60,7 +60,7 @@ void V8Document::locationAccessorSetter(v8::Local<v8::String> name, v8::Local<v8
     if (!first)
         return;
 
-    DOMWindow* window = document->frame()->domWindow();
+    DOMWindow* window = document->domWindow();
     if (Location* location = window->location())
         location->setHref(toWebCoreString(value), active, first);
 }
index 327c64b..fe2e5c2 100644 (file)
@@ -94,7 +94,7 @@ v8::Handle<v8::Value> V8HTMLDocument::GetNamedProperty(HTMLDocument* htmlDocumen
         Node* node = items->item(0);
         Frame* frame = 0;
         if (node->hasTagName(HTMLNames::iframeTag) && (frame = static_cast<HTMLIFrameElement*>(node)->contentFrame()))
-            return toV8(frame->domWindow(), isolate);
+            return toV8(frame->document()->domWindow(), isolate);
 
         return toV8(node, isolate);
     }
index 5294099..0a9693a 100644 (file)
@@ -50,14 +50,16 @@ v8::Handle<v8::Value> V8HTMLFrameSetElement::namedPropertyGetter(v8::Local<v8::S
     INC_STATS("DOM.HTMLFrameSetElement.NamedPropertyGetter");
     HTMLFrameSetElement* imp = V8HTMLFrameSetElement::toNative(info.Holder());
     Node* frameNode = imp->children()->namedItem(toWebCoreAtomicString(name));
-    if (frameNode && frameNode->hasTagName(HTMLNames::frameTag)) {
-        Document* doc = static_cast<HTMLFrameElement*>(frameNode)->contentDocument();
-        if (!doc)
-            return v8::Undefined();
-        if (Frame* frame = doc->frame())
-            return toV8(frame->domWindow(), info.GetIsolate());
-    }
-    return v8Undefined();
+    if (!frameNode)
+        return v8Undefined();
+    if (!frameNode->hasTagName(HTMLNames::frameTag))
+        return v8Undefined();
+    Document* document = static_cast<HTMLFrameElement*>(frameNode)->contentDocument();
+    if (!document)
+        return v8Undefined();
+    if (!document->frame())
+        return v8Undefined();
+    return toV8(document->domWindow(), info.GetIsolate());
 }
 
 } // namespace WebCore
index 9e8e32e..a34cd1a 100644 (file)
@@ -385,7 +385,7 @@ static void printNavigationErrorMessage(Frame* frame, const KURL& activeURL)
                      frame->document()->url().string() + " from frame with URL " + activeURL.string() + ".\n";
 
     // FIXME: should we print to the console of the document performing the navigation instead?
-    frame->domWindow()->printErrorMessage(message);
+    frame->document()->domWindow()->printErrorMessage(message);
 }
 
 static HashSet<Document*>* documentsThatNeedStyleRecalc = 0;
index dc22e6e..4da9050 100644 (file)
@@ -363,7 +363,7 @@ void reportViewportWarning(Document* document, ViewportErrorCode errorCode, cons
     if (!replacement2.isNull())
         message.replace("%replacement2", replacement2);
 
-    frame->domWindow()->console()->addMessage(HTMLMessageSource, LogMessageType, viewportErrorMessageLevel(errorCode), message, document->url().string(), parserLineNumber(document));
+    document->domWindow()->console()->addMessage(HTMLMessageSource, LogMessageType, viewportErrorMessageLevel(errorCode), message, document->url().string(), parserLineNumber(document));
 }
 
 } // namespace WebCore
index d4a0e43..5dcfbd3 100644 (file)
@@ -704,7 +704,7 @@ bool AlternativeTextController::insertDictatedText(const String& text, const Vec
     if (FrameView* view = m_frame->view())
         view->resetDeferredRepaintDelay();
 
-    RefPtr<TextEvent> event = TextEvent::createForDictation(m_frame->domWindow(), text, dictationAlternatives);
+    RefPtr<TextEvent> event = TextEvent::createForDictation(m_frame->document()->domWindow(), text, dictationAlternatives);
     event->setUnderlyingEvent(triggeringEvent);
 
     ExceptionCode ec;
index 20b6af9..b307f46 100644 (file)
@@ -346,7 +346,7 @@ void Editor::pasteAsPlainText(const String& pastingText, bool smartReplace)
     if (!target)
         return;
     ExceptionCode ec = 0;
-    target->dispatchEvent(TextEvent::createForPlainTextPaste(m_frame->domWindow(), pastingText, smartReplace), ec);
+    target->dispatchEvent(TextEvent::createForPlainTextPaste(m_frame->document()->domWindow(), pastingText, smartReplace), ec);
 }
 
 void Editor::pasteAsFragment(PassRefPtr<DocumentFragment> pastingFragment, bool smartReplace, bool matchStyle)
@@ -355,7 +355,7 @@ void Editor::pasteAsFragment(PassRefPtr<DocumentFragment> pastingFragment, bool
     if (!target)
         return;
     ExceptionCode ec = 0;
-    target->dispatchEvent(TextEvent::createForFragmentPaste(m_frame->domWindow(), pastingFragment, smartReplace, matchStyle), ec);
+    target->dispatchEvent(TextEvent::createForFragmentPaste(m_frame->document()->domWindow(), pastingFragment, smartReplace, matchStyle), ec);
 }
 
 void Editor::pasteAsPlainTextBypassingDHTML()
@@ -1363,7 +1363,7 @@ void Editor::setComposition(const String& text, SetCompositionMode mode)
     // the DOM Event specification.
     Node* target = m_frame->document()->focusedNode();
     if (target) {
-        RefPtr<CompositionEvent> event = CompositionEvent::create(eventNames().compositionendEvent, m_frame->domWindow(), text);
+        RefPtr<CompositionEvent> event = CompositionEvent::create(eventNames().compositionendEvent, m_frame->document()->domWindow(), text);
         ExceptionCode ec = 0;
         target->dispatchEvent(event, ec);
     }
@@ -1426,14 +1426,14 @@ void Editor::setComposition(const String& text, const Vector<CompositionUnderlin
             // We should send a compositionstart event only when the given text is not empty because this
             // function doesn't create a composition node when the text is empty.
             if (!text.isEmpty()) {
-                target->dispatchEvent(CompositionEvent::create(eventNames().compositionstartEvent, m_frame->domWindow(), text));
-                event = CompositionEvent::create(eventNames().compositionupdateEvent, m_frame->domWindow(), text);
+                target->dispatchEvent(CompositionEvent::create(eventNames().compositionstartEvent, m_frame->document()->domWindow(), text));
+                event = CompositionEvent::create(eventNames().compositionupdateEvent, m_frame->document()->domWindow(), text);
             }
         } else {
             if (!text.isEmpty())
-                event = CompositionEvent::create(eventNames().compositionupdateEvent, m_frame->domWindow(), text);
+                event = CompositionEvent::create(eventNames().compositionupdateEvent, m_frame->document()->domWindow(), text);
             else
-              event = CompositionEvent::create(eventNames().compositionendEvent, m_frame->domWindow(), text);
+              event = CompositionEvent::create(eventNames().compositionendEvent, m_frame->document()->domWindow(), text);
         }
         ExceptionCode ec = 0;
         if (event.get())
index 8c379eb..e7eebdc 100644 (file)
@@ -137,7 +137,7 @@ static unsigned logCanCacheFrameDecision(Frame* frame, int indentLevel)
         PCLOG("   -Frame is HTTPS, and cache control prohibits caching or storing");
         rejectReasons |= 1 << IsHttpsAndCacheControlled;
     }
-    if (frame->domWindow() && frame->domWindow()->hasEventListeners(eventNames().unloadEvent)) {
+    if (frame->document()->domWindow() && frame->document()->domWindow()->hasEventListeners(eventNames().unloadEvent)) {
         PCLOG("   -Frame has an unload event listener");
         rejectReasons |= 1 << HasUnloadListener;
     }
@@ -343,7 +343,7 @@ bool PageCache::canCachePageContainingThisFrame(Frame* frame)
         && !(documentLoader->substituteData().isValid() && !documentLoader->substituteData().failingURL().isEmpty())
         && (!frameLoader->subframeLoader()->containsPlugins() || frame->page()->settings()->pageCacheSupportsPlugins())
         && (!document->url().protocolIs("https") || (!documentLoader->response().cacheControlContainsNoCache() && !documentLoader->response().cacheControlContainsNoStore()))
-        && (!frame->domWindow() || !frame->domWindow()->hasEventListeners(eventNames().unloadEvent))
+        && (!document->domWindow() || !document->domWindow()->hasEventListeners(eventNames().unloadEvent))
 #if ENABLE(SQL_DATABASE)
         && !DatabaseContext::hasOpenDatabases(document)
 #endif
index 9b2a591..7c3bb61 100644 (file)
@@ -252,7 +252,7 @@ bool HTMLFormElement::validateInteractively(Event* event)
         }
     }
     // Warn about all of unfocusable controls.
-    if (Frame* frame = document()->frame()) {
+    if (document()->frame()) {
         for (unsigned i = 0; i < unhandledInvalidControls.size(); ++i) {
             FormAssociatedElement* unhandledAssociatedElement = unhandledInvalidControls[i].get();
             HTMLElement* unhandled = toHTMLElement(unhandledAssociatedElement);
@@ -260,7 +260,7 @@ bool HTMLFormElement::validateInteractively(Event* event)
                 continue;
             String message("An invalid form control with name='%name' is not focusable.");
             message.replace("%name", unhandledAssociatedElement->name());
-            frame->domWindow()->console()->addMessage(HTMLMessageSource, LogMessageType, ErrorMessageLevel, message, document()->url().string());
+            document()->domWindow()->console()->addMessage(HTMLMessageSource, LogMessageType, ErrorMessageLevel, message, document()->url().string());
         }
     }
     return false;
index 6b70660..560f38b 100644 (file)
@@ -73,7 +73,7 @@ Document* HTMLFrameOwnerElement::contentDocument() const
 
 DOMWindow* HTMLFrameOwnerElement::contentWindow() const
 {
-    return m_contentFrame ? m_contentFrame->domWindow() : 0;
+    return m_contentFrame ? m_contentFrame->document()->domWindow() : 0;
 }
 
 void HTMLFrameOwnerElement::setSandboxFlags(SandboxFlags flags)
index f77a99a..fe0fe6d 100644 (file)
@@ -5173,13 +5173,14 @@ void WebGLRenderingContext::printWarningToConsole(const String& message)
 {
     if (!canvas())
         return;
+    // FIXME: This giant cascade of null checks seems a bit paranoid.
     Document* document = canvas()->document();
     if (!document)
         return;
     Frame* frame = document->frame();
     if (!frame)
         return;
-    DOMWindow* window = frame->domWindow();
+    DOMWindow* window = document->domWindow();
     if (!window)
         return;
     Console* console = window->console();
index 93999d1..90a0a9e 100644 (file)
@@ -156,7 +156,7 @@ String InspectorDOMStorageAgent::storageId(Storage* storage)
     ASSERT(storage);
     Frame* frame = storage->frame();
     ExceptionCode ec = 0;
-    bool isLocalStorage = (frame->domWindow()->localStorage(ec) == storage && !ec);
+    bool isLocalStorage = (frame->document()->domWindow()->localStorage(ec) == storage && !ec);
     return storageId(frame->document()->securityOrigin(), isLocalStorage);
 }
 
index 32ff28c..bc74440 100644 (file)
@@ -422,7 +422,7 @@ void DocumentLoader::checkLoadComplete()
         return;
     ASSERT(this == frameLoader()->activeDocumentLoader());
 
-    if (DOMWindow* window = m_frame->existingDOMWindow())
+    if (DOMWindow* window = m_frame->document()->domWindow())
         window->finishedLoading();
 }
 
index f588054..97fa49f 100644 (file)
@@ -357,10 +357,10 @@ void FrameLoader::stopLoading(UnloadEventPolicy unloadEventPolicy)
                 Node* currentFocusedNode = m_frame->document()->focusedNode();
                 if (currentFocusedNode)
                     currentFocusedNode->aboutToUnload();
-                if (m_frame->domWindow() && m_pageDismissalEventBeingDispatched == NoDismissal) {
+                if (m_frame->document()->domWindow() && m_pageDismissalEventBeingDispatched == NoDismissal) {
                     if (unloadEventPolicy == UnloadEventPolicyUnloadAndPageHide) {
                         m_pageDismissalEventBeingDispatched = PageHideDismissal;
-                        m_frame->domWindow()->dispatchEvent(PageTransitionEvent::create(eventNames().pagehideEvent, m_frame->document()->inPageCache()), m_frame->document());
+                        m_frame->document()->domWindow()->dispatchEvent(PageTransitionEvent::create(eventNames().pagehideEvent, m_frame->document()->inPageCache()), m_frame->document());
                     }
                     if (!m_frame->document()->inPageCache()) {
                         RefPtr<Event> unloadEvent(Event::create(eventNames().unloadEvent, false, false));
@@ -373,10 +373,10 @@ void FrameLoader::stopLoading(UnloadEventPolicy unloadEventPolicy)
                             DocumentLoadTiming* timing = documentLoader->timing();
                             ASSERT(timing->navigationStart());
                             timing->markUnloadEventStart();
-                            m_frame->domWindow()->dispatchEvent(unloadEvent, m_frame->domWindow()->document());
+                            m_frame->document()->domWindow()->dispatchEvent(unloadEvent, m_frame->document());
                             timing->markUnloadEventEnd();
                         } else
-                            m_frame->domWindow()->dispatchEvent(unloadEvent, m_frame->domWindow()->document());
+                            m_frame->document()->domWindow()->dispatchEvent(unloadEvent, m_frame->document());
                     }
                 }
                 m_pageDismissalEventBeingDispatched = NoDismissal;
@@ -464,7 +464,7 @@ bool FrameLoader::didOpenURL()
     // its frame is not in a consistent state for rendering, so avoid setJSStatusBarText
     // since it may cause clients to attempt to render the frame.
     if (!m_stateMachine.creatingInitialEmptyDocument()) {
-        if (DOMWindow* window = m_frame->existingDOMWindow()) {
+        if (DOMWindow* window = m_frame->document()->domWindow()) {
             window->setStatus(String());
             window->setDefaultStatus(String());
         }
@@ -886,7 +886,7 @@ bool FrameLoader::checkIfDisplayInsecureContent(SecurityOrigin* context, const K
     String message = (allowed ? emptyString() : "[blocked] ") + "The page at " +
         m_frame->document()->url().string() + " displayed insecure content from " + url.string() + ".\n";
         
-    m_frame->domWindow()->console()->addMessage(HTMLMessageSource, LogMessageType, WarningMessageLevel, message);
+    m_frame->document()->domWindow()->console()->addMessage(HTMLMessageSource, LogMessageType, WarningMessageLevel, message);
 
     if (allowed)
         m_client->didDisplayInsecureContent();
@@ -904,7 +904,7 @@ bool FrameLoader::checkIfRunInsecureContent(SecurityOrigin* context, const KURL&
     String message = (allowed ? emptyString() : "[blocked] ") + "The page at " +
         m_frame->document()->url().string() + " ran insecure content from " + url.string() + ".\n";
        
-    m_frame->domWindow()->console()->addMessage(HTMLMessageSource, LogMessageType, WarningMessageLevel, message);
+    m_frame->document()->domWindow()->console()->addMessage(HTMLMessageSource, LogMessageType, WarningMessageLevel, message);
 
     if (allowed)
         m_client->didRunInsecureContent(context, url);
@@ -1371,7 +1371,7 @@ void FrameLoader::reportLocalLoadFailed(Frame* frame, const String& url)
     if (!frame)
         return;
 
-    frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Not allowed to load local resource: " + url);
+    frame->document()->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Not allowed to load local resource: " + url);
 }
 
 const ResourceRequest& FrameLoader::initialRequest() const
@@ -1902,7 +1902,7 @@ void FrameLoader::prepareForCachedPageRestore()
     
     // Delete old status bar messages (if it _was_ activated on last URL).
     if (m_frame->script()->canExecuteScripts(NotAboutToExecuteScript)) {
-        if (DOMWindow* window = m_frame->existingDOMWindow()) {
+        if (DOMWindow* window = m_frame->document()->domWindow()) {
             window->setStatus(String());
             window->setDefaultStatus(String());
         }
@@ -2692,7 +2692,7 @@ bool FrameLoader::shouldClose()
 
 bool FrameLoader::fireBeforeUnloadEvent(Chrome* chrome)
 {
-    DOMWindow* domWindow = m_frame->existingDOMWindow();
+    DOMWindow* domWindow = m_frame->document()->domWindow();
     if (!domWindow)
         return true;
 
index 74aa3af..0b065dd 100644 (file)
@@ -367,7 +367,7 @@ void MainResourceLoader::didReceiveResponse(const ResourceResponse& r)
         if (m_frame->loader()->shouldInterruptLoadForXFrameOptions(content, r.url())) {
             InspectorInstrumentation::continueAfterXFrameOptionsDenied(m_frame.get(), documentLoader(), identifier(), r);
             DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to display document because display forbidden by X-Frame-Options.\n"));
-            m_frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, consoleMessage);
+            m_frame->document()->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, consoleMessage);
 
             cancel();
             return;
index 2dfe34c..b4f1473 100644 (file)
@@ -469,7 +469,7 @@ void ApplicationCacheGroup::abort(Frame* frame)
     if (m_completionType != None)
         return;
 
-    frame->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, TipMessageLevel, "Application Cache download process was aborted.");
+    frame->document()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, TipMessageLevel, "Application Cache download process was aborted.");
     cacheUpdateFailed();
 }
 
@@ -563,7 +563,7 @@ void ApplicationCacheGroup::didReceiveResponse(ResourceHandle* handle, const Res
 
     if (response.httpStatusCode() / 100 != 2 || response.url() != m_currentHandle->firstRequest().url()) {
         if ((type & ApplicationCacheResource::Explicit) || (type & ApplicationCacheResource::Fallback)) {
-            m_frame->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache update failed, because " + m_currentHandle->firstRequest().url().string() + 
+            m_frame->document()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache update failed, because " + m_currentHandle->firstRequest().url().string() + 
                 ((response.httpStatusCode() / 100 != 2) ? " could not be fetched." : " was redirected."));
             // Note that cacheUpdateFailed() can cause the cache group to be deleted.
             cacheUpdateFailed();
@@ -640,7 +640,7 @@ void ApplicationCacheGroup::didFinishLoading(ResourceHandle* handle, double fini
     // FIXME: Should we break earlier and prevent redownloading on later page loads?
     if (m_originQuotaExceededPreviously && m_availableSpaceInQuota < m_cacheBeingUpdated->estimatedSizeInStorage()) {
         m_currentResource = 0;
-        m_frame->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache update failed, because size quota was exceeded.");
+        m_frame->document()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache update failed, because size quota was exceeded.");
         cacheUpdateFailed();
         return;
     }
@@ -673,7 +673,7 @@ void ApplicationCacheGroup::didFail(ResourceHandle* handle, const ResourceError&
     m_pendingEntries.remove(url);
 
     if ((type & ApplicationCacheResource::Explicit) || (type & ApplicationCacheResource::Fallback)) {
-        m_frame->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache update failed, because " + url.string() + " could not be fetched.");
+        m_frame->document()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache update failed, because " + url.string() + " could not be fetched.");
         // Note that cacheUpdateFailed() can cause the cache group to be deleted.
         cacheUpdateFailed();
     } else {
@@ -702,13 +702,13 @@ void ApplicationCacheGroup::didReceiveManifestResponse(const ResourceResponse& r
         return;
 
     if (response.httpStatusCode() / 100 != 2) {
-        m_frame->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache manifest could not be fetched.");
+        m_frame->document()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache manifest could not be fetched.");
         cacheUpdateFailed();
         return;
     }
 
     if (response.url() != m_manifestHandle->firstRequest().url()) {
-        m_frame->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache manifest could not be fetched, because a redirection was attempted.");
+        m_frame->document()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache manifest could not be fetched, because a redirection was attempted.");
         cacheUpdateFailed();
         return;
     }
@@ -728,7 +728,7 @@ void ApplicationCacheGroup::didFinishLoadingManifest()
 
     if (!isUpgradeAttempt && !m_manifestResource) {
         // The server returned 304 Not Modified even though we didn't send a conditional request.
-        m_frame->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache manifest could not be fetched because of an unexpected 304 Not Modified server response.");
+        m_frame->document()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache manifest could not be fetched because of an unexpected 304 Not Modified server response.");
         cacheUpdateFailed();
         return;
     }
@@ -754,7 +754,7 @@ void ApplicationCacheGroup::didFinishLoadingManifest()
     Manifest manifest;
     if (!parseManifest(m_manifestURL, m_manifestResource->data()->data(), m_manifestResource->data()->size(), manifest)) {
         // At the time of this writing, lack of "CACHE MANIFEST" signature is the only reason for parseManifest to fail.
-        m_frame->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache manifest could not be parsed. Does it start with CACHE MANIFEST?");
+        m_frame->document()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache manifest could not be parsed. Does it start with CACHE MANIFEST?");
         cacheUpdateFailed();
         return;
     }
@@ -943,7 +943,7 @@ void ApplicationCacheGroup::checkIfLoadIsComplete()
                 // We ran out of space for this origin. Fall down to the normal error handling
                 // after recording this state.
                 m_originQuotaExceededPreviously = true;
-                m_frame->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache update failed, because size quota was exceeded.");
+                m_frame->document()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache update failed, because size quota was exceeded.");
             }
 
             if (failureReason == ApplicationCacheStorage::TotalQuotaReached && !m_calledReachedMaxAppCacheSize) {
index 69ffb92..7b56465 100644 (file)
@@ -616,7 +616,7 @@ void CachedResourceLoader::printAccessDeniedMessage(const KURL& url) const
         message = "Unsafe attempt to load URL " + url.string() + " from frame with URL " + m_document->url().string() + ". Domains, protocols and ports must match.\n";
 
     // FIXME: provide line number and source URL.
-    frame()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, message);
+    frame()->document()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, message);
 }
 
 void CachedResourceLoader::setAutoLoadImages(bool enable)
index b8a3e98..391cac7 100644 (file)
@@ -594,7 +594,7 @@ void DOMWindow::clearDOMWindowProperties()
 
 bool DOMWindow::isCurrentlyDisplayedInFrame() const
 {
-    return m_frame && m_frame->domWindow() == this;
+    return m_frame && m_frame->document()->domWindow() == this;
 }
 
 #if ENABLE(ORIENTATION_EVENTS)
@@ -1260,7 +1260,7 @@ DOMWindow* DOMWindow::self() const
     if (!m_frame)
         return 0;
 
-    return m_frame->domWindow();
+    return m_frame->document()->domWindow();
 }
 
 DOMWindow* DOMWindow::opener() const
@@ -1272,7 +1272,7 @@ DOMWindow* DOMWindow::opener() const
     if (!opener)
         return 0;
 
-    return opener->domWindow();
+    return opener->document()->domWindow();
 }
 
 DOMWindow* DOMWindow::parent() const
@@ -1282,9 +1282,9 @@ DOMWindow* DOMWindow::parent() const
 
     Frame* parent = m_frame->tree()->parent();
     if (parent)
-        return parent->domWindow();
+        return parent->document()->domWindow();
 
-    return m_frame->domWindow();
+    return m_frame->document()->domWindow();
 }
 
 DOMWindow* DOMWindow::top() const
@@ -1296,7 +1296,7 @@ DOMWindow* DOMWindow::top() const
     if (!page)
         return 0;
 
-    return m_frame->tree()->top()->domWindow();
+    return m_frame->tree()->top()->document()->domWindow();
 }
 
 Document* DOMWindow::document() const
@@ -1823,11 +1823,11 @@ Frame* DOMWindow::createWindow(const String& urlString, const AtomicString& fram
     newFrame->loader()->setOpener(openerFrame);
     newFrame->page()->setOpenedByDOM();
 
-    if (newFrame->domWindow()->isInsecureScriptAccess(activeWindow, completedURL))
+    if (newFrame->document()->domWindow()->isInsecureScriptAccess(activeWindow, completedURL))
         return newFrame;
 
     if (function)
-        function(newFrame->domWindow(), functionContext);
+        function(newFrame->document()->domWindow(), functionContext);
 
     if (created)
         newFrame->loader()->changeLocation(activeWindow->securityOrigin(), completedURL, referrer, false, false);
@@ -1875,11 +1875,11 @@ PassRefPtr<DOMWindow> DOMWindow::open(const String& urlString, const AtomicStrin
 
         KURL completedURL = firstFrame->document()->completeURL(urlString);
 
-        if (targetFrame->domWindow()->isInsecureScriptAccess(activeWindow, completedURL))
-            return targetFrame->domWindow();
+        if (targetFrame->document()->domWindow()->isInsecureScriptAccess(activeWindow, completedURL))
+            return targetFrame->document()->domWindow();
 
         if (urlString.isEmpty())
-            return targetFrame->domWindow();
+            return targetFrame->document()->domWindow();
 
         // For whatever reason, Firefox uses the first window rather than the active window to
         // determine the outgoing referrer. We replicate that behavior here.
@@ -1890,7 +1890,7 @@ PassRefPtr<DOMWindow> DOMWindow::open(const String& urlString, const AtomicStrin
             firstFrame->loader()->outgoingReferrer(),
             lockHistory,
             false);
-        return targetFrame->domWindow();
+        return targetFrame->document()->domWindow();
     }
 
     WindowFeatures windowFeatures(windowFeaturesString);
@@ -1904,7 +1904,7 @@ PassRefPtr<DOMWindow> DOMWindow::open(const String& urlString, const AtomicStrin
     windowFeatures.width = windowRect.width();
 
     Frame* result = createWindow(urlString, frameName, windowFeatures, activeWindow, firstFrame, m_frame);
-    return result ? result->domWindow() : 0;
+    return result ? result->document()->domWindow() : 0;
 }
 
 void DOMWindow::showModalDialog(const String& urlString, const String& dialogFeaturesString,
index ad04698..6f109f1 100644 (file)
@@ -28,6 +28,7 @@
 #include "DOMWindowProperty.h"
 
 #include "DOMWindow.h"
+#include "Document.h"
 #include "Frame.h"
 
 namespace WebCore {
@@ -40,7 +41,7 @@ DOMWindowProperty::DOMWindowProperty(Frame* frame)
     // See fast/dom/navigator-detached-no-crash.html for the recipe.
     // We should fix that.  <rdar://problem/11567132>
     if (m_frame) {
-        m_associatedDOMWindow = m_frame->domWindow();
+        m_associatedDOMWindow = m_frame->document()->domWindow();
         m_associatedDOMWindow->registerProperty(this);
     }
 }
@@ -70,7 +71,7 @@ void DOMWindowProperty::reconnectFrameFromPageCache(Frame* frame)
     // been disconnected from its Frame in the first place and it should still have an associated DOMWindow.
     ASSERT(frame);
     ASSERT(!m_frame);
-    ASSERT(frame->domWindow() == m_associatedDOMWindow);
+    ASSERT(frame->document()->domWindow() == m_associatedDOMWindow);
 
     m_frame = frame;
 }
index b820575..c744c18 100644 (file)
@@ -423,7 +423,7 @@ bool DragController::dispatchTextInputEventFor(Frame* innerFrame, DragData* drag
     String text = m_page->dragCaretController()->isContentRichlyEditable() ? "" : dragData->asPlainText(innerFrame);
     Node* target = innerFrame->editor()->findEventTargetFrom(m_page->dragCaretController()->caretPosition());
     ExceptionCode ec = 0;
-    return target->dispatchEvent(TextEvent::createForDrop(innerFrame->domWindow(), text), ec);
+    return target->dispatchEvent(TextEvent::createForDrop(innerFrame->document()->domWindow(), text), ec);
 }
 
 bool DragController::concludeEditDrag(DragData* dragData)
index 486d4bf..3dffb9f 100644 (file)
@@ -3292,7 +3292,7 @@ bool EventHandler::handleTextInputEvent(const String& text, Event* underlyingEve
     if (FrameView* view = m_frame->view())
         view->resetDeferredRepaintDelay();
 
-    RefPtr<TextEvent> event = TextEvent::create(m_frame->domWindow(), text, inputType);
+    RefPtr<TextEvent> event = TextEvent::create(m_frame->document()->domWindow(), text, inputType);
     event->setUnderlyingEvent(underlyingEvent);
 
     ExceptionCode ec;
index 38bea75..2abc1fd 100644 (file)
@@ -680,12 +680,6 @@ void Frame::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     info.addInstrumentedMember(m_loader);
 }
 
-DOMWindow* Frame::domWindow() const
-{
-    ASSERT(m_doc->domWindow());
-    return m_doc->domWindow();
-}
-
 void Frame::willDetachPage()
 {
     if (Frame* parent = tree()->parent())
index 30e6d5c..3a52956 100644 (file)
@@ -128,10 +128,6 @@ namespace WebCore {
         
         String layerTreeAsText(bool showDebugInfo = false) const;
 
-        // FIXME: Callers should use document()->domWindow() directly.
-        DOMWindow* domWindow() const;
-        DOMWindow* existingDOMWindow() { return domWindow(); }
-
         static Frame* frameForWidget(const Widget*);
 
         Settings* settings() const; // can be NULL
index df6ea8d..d44eff9 100644 (file)
@@ -241,7 +241,7 @@ void Location::replace(const String& url, DOMWindow* activeWindow, DOMWindow* fi
     if (!m_frame)
         return;
     // Note: We call DOMWindow::setLocation directly here because replace() always operates on the current frame.
-    m_frame->domWindow()->setLocation(url, activeWindow, firstWindow, LockHistoryAndBackForwardList);
+    m_frame->document()->domWindow()->setLocation(url, activeWindow, firstWindow, LockHistoryAndBackForwardList);
 }
 
 void Location::reload(DOMWindow* activeWindow)
@@ -251,7 +251,7 @@ void Location::reload(DOMWindow* activeWindow)
     // FIXME: It's not clear this cross-origin security check is valuable.
     // We allow one page to change the location of another. Why block attempts to reload?
     // Other location operations simply block use of JavaScript URLs cross origin.
-    DOMWindow* targetWindow = m_frame->domWindow();
+    DOMWindow* targetWindow = m_frame->document()->domWindow();
     if (!activeWindow->securityOrigin()->canAccess(targetWindow->securityOrigin())) {
         targetWindow->printErrorMessage(targetWindow->crossDomainAccessErrorMessage(activeWindow));
         return;
@@ -268,7 +268,7 @@ void Location::setLocation(const String& url, DOMWindow* activeWindow, DOMWindow
     Frame* frame = m_frame->loader()->findFrameForNavigation(String(), activeWindow->document());
     if (!frame)
         return;
-    frame->domWindow()->setLocation(url, activeWindow, firstWindow);
+    frame->document()->domWindow()->setLocation(url, activeWindow, firstWindow);
 }
 
 } // namespace WebCore
index 7cb368b..d450210 100644 (file)
@@ -57,7 +57,7 @@ void StorageEventDispatcher::dispatch(const String& key, const String& oldValue,
 
         for (unsigned i = 0; i < frames.size(); ++i) {
             ExceptionCode ec = 0;
-            Storage* storage = frames[i]->domWindow()->sessionStorage(ec);
+            Storage* storage = frames[i]->document()->domWindow()->sessionStorage(ec);
             if (!ec)
                 frames[i]->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage));
         }
@@ -75,7 +75,7 @@ void StorageEventDispatcher::dispatch(const String& key, const String& oldValue,
 
         for (unsigned i = 0; i < frames.size(); ++i) {
             ExceptionCode ec = 0;
-            Storage* storage = frames[i]->domWindow()->localStorage(ec);
+            Storage* storage = frames[i]->document()->domWindow()->localStorage(ec);
             if (!ec)
                 frames[i]->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage));
         }
index 152ce8b..cac1aea 100644 (file)
@@ -196,8 +196,8 @@ static int parserLineNumber(Document* document)
 
 static void reportMessage(Document* document, MessageLevel level, const String& message)
 {
-    if (Frame* frame = document->frame())
-        frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, level, message, document->documentURI(), parserLineNumber(document));
+    if (document->frame())
+        document->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, level, message, document->documentURI(), parserLineNumber(document));
 }
 
 void SVGDocumentExtensions::reportWarning(const String& message)
index a18b7b1..0b8340c 100644 (file)
@@ -145,8 +145,8 @@ bool XSLStyleSheet::parseString(const String& string)
     m_stylesheetDocTaken = false;
 
     Console* console = 0;
-    if (Frame* frame = ownerDocument()->frame())
-        console = frame->domWindow()->console();
+    if (ownerDocument()->frame())
+        console = ownerDocument()->domWindow()->console();
 
     XMLDocumentParserScope scope(cachedResourceLoader(), XSLTProcessor::genericErrorFunc, XSLTProcessor::parseErrorFunc, console);
 
index 076a852..e21c827 100644 (file)
@@ -138,8 +138,8 @@ static xmlDocPtr docLoaderFunc(const xmlChar* uri,
         }
 
         Console* console = 0;
-        if (Frame* frame = globalProcessor->xslStylesheet()->ownerDocument()->frame())
-            console = frame->domWindow()->console();
+        if (globalProcessor->xslStylesheet()->ownerDocument()->frame())
+            console = globalProcessor->xslStylesheet()->ownerDocument()->domWindow()->console();
         xmlSetStructuredErrorFunc(console, XSLTProcessor::parseErrorFunc);
         xmlSetGenericErrorFunc(console, XSLTProcessor::genericErrorFunc);
 
index c0ab4d6..a67c5fd 100644 (file)
@@ -83,9 +83,8 @@ void XSLTMessageHandler::handleMessage(QtMsgType type, const QString& descriptio
         break;
     }
 
-    Console* console = m_document->frame()->domWindow()->console();
-    console->addMessage(XMLMessageSource, LogMessageType, level, description,
-                        sourceLocation.uri().toString(), sourceLocation.line());
+    Console* console = m_document->domWindow()->console();
+    console->addMessage(XMLMessageSource, LogMessageType, level, description, sourceLocation.uri().toString(), sourceLocation.line());
 }
 
 class XSLTUriResolver : public QAbstractUriResolver {
index 9e83cf6..7d25ade 100644 (file)
@@ -1,3 +1,18 @@
+2012-08-14  Adam Barth  <abarth@webkit.org>
+
+        Delete Frame::domWindow() and Frame::existingDOMWindow()
+        https://bugs.webkit.org/show_bug.cgi?id=93990
+
+        Reviewed by Eric Seidel.
+
+        * WebCoreSupport/ChromeClientBlackBerry.cpp:
+        (WebCore::toOriginString):
+        (WebCore::ChromeClientBlackBerry::runJavaScriptAlert):
+        (WebCore::ChromeClientBlackBerry::runJavaScriptConfirm):
+        (WebCore::ChromeClientBlackBerry::runJavaScriptPrompt):
+        (WebCore::ChromeClientBlackBerry::runBeforeUnloadConfirmPanel):
+        (WebCore::ChromeClientBlackBerry::requestWebGLPermission):
+
 2012-08-14  Leo Yang  <leoyang@rim.com>
 
         [BlackBerry] Checkerboard flashes on Go Back
index b0dae60..08c11dd 100644 (file)
@@ -78,12 +78,9 @@ using BlackBerry::Platform::Graphics::Window;
 
 namespace WebCore {
 
-static CString frameOrigin(Frame* frame)
+static CString toOriginString(Frame* frame)
 {
-    DOMWindow* window = frame->domWindow();
-    SecurityOrigin* origin = window->securityOrigin();
-    CString latinOrigin = origin->toString().latin1();
-    return latinOrigin;
+    return frame->document()->securityOrigin()->toString().latin1();
 }
 
 ChromeClientBlackBerry::ChromeClientBlackBerry(WebPagePrivate* pagePrivate)
@@ -111,7 +108,7 @@ void ChromeClientBlackBerry::runJavaScriptAlert(Frame* frame, const String& mess
 #endif
 
     TimerBase::fireTimersInNestedEventLoop();
-    CString latinOrigin = frameOrigin(frame);
+    CString latinOrigin = toOriginString(frame);
     m_webPagePrivate->m_client->runJavaScriptAlert(message.characters(), message.length(), latinOrigin.data(), latinOrigin.length());
 }
 
@@ -123,7 +120,7 @@ bool ChromeClientBlackBerry::runJavaScriptConfirm(Frame* frame, const String& me
 #endif
 
     TimerBase::fireTimersInNestedEventLoop();
-    CString latinOrigin = frameOrigin(frame);
+    CString latinOrigin = toOriginString(frame);
     return m_webPagePrivate->m_client->runJavaScriptConfirm(message.characters(), message.length(), latinOrigin.data(), latinOrigin.length());
 }
 
@@ -137,7 +134,7 @@ bool ChromeClientBlackBerry::runJavaScriptPrompt(Frame* frame, const String& mes
 #endif
 
     TimerBase::fireTimersInNestedEventLoop();
-    CString latinOrigin = frameOrigin(frame);
+    CString latinOrigin = toOriginString(frame);
     WebString clientResult;
     if (m_webPagePrivate->m_client->runJavaScriptPrompt(message.characters(), message.length(), defaultValue.characters(), defaultValue.length(), latinOrigin.data(), latinOrigin.length(), clientResult)) {
         result = clientResult;
@@ -386,7 +383,7 @@ bool ChromeClientBlackBerry::runBeforeUnloadConfirmPanel(const String& message,
 #endif
 
     TimerBase::fireTimersInNestedEventLoop();
-    CString latinOrigin = frameOrigin(frame);
+    CString latinOrigin = toOriginString(frame);
     return m_webPagePrivate->m_client->runBeforeUnloadConfirmPanel(message.characters(), message.length(), latinOrigin.data(), latinOrigin.length());
 }
 
@@ -768,7 +765,7 @@ void ChromeClientBlackBerry::fullScreenRendererChanged(RenderBox* fullScreenRend
 void ChromeClientBlackBerry::requestWebGLPermission(Frame* frame)
 {
     if (frame) {
-        CString latinOrigin = frameOrigin(frame);
+        CString latinOrigin = toOriginString(frame);
         m_webPagePrivate->m_client->requestWebGLPermission(latinOrigin.data());
     }
 }
index 28be4bb..896e994 100644 (file)
@@ -1,3 +1,27 @@
+2012-08-14  Adam Barth  <abarth@webkit.org>
+
+        Delete Frame::domWindow() and Frame::existingDOMWindow()
+        https://bugs.webkit.org/show_bug.cgi?id=93990
+
+        Reviewed by Eric Seidel.
+
+        * src/StorageAreaProxy.cpp:
+        (WebCore::StorageAreaProxy::dispatchLocalStorageEvent):
+        (WebCore::StorageAreaProxy::dispatchSessionStorageEvent):
+        * src/WebDOMMessageEvent.cpp:
+        (WebKit::WebDOMMessageEvent::initMessageEvent):
+        * src/WebFrameImpl.cpp:
+        (WebKit::WebFrameImpl::performance):
+        (WebKit::WebFrameImpl::addMessageToConsole):
+        (WebKit::WebFrameImpl::unloadListenerCount):
+        (WebKit::WebFrameImpl::addEventListener):
+        (WebKit::WebFrameImpl::removeEventListener):
+        (WebKit::WebFrameImpl::dispatchEvent):
+        (WebKit::WebFrameImpl::dispatchMessageEventWithOriginCheck):
+        (WebKit::WebFrameImpl::deliverIntent):
+        * src/WebPagePopupImpl.cpp:
+        (WebKit::WebPagePopupImpl::initPage):
+
 2012-08-14  Iain Merrick  <husky@chromium.org>
 
         [chromium] Add a test to WebFrameTest for selectRange and visiblePositionForWindowPoint.
index 722e80f..efa0c90 100644 (file)
@@ -131,7 +131,7 @@ void StorageAreaProxy::dispatchLocalStorageEvent(PageGroup* pageGroup, const Str
     const HashSet<Page*>& pages = pageGroup->pages();
     for (HashSet<Page*>::const_iterator it = pages.begin(); it != pages.end(); ++it) {
         for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
-            Storage* storage = frame->domWindow()->optionalLocalStorage();
+            Storage* storage = frame->document()->domWindow()->optionalLocalStorage();
             if (storage && frame->document()->securityOrigin()->equal(securityOrigin) && !isEventSource(storage, sourceAreaInstance))
                 frame->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, pageURL, storage));
         }
@@ -160,7 +160,7 @@ void StorageAreaProxy::dispatchSessionStorageEvent(PageGroup* pageGroup, const S
         return;
 
     for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
-        Storage* storage = frame->domWindow()->optionalSessionStorage();
+        Storage* storage = frame->document()->domWindow()->optionalSessionStorage();
         if (storage && frame->document()->securityOrigin()->equal(securityOrigin) && !isEventSource(storage, sourceAreaInstance))
             frame->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, pageURL, storage));
     }
index 53ea43c..06cf66f 100644 (file)
@@ -32,6 +32,7 @@
 #include "WebDOMMessageEvent.h"
 
 #include "DOMWindow.h"
+#include "Document.h"
 #include "MessageEvent.h"
 #include "MessagePort.h"
 #include "PlatformMessagePortChannel.h"
@@ -55,7 +56,7 @@ void WebDOMMessageEvent::initMessageEvent(const WebString& type, bool canBubble,
     ASSERT(isMessageEvent());
     DOMWindow* window = 0;
     if (sourceFrame)
-        window = static_cast<const WebFrameImpl*>(sourceFrame)->frame()->domWindow();
+        window = static_cast<const WebFrameImpl*>(sourceFrame)->frame()->document()->domWindow();
     OwnPtr<MessagePortArray> ports;
     unwrap<MessageEvent>()->initMessageEvent(type, canBubble, cancelable, messageData, origin, lastEventId, window, ports.release());
 }
index 67d81ad..a1f3eab 100644 (file)
@@ -809,10 +809,10 @@ WebAnimationController* WebFrameImpl::animationController()
 
 WebPerformance WebFrameImpl::performance() const
 {
-    if (!m_frame || !m_frame->domWindow())
+    if (!m_frame)
         return WebPerformance();
 
-    return WebPerformance(m_frame->domWindow()->performance());
+    return WebPerformance(m_frame->document()->domWindow()->performance());
 }
 
 NPObject* WebFrameImpl::windowObject() const
@@ -887,7 +887,7 @@ void WebFrameImpl::addMessageToConsole(const WebConsoleMessage& message)
         return;
     }
 
-    frame()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, webCoreMessageLevel, message.text);
+    frame()->document()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, webCoreMessageLevel, message.text);
 }
 
 void WebFrameImpl::collectGarbage()
@@ -1180,7 +1180,7 @@ void WebFrameImpl::commitDocumentData(const char* data, size_t length)
 
 unsigned WebFrameImpl::unloadListenerCount() const
 {
-    return frame()->domWindow()->pendingUnloadEventListeners();
+    return frame()->document()->domWindow()->pendingUnloadEventListeners();
 }
 
 bool WebFrameImpl::isProcessingUserGesture() const
@@ -1956,34 +1956,29 @@ void WebFrameImpl::sendOrientationChangeEvent(int orientation)
 
 void WebFrameImpl::addEventListener(const WebString& eventType, WebDOMEventListener* listener, bool useCapture)
 {
-    DOMWindow* window = m_frame->domWindow();
-
-    EventListenerWrapper* listenerWrapper =
-        listener->createEventListenerWrapper(eventType, useCapture, window);
-
-    m_frame->domWindow()->addEventListener(eventType, adoptRef(listenerWrapper), useCapture);
+    DOMWindow* window = m_frame->document()->domWindow();
+    EventListenerWrapper* listenerWrapper = listener->createEventListenerWrapper(eventType, useCapture, window);
+    window->addEventListener(eventType, adoptRef(listenerWrapper), useCapture);
 }
 
 void WebFrameImpl::removeEventListener(const WebString& eventType, WebDOMEventListener* listener, bool useCapture)
 {
-    DOMWindow* window = m_frame->domWindow();
-
-    EventListenerWrapper* listenerWrapper =
-        listener->getEventListenerWrapper(eventType, useCapture, window);
+    DOMWindow* window = m_frame->document()->domWindow();
+    EventListenerWrapper* listenerWrapper = listener->getEventListenerWrapper(eventType, useCapture, window);
     window->removeEventListener(eventType, listenerWrapper, useCapture);
 }
 
 bool WebFrameImpl::dispatchEvent(const WebDOMEvent& event)
 {
     ASSERT(!event.isNull());
-    return m_frame->domWindow()->dispatchEvent(event);
+    return m_frame->document()->domWindow()->dispatchEvent(event);
 }
 
 void WebFrameImpl::dispatchMessageEventWithOriginCheck(const WebSecurityOrigin& intendedTargetOrigin, const WebDOMEvent& event)
 {
     ASSERT(!event.isNull());
     // Pass an empty call stack, since we don't have the one from the other process.
-    m_frame->domWindow()->dispatchMessageEventWithOriginCheck(intendedTargetOrigin.get(), event, 0);
+    m_frame->document()->domWindow()->dispatchMessageEventWithOriginCheck(intendedTargetOrigin.get(), event, 0);
 }
 
 int WebFrameImpl::findMatchMarkersVersion() const
@@ -2190,11 +2185,11 @@ void WebFrameImpl::deliverIntent(const WebIntent& intent, WebMessagePortChannelA
             (*channels)[i] = MessagePortChannel::create(platformChannel);
         }
     }
-    OwnPtr<MessagePortArray> portArray = WebCore::MessagePort::entanglePorts(*(m_frame->domWindow()->scriptExecutionContext()), channels.release());
+    OwnPtr<MessagePortArray> portArray = WebCore::MessagePort::entanglePorts(*(m_frame->document()), channels.release());
 
     RefPtr<DeliveredIntent> deliveredIntent = DeliveredIntent::create(m_frame, client.release(), intent.action(), intent.type(), intentData, portArray.release(), webcoreIntent->extras());
 
-    DOMWindowIntents::from(m_frame->domWindow())->deliver(deliveredIntent.release());
+    DOMWindowIntents::from(m_frame->document()->domWindow())->deliver(deliveredIntent.release());
 #endif
 }
 
index 18f5de2..e853267 100644 (file)
@@ -198,8 +198,7 @@ bool WebPagePopupImpl::initPage()
     m_popupClient->writeDocument(*writer);
     writer->end();
 
-    ASSERT(frame->existingDOMWindow());
-    DOMWindowPagePopup::install(frame->existingDOMWindow(), m_popupClient);
+    DOMWindowPagePopup::install(frame->document()->domWindow(), m_popupClient);
     return true;
 }
 
index b77ef36..8a26780 100644 (file)
@@ -1,3 +1,15 @@
+2012-08-14  Adam Barth  <abarth@webkit.org>
+
+        Delete Frame::domWindow() and Frame::existingDOMWindow()
+        https://bugs.webkit.org/show_bug.cgi?id=93990
+
+        Reviewed by Eric Seidel.
+
+        * WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
+        (DumpRenderTreeSupportEfl::pendingUnloadEventCount):
+        * ewk/ewk_frame.cpp:
+        (ewk_frame_intent_deliver):
+
 2012-08-13  Tom Sepez  <tsepez@chromium.org>
 
         [chromium] release FrameLoaderClientImpl::m_pluginWidget refptr upon Plugin Document detach.
index 4b804dd..96a5791 100644 (file)
@@ -225,7 +225,7 @@ bool DumpRenderTreeSupportEfl::pauseTransition(Evas_Object* ewkFrame, const char
 unsigned DumpRenderTreeSupportEfl::pendingUnloadEventCount(const Evas_Object* ewkFrame)
 {
     if (WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame))
-        return frame->domWindow()->pendingUnloadEventListeners();
+        return frame->document()->domWindow()->pendingUnloadEventListeners();
 
     return 0;
 }
index e8fec6d..7231b54 100644 (file)
@@ -766,12 +766,12 @@ void ewk_frame_intent_deliver(const Evas_Object* ewkFrame, Ewk_Intent* ewk_inten
         for (size_t i = 0; i < origChannels->size(); ++i)
             (*channels)[i] = origChannels->at(i).release();
     }
-    OwnPtr<WebCore::MessagePortArray> ports = WebCore::MessagePort::entanglePorts(*(smartData->frame->domWindow()->scriptExecutionContext()), channels.release());
+    OwnPtr<WebCore::MessagePortArray> ports = WebCore::MessagePort::entanglePorts(*(smartData->frame->document()), channels.release());
 
     OwnPtr<WebCore::DeliveredIntentClient> dummyClient;
     RefPtr<WebCore::DeliveredIntent> deliveredIntent = WebCore::DeliveredIntent::create(smartData->frame, dummyClient.release(), intent->action(), intent->type(), intent->data(), ports.release(), intent->extras());
 
-    WebCore::DOMWindowIntents::from(smartData->frame->domWindow())->deliver(deliveredIntent.release());
+    WebCore::DOMWindowIntents::from(smartData->frame->document()->domWindow())->deliver(deliveredIntent.release());
 #endif
 }
 
index 239bcb0..2586683 100644 (file)
@@ -1,3 +1,13 @@
+2012-08-14  Adam Barth  <abarth@webkit.org>
+
+        Delete Frame::domWindow() and Frame::existingDOMWindow()
+        https://bugs.webkit.org/show_bug.cgi?id=93990
+
+        Reviewed by Eric Seidel.
+
+        * WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
+        (DumpRenderTreeSupportGtk::getPendingUnloadEventCount):
+
 2012-08-13  Tom Sepez  <tsepez@chromium.org>
 
         [chromium] release FrameLoaderClientImpl::m_pluginWidget refptr upon Plugin Document detach.
index 00febc8..c76dce9 100644 (file)
@@ -279,7 +279,7 @@ guint DumpRenderTreeSupportGtk::getPendingUnloadEventCount(WebKitWebFrame* frame
 {
     g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), 0);
 
-    return core(frame)->domWindow()->pendingUnloadEventListeners();
+    return core(frame)->document()->domWindow()->pendingUnloadEventListeners();
 }
 
 bool DumpRenderTreeSupportGtk::pauseAnimation(WebKitWebFrame* frame, const char* name, double time, const char* element)
index 626d6ae..b3ad15c 100644 (file)
@@ -1,3 +1,14 @@
+2012-08-14  Adam Barth  <abarth@webkit.org>
+
+        Delete Frame::domWindow() and Frame::existingDOMWindow()
+        https://bugs.webkit.org/show_bug.cgi?id=93990
+
+        Reviewed by Eric Seidel.
+
+        * WebView/WebFrame.mm:
+        (-[WebFrame _pendingFrameUnloadEventCount]):
+        (-[WebFrame _cacheabilityDictionary]):
+
 2012-08-14  Tom Sepez  <tsepez@chromium.org>
 
         REGRESSION r125500: 7 tests crashing on Mac bots
index 0ad0eca..92f9e0b 100644 (file)
@@ -906,7 +906,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
 
 - (unsigned)_pendingFrameUnloadEventCount
 {
-    return _private->coreFrame->domWindow()->pendingUnloadEventListeners();
+    return _private->coreFrame->document()->domWindow()->pendingUnloadEventListeners();
 }
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
@@ -1067,7 +1067,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
     if (frameLoader->subframeLoader()->containsPlugins())
         [result setObject:[NSNumber numberWithBool:YES] forKey:WebFrameHasPlugins];
     
-    if (DOMWindow* domWindow = _private->coreFrame->domWindow()) {
+    if (DOMWindow* domWindow = _private->coreFrame->document()->domWindow()) {
         if (domWindow->hasEventListeners(eventNames().unloadEvent))
             [result setObject:[NSNumber numberWithBool:YES] forKey:WebFrameHasUnloadListener];
         if (domWindow->optionalApplicationCache())
index da88a26..1ed2e59 100644 (file)
@@ -1,3 +1,13 @@
+2012-08-14  Adam Barth  <abarth@webkit.org>
+
+        Delete Frame::domWindow() and Frame::existingDOMWindow()
+        https://bugs.webkit.org/show_bug.cgi?id=93990
+
+        Reviewed by Eric Seidel.
+
+        * WebCoreSupport/FrameLoaderClientQt.cpp:
+        (WebCore::FrameLoaderClientQt::dispatchDidFinishDocumentLoad):
+
 2012-08-14  Lauro Neto  <lauro.neto@openbossa.org>
 
         Convert signals/slots to Q_* macros.
index a170336..bcf072d 100644 (file)
@@ -503,7 +503,7 @@ void FrameLoaderClientQt::dispatchDidFinishDocumentLoad()
         printf("%s - didFinishDocumentLoadForFrame\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame)));
 
     if (QWebPagePrivate::drtRun) {
-        int unloadEventCount = m_frame->domWindow()->pendingUnloadEventListeners();
+        int unloadEventCount = m_frame->document()->domWindow()->pendingUnloadEventListeners();
         if (unloadEventCount)
             printf("%s - has %u onunload handler(s)\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame)), unloadEventCount);
     }
index 8eba8bf..dbbb155 100644 (file)
@@ -1,3 +1,14 @@
+2012-08-14  Adam Barth  <abarth@webkit.org>
+
+        Delete Frame::domWindow() and Frame::existingDOMWindow()
+        https://bugs.webkit.org/show_bug.cgi?id=93990
+
+        Reviewed by Eric Seidel.
+
+        * WebFrame.cpp:
+        (WebFrame::DOMWindow):
+        (WebFrame::pendingFrameUnloadEventCount):
+
 2012-08-13  Tom Sepez  <tsepez@chromium.org>
 
         [chromium] release FrameLoaderClientImpl::m_pluginWidget refptr upon Plugin Document detach.
index ff560c6..d1880cf 100644 (file)
@@ -478,7 +478,7 @@ HRESULT WebFrame::DOMWindow(/* [retval][out] */ IDOMWindow** window)
     *window = 0;
 
     if (Frame* coreFrame = core(this)) {
-        if (WebCore::DOMWindow* coreWindow = coreFrame->domWindow())
+        if (WebCore::DOMWindow* coreWindow = coreFrame->document()->domWindow())
             *window = ::DOMWindow::createInstance(coreWindow);
     }
 
@@ -989,7 +989,7 @@ HRESULT STDMETHODCALLTYPE WebFrame::pendingFrameUnloadEventCount(
     if (!coreFrame)
         return E_FAIL;
 
-    *result = coreFrame->domWindow()->pendingUnloadEventListeners();
+    *result = coreFrame->document()->domWindow()->pendingUnloadEventListeners();
     return S_OK;
 }
 
index 6c30c43..9a2df1d 100644 (file)
@@ -1,3 +1,14 @@
+2012-08-14  Adam Barth  <abarth@webkit.org>
+
+        Delete Frame::domWindow() and Frame::existingDOMWindow()
+        https://bugs.webkit.org/show_bug.cgi?id=93990
+
+        Reviewed by Eric Seidel.
+
+        * WebProcess/WebPage/WebFrame.cpp:
+        (WebKit::WebFrame::deliverIntent):
+        (WebKit::WebFrame::pendingUnloadCount):
+
 2012-08-14  Lauro Neto  <lauro.neto@openbossa.org>
 
         Convert signals/slots to Q_* macros.
index f36fc02..19243be 100644 (file)
@@ -251,7 +251,7 @@ void WebFrame::deliverIntent(const IntentData& intentData)
     RefPtr<DeliveredIntent> deliveredIntent = DeliveredIntent::create(m_coreFrame, dummyClient.release(), intentData.action, intentData.type,
                                                                       SerializedScriptValue::adopt(dataCopy), dummyPorts.release(),
                                                                       intentData.extras);
-    WebCore::DOMWindowIntents::from(m_coreFrame->domWindow())->deliver(deliveredIntent.release());
+    WebCore::DOMWindowIntents::from(m_coreFrame->document()->domWindow())->deliver(deliveredIntent.release());
 }
 #endif
 
@@ -493,7 +493,7 @@ unsigned WebFrame::pendingUnloadCount() const
     if (!m_coreFrame)
         return 0;
 
-    return m_coreFrame->domWindow()->pendingUnloadEventListeners();
+    return m_coreFrame->document()->domWindow()->pendingUnloadEventListeners();
 }
 
 bool WebFrame::allowsFollowingLink(const WebCore::KURL& url) const