WebCore:
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Nov 2006 05:52:27 +0000 (05:52 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Nov 2006 05:52:27 +0000 (05:52 +0000)
        Reviewed by Geoff.

        - moved loader code from Frame/FrameMac to FrameLoader

        * WebCore.exp:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSXSLTProcessor.h:
        * bindings/js/kjs_events.cpp:
        (KJS::JSLazyEventListener::parseCode):
        * bindings/js/kjs_html.cpp:
        (KJS::JSHTMLDocument::putValueProperty):
        * bindings/js/kjs_navigator.cpp:
        (KJS::Navigator::getValueProperty):
        * bindings/js/kjs_proxy.cpp:
        (WebCore::KJSProxy::initScriptIfNeeded):
        * bindings/js/kjs_window.cpp:
        (KJS::Screen::Screen):
        (KJS::createNewWindow):
        (KJS::Window::getValueProperty):
        (KJS::Window::put):
        (KJS::Window::isSafeScript):
        (KJS::WindowFunc::callAsFunction):
        (KJS::ScheduledAction::execute):
        (KJS::Location::getValueProperty):
        (KJS::Location::put):
        (KJS::Location::toString):
        (KJS::LocationFunc::callAsFunction):
        (KJS::History::getValueProperty):
        (KJS::HistoryFunc::callAsFunction):
        * bindings/objc/DOM.mm:
        (+[DOMNode _nodeWith:WebCore::]):
        * bridge/mac/FrameMac.h:
        * bridge/mac/FrameMac.mm:
        (WebCore::FrameMac::~FrameMac):
        (WebCore::FrameMac::setView):
        (WebCore::FrameMac::setStatusBarText):
        * bridge/mac/WebCoreFrameBridge.h:
        * bridge/mac/WebCoreFrameBridge.mm:
        (-[WebCoreFrameBridge close]):
        (-[WebCoreFrameBridge addData:]):
        (-[WebCoreFrameBridge createFrameViewWithNSView:marginWidth:marginHeight:]):
        (-[WebCoreFrameBridge reapplyStylesForDeviceType:]):
        (-[WebCoreFrameBridge stringByEvaluatingJavaScriptFromString:forceUserGesture:]):
        (-[WebCoreFrameBridge aeDescByEvaluatingJavaScriptFromString:]):
        (-[WebCoreFrameBridge baseURL]):
        (-[WebCoreFrameBridge dragOperationForDraggingInfo:]):
        (-[WebCoreFrameBridge dragExitedWithDraggingInfo:]):
        (-[WebCoreFrameBridge canProvideDocumentSource]):
        (-[WebCoreFrameBridge receivedData:textEncodingName:]):
        * css/cssparser.cpp:
        (WebCore::CSSParser::parseContent):
        * dom/DOMImplementation.cpp:
        (WebCore::DOMImplementation::createDocument):
        (WebCore::DOMImplementation::createHTMLDocument):
        * dom/DOMImplementation.h:
        * dom/Document.cpp:
        (WebCore::Document::readyState):
        (WebCore::Document::updateTitle):
        (WebCore::Document::open):
        (WebCore::Document::close):
        (WebCore::Document::implicitClose):
        (WebCore::Document::processHttpEquiv):
        (WebCore::Document::referrer):
        (WebCore::Document::finishedParsing):
        * dom/ProcessingInstruction.cpp:
        (WebCore::ProcessingInstruction::checkStyleSheet):
        * dom/XMLTokenizer.cpp:
        (WebCore::XMLTokenizer::endElementNs):
        (WebCore::ignorableWhitespaceHandler):
        (WebCore::XMLTokenizer::notifyFinished):
        * editing/TextIterator.cpp:
        (WebCore::TextIterator::rangeFromLocationAndLength):
        * html/HTMLAnchorElement.cpp:
        (WebCore::HTMLAnchorElement::defaultEventHandler):
        * html/HTMLBaseElement.cpp:
        (WebCore::HTMLBaseElement::process):
        * html/HTMLDocument.cpp:
        (WebCore::HTMLDocument::lastModified):
        * html/HTMLFormElement.cpp:
        (WebCore::HTMLFormElement::formData):
        (WebCore::HTMLFormElement::submit):
        * html/HTMLFrameElementBase.cpp:
        (WebCore::HTMLFrameElementBase::isURLAllowed):
        (WebCore::HTMLFrameElementBase::openURL):
        (WebCore::HTMLFrameElementBase::willRemove):
        * html/HTMLInputElement.cpp:
        (WebCore::HTMLInputElement::setValueFromRenderer):
        * html/HTMLLinkElement.cpp:
        (WebCore::HTMLLinkElement::process):
        * html/HTMLParser.cpp:
        (WebCore::HTMLParser::handleError):
        (WebCore::HTMLParser::handleResidualStyleCloseTagAcrossBlocks):
        * html/HTMLPreElement.idl:
        * html/HTMLScriptElement.cpp:
        (WebCore::HTMLScriptElement::parseMappedAttribute):
        (WebCore::HTMLScriptElement::insertedIntoDocument):
        * html/HTMLTokenizer.cpp:
        (WebCore::HTMLTokenizer::scriptExecution):
        (WebCore::HTMLTokenizer::parseTag):
        (WebCore::HTMLTokenizer::write):
        (WebCore::HTMLTokenizer::stopParsing):
        (WebCore::HTMLTokenizer::timerFired):
        * kcanvas/device/quartz/KCanvasFilterQuartz.mm:
        (WebCore::KCanvasFilterQuartz::prepareFilter):
        * ksvg2/svg/SVGAElement.cpp:
        (WebCore::SVGAElement::defaultEventHandler):
        * ksvg2/svg/SVGElement.cpp:
        (WebCore::SVGElement::sendSVGLoadEventIfPossible):
        * loader/DocLoader.cpp:
        (WebCore::DocLoader::setLoadInProgress):
        * loader/FrameLoader.cpp:
        (WebCore::FormSubmission::FormSubmission):
        (WebCore::ScheduledRedirection::):
        (WebCore::ScheduledRedirection::ScheduledRedirection):
        (WebCore::cancelAll):
        (WebCore::getString):
        (WebCore::isBackForwardLoadType):
        (WebCore::numRequests):
        (WebCore::FrameLoader::FrameLoader):
        (WebCore::FrameLoader::~FrameLoader):
        (WebCore::FrameLoader::createWindow):
        (WebCore::FrameLoader::changeLocation):
        (WebCore::FrameLoader::urlSelected):
        (WebCore::FrameLoader::requestFrame):
        (WebCore::FrameLoader::loadSubframe):
        (WebCore::FrameLoader::submitFormAgain):
        (WebCore::FrameLoader::submitForm):
        (WebCore::FrameLoader::stopLoading):
        (WebCore::FrameLoader::stop):
        (WebCore::FrameLoader::closeURL):
        (WebCore::FrameLoader::cancelRedirection):
        (WebCore::FrameLoader::iconURL):
        (WebCore::FrameLoader::didOpenURL):
        (WebCore::FrameLoader::didExplicitOpen):
        (WebCore::FrameLoader::replaceContentsWithScriptResult):
        (WebCore::FrameLoader::executeScript):
        (WebCore::FrameLoader::cancelAndClear):
        (WebCore::FrameLoader::clear):
        (WebCore::FrameLoader::receivedFirstData):
        (WebCore::FrameLoader::responseMIMEType):
        (WebCore::FrameLoader::setResponseMIMEType):
        (WebCore::FrameLoader::begin):
        (WebCore::FrameLoader::write):
        (WebCore::FrameLoader::end):
        (WebCore::FrameLoader::endIfNotLoading):
        (WebCore::FrameLoader::startIconLoader):
        (WebCore::FrameLoader::commitIconURLToIconDatabase):
        (WebCore::FrameLoader::gotoAnchor):
        (WebCore::FrameLoader::finishedParsing):
        (WebCore::FrameLoader::loadDone):
        (WebCore::FrameLoader::checkCompleted):
        (WebCore::FrameLoader::checkEmitLoadEvent):
        (WebCore::FrameLoader::baseURL):
        (WebCore::FrameLoader::baseTarget):
        (WebCore::FrameLoader::completeURL):
        (WebCore::FrameLoader::scheduleRedirection):
        (WebCore::FrameLoader::scheduleLocationChange):
        (WebCore::FrameLoader::scheduleRefresh):
        (WebCore::FrameLoader::isScheduledLocationChangePending):
        (WebCore::FrameLoader::scheduleHistoryNavigation):
        (WebCore::FrameLoader::redirectionTimerFired):
        (WebCore::FrameLoader::encoding):
        (WebCore::FrameLoader::requestObject):
        (WebCore::FrameLoader::shouldUsePlugin):
        (WebCore::FrameLoader::loadPlugin):
        (WebCore::FrameLoader::clearRecordedFormValues):
        (WebCore::FrameLoader::recordFormValue):
        (WebCore::FrameLoader::parentCompleted):
        (WebCore::FrameLoader::outgoingReferrer):
        (WebCore::FrameLoader::lastModified):
        (WebCore::FrameLoader::opener):
        (WebCore::FrameLoader::setOpener):
        (WebCore::FrameLoader::openedByJavaScript):
        (WebCore::FrameLoader::setOpenedByJavaScript):
        (WebCore::FrameLoader::handleFallbackContent):
        (WebCore::FrameLoader::provisionalLoadStarted):
        (WebCore::FrameLoader::userGestureHint):
        (WebCore::FrameLoader::didNotOpenURL):
        (WebCore::FrameLoader::resetMultipleFormSubmissionProtection):
        (WebCore::FrameLoader::setEncoding):
        (WebCore::FrameLoader::addData):
        (WebCore::FrameLoader::canCachePage):
        (WebCore::FrameLoader::updatePolicyBaseURL):
        (WebCore::FrameLoader::setPolicyBaseURL):
        (WebCore::FrameLoader::scrollToAnchor):
        (WebCore::FrameLoader::isComplete):
        (WebCore::FrameLoader::isLoadingMainResource):
        (WebCore::FrameLoader::url):
        (WebCore::FrameLoader::startRedirectionTimer):
        (WebCore::FrameLoader::stopRedirectionTimer):
        (WebCore::FrameLoader::updateBaseURLForEmptyDocument):
        (WebCore::FrameLoader::completed):
        (WebCore::FrameLoader::started):
        (WebCore::FrameLoader::containsPlugins):
        (WebCore::FrameLoader::prepareForLoadStart):
        (WebCore::FrameLoader::setupForReplace):
        (WebCore::FrameLoader::setupForReplaceByMIMEType):
        (WebCore::FrameLoader::finalSetupForReplace):
        (WebCore::FrameLoader::load):
        (WebCore::FrameLoader::canTarget):
        (WebCore::FrameLoader::stopLoadingPlugIns):
        (WebCore::FrameLoader::stopLoadingSubresources):
        (WebCore::FrameLoader::stopLoadingSubframes):
        (WebCore::FrameLoader::stopAllLoaders):
        (WebCore::FrameLoader::cancelMainResourceLoad):
        (WebCore::FrameLoader::cancelPendingArchiveLoad):
        (WebCore::FrameLoader::activeDocumentLoader):
        (WebCore::FrameLoader::addPlugInStreamLoader):
        (WebCore::FrameLoader::removePlugInStreamLoader):
        (WebCore::FrameLoader::hasMainResourceLoader):
        (WebCore::FrameLoader::isLoadingSubresources):
        (WebCore::FrameLoader::isLoadingPlugIns):
        (WebCore::FrameLoader::isLoading):
        (WebCore::FrameLoader::addSubresourceLoader):
        (WebCore::FrameLoader::removeSubresourceLoader):
        (WebCore::FrameLoader::releaseMainResourceLoader):
        (WebCore::FrameLoader::setDocumentLoader):
        (WebCore::FrameLoader::documentLoader):
        (WebCore::FrameLoader::setPolicyDocumentLoader):
        (WebCore::FrameLoader::provisionalDocumentLoader):
        (WebCore::FrameLoader::setProvisionalDocumentLoader):
        (WebCore::FrameLoader::state):
        (WebCore::FrameLoader::timeOfLastCompletedLoad):
        (WebCore::FrameLoader::setState):
        (WebCore::FrameLoader::clearProvisionalLoad):
        (WebCore::FrameLoader::markLoadComplete):
        (WebCore::FrameLoader::commitProvisionalLoad):
        (WebCore::FrameLoader::privateBrowsingEnabled):
        (WebCore::FrameLoader::clientRedirectCancelledOrFinished):
        (WebCore::FrameLoader::clientRedirected):
        (WebCore::FrameLoader::shouldReload):
        (WebCore::FrameLoader::closeOldDataSources):
        (WebCore::FrameLoader::open):
        (WebCore::FrameLoader::isStopping):
        (WebCore::FrameLoader::finishedLoading):
        (WebCore::FrameLoader::URL):
        (WebCore::FrameLoader::isArchiveLoadPending):
        (WebCore::FrameLoader::isHostedByObjectElement):
        (WebCore::FrameLoader::isLoadingMainFrame):
        (WebCore::FrameLoader::canShowMIMEType):
        (WebCore::FrameLoader::representationExistsForURLScheme):
        (WebCore::FrameLoader::generatedMIMETypeForURLScheme):
        (WebCore::FrameLoader::cancelContentPolicyCheck):
        (WebCore::FrameLoader::didReceiveServerRedirectForProvisionalLoadForFrame):
        (WebCore::FrameLoader::finishedLoadingDocument):
        (WebCore::FrameLoader::isReplacing):
        (WebCore::FrameLoader::setReplacing):
        (WebCore::FrameLoader::revertToProvisional):
        (WebCore::FrameLoader::subframeIsLoading):
        (WebCore::FrameLoader::willChangeTitle):
        (WebCore::FrameLoader::loadType):
        (WebCore::FrameLoader::stopPolicyCheck):
        (WebCore::FrameLoader::continueAfterContentPolicy):
        (WebCore::FrameLoader::continueAfterWillSubmitForm):
        (WebCore::FrameLoader::didFirstLayout):
        (WebCore::FrameLoader::frameLoadCompleted):
        (WebCore::FrameLoader::firstLayoutDone):
        (WebCore::FrameLoader::isQuickRedirectComing):
        (WebCore::FrameLoader::closeDocument):
        (WebCore::FrameLoader::detachChildren):
        (WebCore::FrameLoader::checkLoadComplete):
        (WebCore::FrameLoader::numPendingOrLoadingRequests):
        (WebCore::FrameLoader::setClient):
        (WebCore::FrameLoader::client):
        (WebCore::FrameLoader::userAgent):
        (WebCore::FrameLoader::createEmptyDocument):
        (WebCore::FrameLoader::tokenizerProcessedData):
        (WebCore::FrameLoader::didTellBridgeAboutLoad):
        (WebCore::FrameLoader::haveToldBridgeAboutLoad):
        (WebCore::FrameLoader::handledOnloadEvents):
        (WebCore::FrameLoader::frameDetached):
        (WebCore::FrameLoader::setTitle):
        (WebCore::FrameLoaderClient::~FrameLoaderClient):
        * loader/FrameLoader.h:
        (WebCore::):
        * loader/FrameLoaderClient.h:
        * loader/PluginDocument.cpp:
        (WebCore::PluginTokenizer::createDocumentStructure):
        (WebCore::PluginTokenizer::writeRawData):
        * loader/ResourceLoader.h:
        * loader/TextResourceDecoder.cpp:
        (WebCore::TextResourceDecoder::checkForHeadCharset):
        * loader/icon/IconLoader.cpp:
        (WebCore::IconLoader::startLoading):
        (WebCore::IconLoader::finishLoading):
        * loader/loader.cpp:
        (WebCore::Loader::didReceiveResponse):
        * loader/mac/DocumentLoaderMac.mm:
        (WebCore::DocumentLoader::~DocumentLoader):
        (WebCore::DocumentLoader::stopLoading):
        (WebCore::DocumentLoader::finishedLoading):
        (WebCore::DocumentLoader::setupForReplaceByMIMEType):
        (WebCore::DocumentLoader::setPrimaryLoadComplete):
        * loader/mac/FrameLoaderMac.mm:
        (WebCore::FrameLoader::load):
        (WebCore::FrameLoader::startLoading):
        (WebCore::FrameLoader::cancelMainResourceLoad):
        (WebCore::FrameLoader::receivedMainResourceError):
        (WebCore::FrameLoader::continueFragmentScrollAfterNavigationPolicy):
        (WebCore::FrameLoader::commitProvisionalLoad):
        (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
        (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
        (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
        (WebCore::FrameLoader::detachFromParent):
        (WebCore::FrameLoader::addExtraFieldsToRequest):
        (WebCore::FrameLoader::loadResourceSynchronously):
        (WebCore::FrameLoader::createFrame):
        (WebCore::FrameLoader::objectContentType):
        (WebCore::nsArray):
        (WebCore::FrameLoader::createPlugin):
        (WebCore::FrameLoader::redirectDataToPlugin):
        (WebCore::FrameLoader::createJavaAppletWidget):
        (WebCore::FrameLoader::partClearedInBegin):
        (WebCore::FrameLoader::saveDocumentState):
        (WebCore::FrameLoader::restoreDocumentState):
        (WebCore::FrameLoader::overrideMediaType):
        (WebCore::FrameLoader::mainResourceData):
        (WebCore::FrameLoader::canGoBackOrForward):
        (WebCore::FrameLoader::originalRequestURL):
        (WebCore::FrameLoader::getHistoryLength):
        (WebCore::FrameLoader::goBackOrForward):
        (WebCore::FrameLoader::historyURL):
        (WebCore::FrameLoader::didFinishLoad):
        * loader/mac/LoaderFunctionsMac.mm:
        (WebCore::ServeSynchronousRequest):
        (WebCore::CheckCacheObjectStatus):
        * loader/mac/ResourceLoaderMac.mm:
        (WebCore::ResourceLoader::cancel):
        * loader/mac/SubresourceLoaderMac.mm:
        (WebCore::SubresourceLoader::create):
        * loader/qt/FrameLoaderQt.cpp: Added.
        (WebCore::FrameLoader::submitForm):
        (WebCore::FrameLoader::urlSelected):
        (WebCore::FrameLoader::setTitle):
        (WebCore::FrameLoader::createFrame):
        (WebCore::FrameLoader::objectContentType):
        (WebCore::FrameLoader::createPlugin):
        (WebCore::FrameLoader::createJavaAppletWidget):
        (WebCore::FrameLoader::originalRequestURL):
        * page/DOMWindow.cpp:
        (WebCore::DOMWindow::document):
        * page/Frame.cpp:
        (WebCore::Frame::~Frame):
        (WebCore::Frame::reparseConfiguration):
        (WebCore::Frame::shouldDragAutoNode):
        (WebCore::Frame::prepareForUserAction):
        (WebCore::FramePrivate::FramePrivate):
        (WebCore::FramePrivate::~FramePrivate):
        * page/Frame.h:
        * page/FramePrivate.h:
        * page/FrameView.cpp:
        (WebCore::FrameView::layout):
        (WebCore::FrameView::mediaType):
        * page/FrameView.h:
        * page/PageState.cpp:
        (WebCore::PageState::PageState):
        (WebCore::PageState::restoreJavaScriptState):
        * platform/mac/CookieJar.mm:
        (WebCore::setCookies):
        * platform/mac/TextCodecMac.cpp:
        * platform/mac/WebFontCache.mm:
        (+[WebFontCache fontWithFamily:traits:size:]):
        * platform/network/cf/ResourceHandleCFNet.cpp:
        (WebCore::ResourceHandle::start):
        * platform/network/mac/ResourceHandleMac.mm:
        (WebCore::ResourceHandle::start):
        * platform/qt/FrameQt.cpp:
        * platform/qt/FrameQt.h:
        * rendering/RenderApplet.cpp:
        (WebCore::RenderApplet::createWidgetIfNecessary):
        * rendering/RenderBlock.h:
        * rendering/RenderPartObject.cpp:
        (WebCore::isURLAllowed):
        (WebCore::RenderPartObject::updateWidget):
        * xml/DOMParser.cpp:
        (WebCore::DOMParser::parseFromString):
        * xml/XSLTProcessor.cpp:
        (WebCore::XSLTProcessor::createDocumentFromSource):
        * xml/xmlhttprequest.cpp:
        (WebCore::XMLHttpRequest::getResponseXML):

WebKit:

        Reviewed by Geoff.

        - udpated for changes to move from Frame/FrameMac to FrameLoader

        * DefaultDelegates/WebDefaultContextMenuDelegate.m:
        (-[WebDefaultUIDelegate openNewWindowWithURL:element:]):
        * Misc/WebNSAttributedStringExtras.m:
        (+[NSAttributedString _web_attributedStringFromRange:]):
        * Plugins/WebBaseNetscapePluginView.mm:
        (-[WebBaseNetscapePluginView requestWithURLCString:]):
        * Plugins/WebNetscapePluginEmbeddedView.m:
        (-[WebNetscapePluginEmbeddedView didStart]):
        * Plugins/WebNetscapePluginStream.mm:
        * Plugins/WebPluginController.mm:
        (-[WebPluginController pluginView:receivedResponse:]):
        * WebCoreSupport/WebFrameBridge.mm:
        (-[WebFrameBridge viewForPluginWithURL:attributeNames:attributeValues:MIMEType:DOMElement:loadManually:]):
        * WebCoreSupport/WebFrameLoaderClient.mm:
        (WebFrameLoaderClient::provisionalLoadStarted):
        * WebView/WebFrame.mm:
        (-[WebFrame _canCachePage]):
        (+[WebFrame _timeOfLastCompletedLoad]):
        (-[WebFrame _loadItem:withLoadType:]):
        (-[WebFrame _reloadForPluginChanges]):
        (-[WebFrame stopLoading]):

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

80 files changed:
WebCore/ChangeLog
WebCore/WebCore.exp
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/js/JSXSLTProcessor.h
WebCore/bindings/js/kjs_events.cpp
WebCore/bindings/js/kjs_html.cpp
WebCore/bindings/js/kjs_navigator.cpp
WebCore/bindings/js/kjs_proxy.cpp
WebCore/bindings/js/kjs_window.cpp
WebCore/bindings/objc/DOM.mm
WebCore/bridge/mac/FrameMac.h
WebCore/bridge/mac/FrameMac.mm
WebCore/bridge/mac/WebCoreFrameBridge.h
WebCore/bridge/mac/WebCoreFrameBridge.mm
WebCore/css/cssparser.cpp
WebCore/dom/DOMImplementation.cpp
WebCore/dom/DOMImplementation.h
WebCore/dom/Document.cpp
WebCore/dom/ProcessingInstruction.cpp
WebCore/dom/XMLTokenizer.cpp
WebCore/editing/TextIterator.cpp
WebCore/html/HTMLAnchorElement.cpp
WebCore/html/HTMLBaseElement.cpp
WebCore/html/HTMLDocument.cpp
WebCore/html/HTMLFormElement.cpp
WebCore/html/HTMLFrameElementBase.cpp
WebCore/html/HTMLInputElement.cpp
WebCore/html/HTMLLinkElement.cpp
WebCore/html/HTMLParser.cpp
WebCore/html/HTMLPreElement.idl
WebCore/html/HTMLScriptElement.cpp
WebCore/html/HTMLTokenizer.cpp
WebCore/kcanvas/device/quartz/KCanvasFilterQuartz.mm
WebCore/ksvg2/svg/SVGAElement.cpp
WebCore/ksvg2/svg/SVGElement.cpp
WebCore/loader/DocLoader.cpp
WebCore/loader/FrameLoader.cpp
WebCore/loader/FrameLoader.h
WebCore/loader/FrameLoaderClient.h
WebCore/loader/PluginDocument.cpp
WebCore/loader/ResourceLoader.h
WebCore/loader/TextResourceDecoder.cpp
WebCore/loader/icon/IconLoader.cpp
WebCore/loader/loader.cpp
WebCore/loader/mac/DocumentLoaderMac.mm
WebCore/loader/mac/FrameLoaderMac.mm
WebCore/loader/mac/LoaderFunctionsMac.mm
WebCore/loader/mac/ResourceLoaderMac.mm
WebCore/loader/mac/SubresourceLoaderMac.mm
WebCore/loader/qt/FrameLoaderQt.cpp [new file with mode: 0644]
WebCore/page/DOMWindow.cpp
WebCore/page/Frame.cpp
WebCore/page/Frame.h
WebCore/page/FramePrivate.h
WebCore/page/FrameView.cpp
WebCore/page/FrameView.h
WebCore/page/PageState.cpp
WebCore/platform/mac/CookieJar.mm
WebCore/platform/mac/TextCodecMac.cpp
WebCore/platform/mac/WebFontCache.mm
WebCore/platform/network/cf/ResourceHandleCFNet.cpp
WebCore/platform/network/mac/ResourceHandleMac.mm
WebCore/platform/qt/FrameQt.cpp
WebCore/platform/qt/FrameQt.h
WebCore/rendering/RenderApplet.cpp
WebCore/rendering/RenderBlock.h
WebCore/rendering/RenderPartObject.cpp
WebCore/xml/DOMParser.cpp
WebCore/xml/XSLTProcessor.cpp
WebCore/xml/xmlhttprequest.cpp
WebKit/ChangeLog
WebKit/DefaultDelegates/WebDefaultContextMenuDelegate.m
WebKit/Misc/WebNSAttributedStringExtras.m
WebKit/Plugins/WebBaseNetscapePluginView.mm
WebKit/Plugins/WebNetscapePluginEmbeddedView.m
WebKit/Plugins/WebNetscapePluginStream.mm
WebKit/Plugins/WebPluginController.mm
WebKit/WebCoreSupport/WebFrameBridge.mm
WebKit/WebCoreSupport/WebFrameLoaderClient.mm
WebKit/WebView/WebFrame.mm

index 00f1307b1161cf33be9f0c8351fe8f4e9a2a8efe..0688235e922e07083c6a6659f92a4bba62df8513 100644 (file)
@@ -1,3 +1,386 @@
+2006-11-07  Darin Adler  <darin@apple.com>
+
+        Reviewed by Geoff.
+
+        - moved loader code from Frame/FrameMac to FrameLoader
+
+        * WebCore.exp:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSXSLTProcessor.h:
+        * bindings/js/kjs_events.cpp:
+        (KJS::JSLazyEventListener::parseCode):
+        * bindings/js/kjs_html.cpp:
+        (KJS::JSHTMLDocument::putValueProperty):
+        * bindings/js/kjs_navigator.cpp:
+        (KJS::Navigator::getValueProperty):
+        * bindings/js/kjs_proxy.cpp:
+        (WebCore::KJSProxy::initScriptIfNeeded):
+        * bindings/js/kjs_window.cpp:
+        (KJS::Screen::Screen):
+        (KJS::createNewWindow):
+        (KJS::Window::getValueProperty):
+        (KJS::Window::put):
+        (KJS::Window::isSafeScript):
+        (KJS::WindowFunc::callAsFunction):
+        (KJS::ScheduledAction::execute):
+        (KJS::Location::getValueProperty):
+        (KJS::Location::put):
+        (KJS::Location::toString):
+        (KJS::LocationFunc::callAsFunction):
+        (KJS::History::getValueProperty):
+        (KJS::HistoryFunc::callAsFunction):
+        * bindings/objc/DOM.mm:
+        (+[DOMNode _nodeWith:WebCore::]):
+        * bridge/mac/FrameMac.h:
+        * bridge/mac/FrameMac.mm:
+        (WebCore::FrameMac::~FrameMac):
+        (WebCore::FrameMac::setView):
+        (WebCore::FrameMac::setStatusBarText):
+        * bridge/mac/WebCoreFrameBridge.h:
+        * bridge/mac/WebCoreFrameBridge.mm:
+        (-[WebCoreFrameBridge close]):
+        (-[WebCoreFrameBridge addData:]):
+        (-[WebCoreFrameBridge createFrameViewWithNSView:marginWidth:marginHeight:]):
+        (-[WebCoreFrameBridge reapplyStylesForDeviceType:]):
+        (-[WebCoreFrameBridge stringByEvaluatingJavaScriptFromString:forceUserGesture:]):
+        (-[WebCoreFrameBridge aeDescByEvaluatingJavaScriptFromString:]):
+        (-[WebCoreFrameBridge baseURL]):
+        (-[WebCoreFrameBridge dragOperationForDraggingInfo:]):
+        (-[WebCoreFrameBridge dragExitedWithDraggingInfo:]):
+        (-[WebCoreFrameBridge canProvideDocumentSource]):
+        (-[WebCoreFrameBridge receivedData:textEncodingName:]):
+        * css/cssparser.cpp:
+        (WebCore::CSSParser::parseContent):
+        * dom/DOMImplementation.cpp:
+        (WebCore::DOMImplementation::createDocument):
+        (WebCore::DOMImplementation::createHTMLDocument):
+        * dom/DOMImplementation.h:
+        * dom/Document.cpp:
+        (WebCore::Document::readyState):
+        (WebCore::Document::updateTitle):
+        (WebCore::Document::open):
+        (WebCore::Document::close):
+        (WebCore::Document::implicitClose):
+        (WebCore::Document::processHttpEquiv):
+        (WebCore::Document::referrer):
+        (WebCore::Document::finishedParsing):
+        * dom/ProcessingInstruction.cpp:
+        (WebCore::ProcessingInstruction::checkStyleSheet):
+        * dom/XMLTokenizer.cpp:
+        (WebCore::XMLTokenizer::endElementNs):
+        (WebCore::ignorableWhitespaceHandler):
+        (WebCore::XMLTokenizer::notifyFinished):
+        * editing/TextIterator.cpp:
+        (WebCore::TextIterator::rangeFromLocationAndLength):
+        * html/HTMLAnchorElement.cpp:
+        (WebCore::HTMLAnchorElement::defaultEventHandler):
+        * html/HTMLBaseElement.cpp:
+        (WebCore::HTMLBaseElement::process):
+        * html/HTMLDocument.cpp:
+        (WebCore::HTMLDocument::lastModified):
+        * html/HTMLFormElement.cpp:
+        (WebCore::HTMLFormElement::formData):
+        (WebCore::HTMLFormElement::submit):
+        * html/HTMLFrameElementBase.cpp:
+        (WebCore::HTMLFrameElementBase::isURLAllowed):
+        (WebCore::HTMLFrameElementBase::openURL):
+        (WebCore::HTMLFrameElementBase::willRemove):
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::setValueFromRenderer):
+        * html/HTMLLinkElement.cpp:
+        (WebCore::HTMLLinkElement::process):
+        * html/HTMLParser.cpp:
+        (WebCore::HTMLParser::handleError):
+        (WebCore::HTMLParser::handleResidualStyleCloseTagAcrossBlocks):
+        * html/HTMLPreElement.idl:
+        * html/HTMLScriptElement.cpp:
+        (WebCore::HTMLScriptElement::parseMappedAttribute):
+        (WebCore::HTMLScriptElement::insertedIntoDocument):
+        * html/HTMLTokenizer.cpp:
+        (WebCore::HTMLTokenizer::scriptExecution):
+        (WebCore::HTMLTokenizer::parseTag):
+        (WebCore::HTMLTokenizer::write):
+        (WebCore::HTMLTokenizer::stopParsing):
+        (WebCore::HTMLTokenizer::timerFired):
+        * kcanvas/device/quartz/KCanvasFilterQuartz.mm:
+        (WebCore::KCanvasFilterQuartz::prepareFilter):
+        * ksvg2/svg/SVGAElement.cpp:
+        (WebCore::SVGAElement::defaultEventHandler):
+        * ksvg2/svg/SVGElement.cpp:
+        (WebCore::SVGElement::sendSVGLoadEventIfPossible):
+        * loader/DocLoader.cpp:
+        (WebCore::DocLoader::setLoadInProgress):
+        * loader/FrameLoader.cpp:
+        (WebCore::FormSubmission::FormSubmission):
+        (WebCore::ScheduledRedirection::):
+        (WebCore::ScheduledRedirection::ScheduledRedirection):
+        (WebCore::cancelAll):
+        (WebCore::getString):
+        (WebCore::isBackForwardLoadType):
+        (WebCore::numRequests):
+        (WebCore::FrameLoader::FrameLoader):
+        (WebCore::FrameLoader::~FrameLoader):
+        (WebCore::FrameLoader::createWindow):
+        (WebCore::FrameLoader::changeLocation):
+        (WebCore::FrameLoader::urlSelected):
+        (WebCore::FrameLoader::requestFrame):
+        (WebCore::FrameLoader::loadSubframe):
+        (WebCore::FrameLoader::submitFormAgain):
+        (WebCore::FrameLoader::submitForm):
+        (WebCore::FrameLoader::stopLoading):
+        (WebCore::FrameLoader::stop):
+        (WebCore::FrameLoader::closeURL):
+        (WebCore::FrameLoader::cancelRedirection):
+        (WebCore::FrameLoader::iconURL):
+        (WebCore::FrameLoader::didOpenURL):
+        (WebCore::FrameLoader::didExplicitOpen):
+        (WebCore::FrameLoader::replaceContentsWithScriptResult):
+        (WebCore::FrameLoader::executeScript):
+        (WebCore::FrameLoader::cancelAndClear):
+        (WebCore::FrameLoader::clear):
+        (WebCore::FrameLoader::receivedFirstData):
+        (WebCore::FrameLoader::responseMIMEType):
+        (WebCore::FrameLoader::setResponseMIMEType):
+        (WebCore::FrameLoader::begin):
+        (WebCore::FrameLoader::write):
+        (WebCore::FrameLoader::end):
+        (WebCore::FrameLoader::endIfNotLoading):
+        (WebCore::FrameLoader::startIconLoader):
+        (WebCore::FrameLoader::commitIconURLToIconDatabase):
+        (WebCore::FrameLoader::gotoAnchor):
+        (WebCore::FrameLoader::finishedParsing):
+        (WebCore::FrameLoader::loadDone):
+        (WebCore::FrameLoader::checkCompleted):
+        (WebCore::FrameLoader::checkEmitLoadEvent):
+        (WebCore::FrameLoader::baseURL):
+        (WebCore::FrameLoader::baseTarget):
+        (WebCore::FrameLoader::completeURL):
+        (WebCore::FrameLoader::scheduleRedirection):
+        (WebCore::FrameLoader::scheduleLocationChange):
+        (WebCore::FrameLoader::scheduleRefresh):
+        (WebCore::FrameLoader::isScheduledLocationChangePending):
+        (WebCore::FrameLoader::scheduleHistoryNavigation):
+        (WebCore::FrameLoader::redirectionTimerFired):
+        (WebCore::FrameLoader::encoding):
+        (WebCore::FrameLoader::requestObject):
+        (WebCore::FrameLoader::shouldUsePlugin):
+        (WebCore::FrameLoader::loadPlugin):
+        (WebCore::FrameLoader::clearRecordedFormValues):
+        (WebCore::FrameLoader::recordFormValue):
+        (WebCore::FrameLoader::parentCompleted):
+        (WebCore::FrameLoader::outgoingReferrer):
+        (WebCore::FrameLoader::lastModified):
+        (WebCore::FrameLoader::opener):
+        (WebCore::FrameLoader::setOpener):
+        (WebCore::FrameLoader::openedByJavaScript):
+        (WebCore::FrameLoader::setOpenedByJavaScript):
+        (WebCore::FrameLoader::handleFallbackContent):
+        (WebCore::FrameLoader::provisionalLoadStarted):
+        (WebCore::FrameLoader::userGestureHint):
+        (WebCore::FrameLoader::didNotOpenURL):
+        (WebCore::FrameLoader::resetMultipleFormSubmissionProtection):
+        (WebCore::FrameLoader::setEncoding):
+        (WebCore::FrameLoader::addData):
+        (WebCore::FrameLoader::canCachePage):
+        (WebCore::FrameLoader::updatePolicyBaseURL):
+        (WebCore::FrameLoader::setPolicyBaseURL):
+        (WebCore::FrameLoader::scrollToAnchor):
+        (WebCore::FrameLoader::isComplete):
+        (WebCore::FrameLoader::isLoadingMainResource):
+        (WebCore::FrameLoader::url):
+        (WebCore::FrameLoader::startRedirectionTimer):
+        (WebCore::FrameLoader::stopRedirectionTimer):
+        (WebCore::FrameLoader::updateBaseURLForEmptyDocument):
+        (WebCore::FrameLoader::completed):
+        (WebCore::FrameLoader::started):
+        (WebCore::FrameLoader::containsPlugins):
+        (WebCore::FrameLoader::prepareForLoadStart):
+        (WebCore::FrameLoader::setupForReplace):
+        (WebCore::FrameLoader::setupForReplaceByMIMEType):
+        (WebCore::FrameLoader::finalSetupForReplace):
+        (WebCore::FrameLoader::load):
+        (WebCore::FrameLoader::canTarget):
+        (WebCore::FrameLoader::stopLoadingPlugIns):
+        (WebCore::FrameLoader::stopLoadingSubresources):
+        (WebCore::FrameLoader::stopLoadingSubframes):
+        (WebCore::FrameLoader::stopAllLoaders):
+        (WebCore::FrameLoader::cancelMainResourceLoad):
+        (WebCore::FrameLoader::cancelPendingArchiveLoad):
+        (WebCore::FrameLoader::activeDocumentLoader):
+        (WebCore::FrameLoader::addPlugInStreamLoader):
+        (WebCore::FrameLoader::removePlugInStreamLoader):
+        (WebCore::FrameLoader::hasMainResourceLoader):
+        (WebCore::FrameLoader::isLoadingSubresources):
+        (WebCore::FrameLoader::isLoadingPlugIns):
+        (WebCore::FrameLoader::isLoading):
+        (WebCore::FrameLoader::addSubresourceLoader):
+        (WebCore::FrameLoader::removeSubresourceLoader):
+        (WebCore::FrameLoader::releaseMainResourceLoader):
+        (WebCore::FrameLoader::setDocumentLoader):
+        (WebCore::FrameLoader::documentLoader):
+        (WebCore::FrameLoader::setPolicyDocumentLoader):
+        (WebCore::FrameLoader::provisionalDocumentLoader):
+        (WebCore::FrameLoader::setProvisionalDocumentLoader):
+        (WebCore::FrameLoader::state):
+        (WebCore::FrameLoader::timeOfLastCompletedLoad):
+        (WebCore::FrameLoader::setState):
+        (WebCore::FrameLoader::clearProvisionalLoad):
+        (WebCore::FrameLoader::markLoadComplete):
+        (WebCore::FrameLoader::commitProvisionalLoad):
+        (WebCore::FrameLoader::privateBrowsingEnabled):
+        (WebCore::FrameLoader::clientRedirectCancelledOrFinished):
+        (WebCore::FrameLoader::clientRedirected):
+        (WebCore::FrameLoader::shouldReload):
+        (WebCore::FrameLoader::closeOldDataSources):
+        (WebCore::FrameLoader::open):
+        (WebCore::FrameLoader::isStopping):
+        (WebCore::FrameLoader::finishedLoading):
+        (WebCore::FrameLoader::URL):
+        (WebCore::FrameLoader::isArchiveLoadPending):
+        (WebCore::FrameLoader::isHostedByObjectElement):
+        (WebCore::FrameLoader::isLoadingMainFrame):
+        (WebCore::FrameLoader::canShowMIMEType):
+        (WebCore::FrameLoader::representationExistsForURLScheme):
+        (WebCore::FrameLoader::generatedMIMETypeForURLScheme):
+        (WebCore::FrameLoader::cancelContentPolicyCheck):
+        (WebCore::FrameLoader::didReceiveServerRedirectForProvisionalLoadForFrame):
+        (WebCore::FrameLoader::finishedLoadingDocument):
+        (WebCore::FrameLoader::isReplacing):
+        (WebCore::FrameLoader::setReplacing):
+        (WebCore::FrameLoader::revertToProvisional):
+        (WebCore::FrameLoader::subframeIsLoading):
+        (WebCore::FrameLoader::willChangeTitle):
+        (WebCore::FrameLoader::loadType):
+        (WebCore::FrameLoader::stopPolicyCheck):
+        (WebCore::FrameLoader::continueAfterContentPolicy):
+        (WebCore::FrameLoader::continueAfterWillSubmitForm):
+        (WebCore::FrameLoader::didFirstLayout):
+        (WebCore::FrameLoader::frameLoadCompleted):
+        (WebCore::FrameLoader::firstLayoutDone):
+        (WebCore::FrameLoader::isQuickRedirectComing):
+        (WebCore::FrameLoader::closeDocument):
+        (WebCore::FrameLoader::detachChildren):
+        (WebCore::FrameLoader::checkLoadComplete):
+        (WebCore::FrameLoader::numPendingOrLoadingRequests):
+        (WebCore::FrameLoader::setClient):
+        (WebCore::FrameLoader::client):
+        (WebCore::FrameLoader::userAgent):
+        (WebCore::FrameLoader::createEmptyDocument):
+        (WebCore::FrameLoader::tokenizerProcessedData):
+        (WebCore::FrameLoader::didTellBridgeAboutLoad):
+        (WebCore::FrameLoader::haveToldBridgeAboutLoad):
+        (WebCore::FrameLoader::handledOnloadEvents):
+        (WebCore::FrameLoader::frameDetached):
+        (WebCore::FrameLoader::setTitle):
+        (WebCore::FrameLoaderClient::~FrameLoaderClient):
+        * loader/FrameLoader.h:
+        (WebCore::):
+        * loader/FrameLoaderClient.h:
+        * loader/PluginDocument.cpp:
+        (WebCore::PluginTokenizer::createDocumentStructure):
+        (WebCore::PluginTokenizer::writeRawData):
+        * loader/ResourceLoader.h:
+        * loader/TextResourceDecoder.cpp:
+        (WebCore::TextResourceDecoder::checkForHeadCharset):
+        * loader/icon/IconLoader.cpp:
+        (WebCore::IconLoader::startLoading):
+        (WebCore::IconLoader::finishLoading):
+        * loader/loader.cpp:
+        (WebCore::Loader::didReceiveResponse):
+        * loader/mac/DocumentLoaderMac.mm:
+        (WebCore::DocumentLoader::~DocumentLoader):
+        (WebCore::DocumentLoader::stopLoading):
+        (WebCore::DocumentLoader::finishedLoading):
+        (WebCore::DocumentLoader::setupForReplaceByMIMEType):
+        (WebCore::DocumentLoader::setPrimaryLoadComplete):
+        * loader/mac/FrameLoaderMac.mm:
+        (WebCore::FrameLoader::load):
+        (WebCore::FrameLoader::startLoading):
+        (WebCore::FrameLoader::cancelMainResourceLoad):
+        (WebCore::FrameLoader::receivedMainResourceError):
+        (WebCore::FrameLoader::continueFragmentScrollAfterNavigationPolicy):
+        (WebCore::FrameLoader::commitProvisionalLoad):
+        (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
+        (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
+        (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
+        (WebCore::FrameLoader::detachFromParent):
+        (WebCore::FrameLoader::addExtraFieldsToRequest):
+        (WebCore::FrameLoader::loadResourceSynchronously):
+        (WebCore::FrameLoader::createFrame):
+        (WebCore::FrameLoader::objectContentType):
+        (WebCore::nsArray):
+        (WebCore::FrameLoader::createPlugin):
+        (WebCore::FrameLoader::redirectDataToPlugin):
+        (WebCore::FrameLoader::createJavaAppletWidget):
+        (WebCore::FrameLoader::partClearedInBegin):
+        (WebCore::FrameLoader::saveDocumentState):
+        (WebCore::FrameLoader::restoreDocumentState):
+        (WebCore::FrameLoader::overrideMediaType):
+        (WebCore::FrameLoader::mainResourceData):
+        (WebCore::FrameLoader::canGoBackOrForward):
+        (WebCore::FrameLoader::originalRequestURL):
+        (WebCore::FrameLoader::getHistoryLength):
+        (WebCore::FrameLoader::goBackOrForward):
+        (WebCore::FrameLoader::historyURL):
+        (WebCore::FrameLoader::didFinishLoad):
+        * loader/mac/LoaderFunctionsMac.mm:
+        (WebCore::ServeSynchronousRequest):
+        (WebCore::CheckCacheObjectStatus):
+        * loader/mac/ResourceLoaderMac.mm:
+        (WebCore::ResourceLoader::cancel):
+        * loader/mac/SubresourceLoaderMac.mm:
+        (WebCore::SubresourceLoader::create):
+        * loader/qt/FrameLoaderQt.cpp: Added.
+        (WebCore::FrameLoader::submitForm):
+        (WebCore::FrameLoader::urlSelected):
+        (WebCore::FrameLoader::setTitle):
+        (WebCore::FrameLoader::createFrame):
+        (WebCore::FrameLoader::objectContentType):
+        (WebCore::FrameLoader::createPlugin):
+        (WebCore::FrameLoader::createJavaAppletWidget):
+        (WebCore::FrameLoader::originalRequestURL):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::document):
+        * page/Frame.cpp:
+        (WebCore::Frame::~Frame):
+        (WebCore::Frame::reparseConfiguration):
+        (WebCore::Frame::shouldDragAutoNode):
+        (WebCore::Frame::prepareForUserAction):
+        (WebCore::FramePrivate::FramePrivate):
+        (WebCore::FramePrivate::~FramePrivate):
+        * page/Frame.h:
+        * page/FramePrivate.h:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::layout):
+        (WebCore::FrameView::mediaType):
+        * page/FrameView.h:
+        * page/PageState.cpp:
+        (WebCore::PageState::PageState):
+        (WebCore::PageState::restoreJavaScriptState):
+        * platform/mac/CookieJar.mm:
+        (WebCore::setCookies):
+        * platform/mac/TextCodecMac.cpp:
+        * platform/mac/WebFontCache.mm:
+        (+[WebFontCache fontWithFamily:traits:size:]):
+        * platform/network/cf/ResourceHandleCFNet.cpp:
+        (WebCore::ResourceHandle::start):
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::ResourceHandle::start):
+        * platform/qt/FrameQt.cpp:
+        * platform/qt/FrameQt.h:
+        * rendering/RenderApplet.cpp:
+        (WebCore::RenderApplet::createWidgetIfNecessary):
+        * rendering/RenderBlock.h:
+        * rendering/RenderPartObject.cpp:
+        (WebCore::isURLAllowed):
+        (WebCore::RenderPartObject::updateWidget):
+        * xml/DOMParser.cpp:
+        (WebCore::DOMParser::parseFromString):
+        * xml/XSLTProcessor.cpp:
+        (WebCore::XSLTProcessor::createDocumentFromSource):
+        * xml/xmlhttprequest.cpp:
+        (WebCore::XMLHttpRequest::getResponseXML):
+
 2006-11-07  Anders Carlsson  <acarlsson@apple.com>
 
         Reviewed by Geoff.
index 5aea5164a9ea008c7cf12b78343752d0a5d74136..5cd71c92c5baefe2650ee1d74a5b724a926065af 100644 (file)
@@ -132,14 +132,17 @@ __ZN7WebCore10EventNames10clickEventE
 __ZN7WebCore10EventNames12keydownEventE
 __ZN7WebCore10MouseEventC1ERKNS_12AtomicStringEbbPNS_9DOMWindowEiiiiibbbbtPNS_15EventTargetNodeEPNS_9ClipboardEb
 __ZN7WebCore10StringImplD1Ev
-__ZN7WebCore11FrameLoader11stopLoadingEP7NSError
-__ZN7WebCore11FrameLoader11stopLoadingEv
+__ZN7WebCore11FrameLoader11completeURLERKNS_6StringE
+__ZN7WebCore11FrameLoader12canCachePageEv
 __ZN7WebCore11FrameLoader12shouldReloadERKNS_4KURLES3_
 __ZN7WebCore11FrameLoader14detachChildrenEv
+__ZN7WebCore11FrameLoader14scrollToAnchorERKNS_4KURLE
+__ZN7WebCore11FrameLoader14stopAllLoadersEv
 __ZN7WebCore11FrameLoader16detachFromParentEv
 __ZN7WebCore11FrameLoader19requestFromDelegateEP12NSURLRequestRP11objc_objectRP7NSError
 __ZN7WebCore11FrameLoader21addPlugInStreamLoaderEPNS_14ResourceLoaderE
 __ZN7WebCore11FrameLoader21commitProvisionalLoadEP12NSDictionary
+__ZN7WebCore11FrameLoader22cancelMainResourceLoadEP7NSError
 __ZN7WebCore11FrameLoader23addExtraFieldsToRequestEP19NSMutableURLRequestbb
 __ZN7WebCore11FrameLoader23reloadAllowingStaleDataERKNS_6StringE
 __ZN7WebCore11FrameLoader23timeOfLastCompletedLoadEv
@@ -153,6 +156,7 @@ __ZN7WebCore11FrameLoader4loadEPNS_14DocumentLoaderE
 __ZN7WebCore11FrameLoader4loadEPNS_14DocumentLoaderENS_13FrameLoadTypeEN3WTF10PassRefPtrINS_9FormStateEEE
 __ZN7WebCore11FrameLoader4loadERKNS_4KURLEPNS_5EventE
 __ZN7WebCore11FrameLoader4loadERKNS_4KURLERKNS_6StringENS_13FrameLoadTypeES6_PNS_5EventEPNS_7ElementERKN3WTF7HashMapIS4_S4_NSC_7StrHashIS4_EENSC_10HashTraitsIS4_EESH_EE
+__ZN7WebCore11FrameLoader5clearEb
 __ZN7WebCore11FrameLoader6reloadEv
 __ZN7WebCore11FrameLoader7canLoadEP5NSURLRKNS_6StringERb
 __ZN7WebCore11FrameLoader9setClientEPNS_17FrameLoaderClientE
@@ -206,19 +210,12 @@ __ZN7WebCore4Page16setDefersLoadingEb
 __ZN7WebCore4PageC1EN3WTF10PassRefPtrINS_12ChromeClientEEENS2_INS_12ScreenClientEEE
 __ZN7WebCore4PageD1Ev
 __ZN7WebCore5Frame11clearTimersEv
-__ZN7WebCore5Frame11completeURLERKNS_16DeprecatedStringE
 __ZN7WebCore5Frame11setSettingsEPNS_8SettingsE
-__ZN7WebCore5Frame12canCachePageEv
 __ZN7WebCore5Frame12ownerElementEv
-__ZN7WebCore5Frame13pauseTimeoutsEv
-__ZN7WebCore5Frame14scrollToAnchorERKNS_4KURLE
 __ZN7WebCore5Frame17setWindowHasFocusEb
 __ZN7WebCore5Frame20hitTestResultAtPointERKNS_8IntPointEb
-__ZN7WebCore5Frame20saveWindowPropertiesEPN3KJS15SavedPropertiesE
 __ZN7WebCore5Frame20setSelectionFromNoneEv
 __ZN7WebCore5Frame21setProhibitsScrollingEb
-__ZN7WebCore5Frame22saveLocationPropertiesEPN3KJS15SavedPropertiesE
-__ZN7WebCore5Frame23saveInterpreterBuiltinsERN3KJS13SavedBuiltinsE
 __ZN7WebCore5Frame6indentEv
 __ZN7WebCore5Frame7outdentEv
 __ZN7WebCore5Image10getNSImageEv
@@ -227,11 +224,10 @@ __ZN7WebCore5RangeC1EPNS_8DocumentEPNS_4NodeEiS4_i
 __ZN7WebCore5RangeD1Ev
 __ZN7WebCore6Editor30deleteSelectionWithSmartDeleteEb
 __ZN7WebCore6StringC1EP8NSString
-__ZN7WebCore6StringC1EP8NSString
 __ZN7WebCore6StringC1EPKc
+__ZN7WebCore6StringC1ERKNS_16DeprecatedStringE
 __ZN7WebCore6screenEP8NSWindow
 __ZN7WebCore7nsColorERKNS_5ColorE
-__ZN7WebCore7nsColorERKNS_5ColorE
 __ZN7WebCore8Document11completeURLERKNS_16DeprecatedStringE
 __ZN7WebCore8Document12setFocusNodeEN3WTF10PassRefPtrINS_4NodeEEE
 __ZN7WebCore8Document13removeMarkersENS_14DocumentMarker10MarkerTypeE
@@ -295,16 +291,17 @@ __ZN7WebCore9TimerBase5startEdd
 __ZN7WebCore9TimerBaseC2Ev
 __ZN7WebCore9TimerBaseD2Ev
 __ZNK7WebCore10StringImplcvP8NSStringEv
-__ZNK7WebCore10StringImplcvP8NSStringEv
-__ZNK7WebCore10StringImplcvP8NSStringEv
 __ZNK7WebCore11CachedImage5imageEv
 __ZNK7WebCore11FrameLoader14documentLoaderEv
+__ZNK7WebCore11FrameLoader15containsPluginsEv
 __ZNK7WebCore11FrameLoader15firstLayoutDoneEv
+__ZNK7WebCore11FrameLoader16outgoingReferrerEv
 __ZNK7WebCore11FrameLoader20activeDocumentLoaderEv
 __ZNK7WebCore11FrameLoader21isQuickRedirectComingEv
 __ZNK7WebCore11FrameLoader27numPendingOrLoadingRequestsEb
 __ZNK7WebCore11FrameLoader6clientEv
 __ZNK7WebCore11FrameLoader8loadTypeEv
+__ZNK7WebCore11FrameLoader8referrerEv
 __ZNK7WebCore12AtomicString16deprecatedStringEv
 __ZNK7WebCore12RenderObject25backslashAsCurrencySymbolEv
 __ZNK7WebCore13HitTestResult10isLiveLinkEv
@@ -346,7 +343,6 @@ __ZNK7WebCore4KURL8getNSURLEv
 __ZNK7WebCore4Page14frameNamespaceEv
 __ZNK7WebCore5Frame10isFrameSetEv
 __ZNK7WebCore5Frame13selectionRectEv
-__ZNK7WebCore5Frame15containsPluginsEv
 __ZNK7WebCore5Frame15revealSelectionERKNS_11RenderLayer15ScrollAlignmentE
 __ZNK7WebCore5Frame16inViewSourceModeEv
 __ZNK7WebCore5Frame19selectionControllerEv
@@ -354,13 +350,11 @@ __ZNK7WebCore5Frame19setInViewSourceModeEb
 __ZNK7WebCore5Frame20visibleSelectionRectEv
 __ZNK7WebCore5Frame30applyEditingStyleToBodyElementEv
 __ZNK7WebCore5Frame33removeEditingStyleFromBodyElementEv
-__ZNK7WebCore5Frame3urlEv
 __ZNK7WebCore5Frame4pageEv
 __ZNK7WebCore5Frame4treeEv
 __ZNK7WebCore5Frame6editorEv
 __ZNK7WebCore5Frame6loaderEv
 __ZNK7WebCore5Frame8documentEv
-__ZNK7WebCore5Frame8referrerEv
 __ZNK7WebCore5Frame8rendererEv
 __ZNK7WebCore5Range11pastEndNodeEv
 __ZNK7WebCore5Range11startOffsetERi
@@ -370,7 +364,6 @@ __ZNK7WebCore5Range9endOffsetERi
 __ZNK7WebCore5Range9startNodeEv
 __ZNK7WebCore6Editor13canEditRichlyEv
 __ZNK7WebCore6Editor17shouldDeleteRangeEPNS_5RangeE
-__ZNK7WebCore6Editor17shouldDeleteRangeEPNS_5RangeE
 __ZNK7WebCore6Editor6canCutEv
 __ZNK7WebCore6Editor7canCopyEv
 __ZNK7WebCore6Editor7canEditEv
@@ -381,7 +374,6 @@ __ZNK7WebCore6String7isEmptyEv
 __ZNK7WebCore7Element12getAttributeERKNS_13QualifiedNameE
 __ZNK7WebCore7IntRectcv6CGRectEv
 __ZNK7WebCore7IntRectcv7_NSRectEv
-__ZNK7WebCore7IntRectcv7_NSRectEv
 __ZNK7WebCore8Document5frameEv
 __ZNK7WebCore8FrameMac14selectionImageEb
 __ZNK7WebCore8FrameMac17eventMayStartDragEP7NSEvent
index f7ab10e2cb0db43565f25cf31aa83728c26e4f92..ccd32f2424c5e8dddb8d021ac061756b07627a03 100644 (file)
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
-                       compatibilityVersion = "Xcode 2.4";
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
                        mainGroup = 0867D691FE84028FC02AAC07 /* WebKit */;
                        productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
                        projectDirPath = "";
-                       projectRoot = "";
-                       shouldCheckCompatibility = 1;
                        targets = (
                                93F198A508245E59001E9ABC /* WebCore */,
                                DD041FBE09D9DDBE0010AF2A /* Derived Sources */,
index 01b17194408c289f8a9119911e3f948d28751250..9832e997489b2e577d2df12c6c89ec1c709909b7 100644 (file)
@@ -36,7 +36,7 @@ namespace WebCore {
 
 // Eventually we should implement XSLTException:
 // http://lxr.mozilla.org/seamonkey/source/content/xsl/public/nsIXSLTException.idl
-// http://bugzilla.opendarwin.org/show_bug.cgi?id=5446
+// http://bugs.webkit.org/show_bug.cgi?id=5446
 
 namespace KJS {
 
index 9b68f2972218d61b869a7f65561da640087d173e..d8109f1dcac1c0a9e572ba684ce0fd012bd8b767 100644 (file)
@@ -28,6 +28,7 @@
 #include "Event.h"
 #include "EventNames.h"
 #include "Frame.h"
+#include "FrameLoader.h"
 #include "HTMLImageElement.h"
 #include "HTMLNames.h"
 #include "JSEvent.h"
@@ -281,7 +282,7 @@ void JSLazyEventListener::parseCode() const
         JSObject* constr = interpreter->builtinFunction();
         List args;
 
-        UString sourceURL(frame->url().url());
+        UString sourceURL(frame->loader()->url().url());
         args.append(eventParameterName());
         args.append(jsString(code));
         listener = constr->construct(exec, args, m_functionName, sourceURL, lineNumber); // ### is globalExec ok ?
index 02af3df13bdda5b509c3a8bc70f7083ab73fe5b2..56a1bf95f38feb7c476e76507e2c102f3c349ab3 100644 (file)
 #include "DocLoader.h"
 #include "EventNames.h"
 #include "Frame.h"
+#include "FrameLoader.h"
 #include "FrameView.h"
-#include "HTMLAppletElement.h"
-#include "HTMLAreaElement.h"
-#include "HTMLBRElement.h"
-#include "HTMLBaseFontElement.h"
-#include "HTMLBlockquoteElement.h"
+#include "HTMLAnchorElement.h"
 #include "HTMLBodyElement.h"
 #include "HTMLDocument.h"
 #include "HTMLEmbedElement.h"
-#include "HTMLFieldSetElement.h"
-#include "HTMLFontElement.h"
 #include "HTMLFormElement.h"
 #include "HTMLFrameElement.h"
 #include "HTMLFrameSetElement.h"
-#include "HTMLHRElement.h"
-#include "HTMLHeadingElement.h"
-#include "HTMLHtmlElement.h"
 #include "HTMLIFrameElement.h"
 #include "HTMLImageElement.h"
-#include "HTMLIsIndexElement.h"
-#include "HTMLLIElement.h"
 #include "HTMLLabelElement.h"
-#include "HTMLLegendElement.h"
-#include "HTMLMapElement.h"
-#include "HTMLMenuElement.h"
-#include "HTMLModElement.h"
 #include "HTMLNames.h"
 #include "HTMLObjectElement.h"
 #include "HTMLOptionElement.h"
 #include "HTMLOptionsCollection.h"
-#include "HTMLParagraphElement.h"
-#include "HTMLParamElement.h"
-#include "HTMLPreElement.h"
-#include "HTMLQuoteElement.h"
-#include "HTMLScriptElement.h"
 #include "HTMLSelectElement.h"
 #include "HTMLTableCaptionElement.h"
 #include "HTMLTableCellElement.h"
@@ -67,7 +48,6 @@
 #include "HTMLTableElement.h"
 #include "HTMLTableRowElement.h"
 #include "HTMLTableSectionElement.h"
-#include "JSHTMLImageElement.h"
 #include "JSHTMLOptionsCollection.h"
 #include "NameNodeList.h"
 #include "RenderLayer.h"
@@ -356,25 +336,22 @@ void JSHTMLDocument::putValueProperty(ExecState* exec, int token, JSValue *value
   case Cookie:
     doc.setCookie(value->toString(exec));
     break;
-  case Location: {
-    Frame *frame = doc.frame();
-    if (frame)
-    {
+  case Location:
+    if (Frame* frame = doc.frame()) {
       DeprecatedString str = value->toString(exec);
 
       // When assigning location, IE and Mozilla both resolve the URL
       // relative to the frame where the JavaScript is executing not
       // the target frame.
-      Frame *activePart = static_cast<ScriptInterpreter*>( exec->dynamicInterpreter() )->frame();
-      if (activePart)
-        str = activePart->document()->completeURL(str);
+      Frame* activeFrame = static_cast<ScriptInterpreter*>( exec->dynamicInterpreter() )->frame();
+      if (activeFrame)
+        str = activeFrame->document()->completeURL(str);
 
       // We want a new history item if this JS was called via a user gesture
       bool userGesture = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->wasRunByUserGesture();
-      frame->scheduleLocationChange(str, activePart->referrer(), !userGesture);
+      frame->loader()->scheduleLocationChange(str, activeFrame->loader()->outgoingReferrer(), !userGesture);
     }
     break;
-  }
   case BgColor:
     if (bodyElement)
       bodyElement->setBgColor(value->toString(exec));
@@ -895,33 +872,6 @@ JSValue *JSHTMLElement::embedGetter(ExecState* exec, int token) const
     return jsUndefined();
 }
 
-#ifdef FIXME
-    HTMLAreaElement& area = *static_cast<HTMLAreaElement*>(impl());
-    switch (token) {
-        case AreaAccessKey:       return jsString(area.accessKey());
-        case AreaAlt:             return jsString(area.alt());
-        case AreaCoords:          return jsString(area.coords());
-        case AreaHref:            return jsString(area.href());
-        case AreaHash:            return jsString('#'+KURL(area.href().deprecatedString()).ref());
-        case AreaHost:            return jsString(KURL(area.href().deprecatedString()).host());
-        case AreaHostName: {
-            KURL url(area.href().deprecatedString());
-            if (url.port()==0)
-                return jsString(url.host());
-            else
-                return jsString(url.host() + ":" + DeprecatedString::number(url.port()));
-        }
-        case AreaPathName:        return jsString(KURL(area.href().deprecatedString()).path());
-        case AreaPort:            return jsString(DeprecatedString::number(KURL(area.href().deprecatedString()).port()));
-        case AreaProtocol:        return jsString(KURL(area.href().deprecatedString()).protocol()+":");
-        case AreaSearch:          return jsString(KURL(area.href().deprecatedString()).query());
-        case AreaNoHref:          return jsBoolean(area.noHref());
-        case AreaShape:           return jsString(area.shape());
-        case AreaTabIndex:        return jsNumber(area.tabIndex());
-        case AreaTarget:          return jsString(area.target());
-    }
-#endif
-
 JSValue *JSHTMLElement::tableGetter(ExecState* exec, int token) const
 {
     HTMLTableElement& table = *static_cast<HTMLTableElement*>(impl());
index 734567ebb3b8cab5a47c252e75fd52c81f17179e..0d3807575477be2d62b0c5a7d6e8d97960eb8e5d 100644 (file)
@@ -27,6 +27,7 @@
 #include "AtomicString.h"
 #include "CookieJar.h"
 #include "Frame.h"
+#include "FrameLoader.h"
 #include "Language.h"
 #include "PlugInInfoStore.h"
 
@@ -170,7 +171,7 @@ JSValue* Navigator::getValueProperty(ExecState* exec, int token) const
     return jsString("Netscape");
   case AppVersion: {
     // Version is everything in the user agent string past the "Mozilla/" prefix.
-    const String userAgent = m_frame->userAgent();
+    const String userAgent = m_frame->loader()->userAgent();
     return jsString(userAgent.substring(userAgent.find('/') + 1));
   }
   case Product:
@@ -184,7 +185,7 @@ JSValue* Navigator::getValueProperty(ExecState* exec, int token) const
   case Language:
     return jsString(defaultLanguage());
   case UserAgent:
-    return jsString(m_frame->userAgent());
+    return jsString(m_frame->loader()->userAgent());
   case Platform:
     return jsString(WEBCORE_NAVIGATOR_PLATFORM);
   case _Plugins:
index d54df9ab5b690f4f86c1480f2ab7edf88f7326d4..431ef712c5588c3f2d22f937a3e67e2ff3a06641 100644 (file)
@@ -24,6 +24,7 @@
 #include "kjs_events.h"
 #include "kjs_window.h"
 #include "Frame.h"
+#include "FrameLoader.h"
 #include "JSDOMWindow.h"
 
 #ifdef SVG_SUPPORT
@@ -136,7 +137,7 @@ void KJSProxy::initScriptIfNeeded()
   // Create a KJS interpreter for this frame
   m_script = new ScriptInterpreter(globalObject, m_frame);
 
-  String userAgent = m_frame->userAgent();
+  String userAgent = m_frame->loader()->userAgent();
   if (userAgent.find("Microsoft") >= 0 || userAgent.find("MSIE") >= 0)
     m_script->setCompatMode(Interpreter::IECompat);
   else
index c39cc5470843c24fbf064b6be63da612bfdbe92f..ec39fd60486e5e92ac58fc02061c95356df67d92 100644 (file)
@@ -1,4 +1,4 @@
-// -*- c-basic-offset: 2 -*-
+// -*- c-basic-offset: 4 -*-
 /*
  *  This file is part of the KDE libraries
  *  Copyright (C) 2000 Harri Porten (porten@kde.org)
@@ -179,9 +179,9 @@ const ClassInfo Screen::info = { "Screen", 0, &ScreenTable, 0 };
 
 // We set the object prototype so that toString is implemented
 Screen::Screen(ExecState* exec, Frame* f)
-  : m_frame(f)
+    : m_frame(f)
 {
-     setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype());
+    setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype());
 }
 
 bool Screen::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
@@ -560,7 +560,7 @@ static Frame* createNewWindow(ExecState* exec, Window* openerWindow, const Depre
 
     ResourceRequest request = ResourceRequest(KURL(""));
     if (activeFrame)
-        request.setHTTPReferrer(activeFrame->referrer());
+        request.setHTTPReferrer(activeFrame->loader()->outgoingReferrer());
     FrameLoadRequest frameRequest(request, frameName);
 
     // FIXME: It's much better for client API if a new window starts with a URL, here where we
@@ -576,8 +576,8 @@ static Frame* createNewWindow(ExecState* exec, Window* openerWindow, const Depre
 
     Window* newWindow = Window::retrieveWindow(newFrame);
 
-    newFrame->setOpener(openerFrame);
-    newFrame->setOpenedByJS(true);
+    newFrame->loader()->setOpener(openerFrame);
+    newFrame->loader()->setOpenedByJavaScript();
     if (dialogArgs)
         newWindow->putDirect("dialogArguments", dialogArgs);
 
@@ -586,7 +586,7 @@ static Frame* createNewWindow(ExecState* exec, Window* openerWindow, const Depre
         DeprecatedString completedURL = activeDoc->completeURL(URL);
         if (!completedURL.startsWith("javascript:", false) || newWindow->isSafeScript(exec)) {
             bool userGesture = static_cast<ScriptInterpreter *>(exec->dynamicInterpreter())->wasRunByUserGesture();
-            newFrame->changeLocation(completedURL, activeFrame->referrer(), false, userGesture);
+            newFrame->loader()->changeLocation(completedURL, activeFrame->loader()->outgoingReferrer(), false, userGesture);
         }
     }
 
@@ -740,10 +740,9 @@ JSValue *Window::getValueProperty(ExecState *exec, int token) const
     case OffscreenBuffering:
       return jsBoolean(true);
     case Opener:
-      if (m_frame->opener())
-        return retrieve(m_frame->opener());
-      else
-        return jsNull();
+      if (m_frame->loader()->opener())
+        return retrieve(m_frame->loader()->opener());
+      return jsNull();
     case OuterHeight:
         return jsNumber(m_frame->page()->chrome()->windowRect().height());
     case OuterWidth:
@@ -1027,7 +1026,7 @@ void Window::put(ExecState* exec, const Identifier &propertyName, JSValue *value
         if (!dstUrl.startsWith("javascript:", false) || isSafeScript(exec)) {
           bool userGesture = static_cast<ScriptInterpreter *>(exec->dynamicInterpreter())->wasRunByUserGesture();
           // We want a new history item if this JS was called via a user gesture
-          m_frame->scheduleLocationChange(dstUrl, p->referrer(), !userGesture, userGesture);
+          m_frame->loader()->scheduleLocationChange(dstUrl, p->loader()->outgoingReferrer(), !userGesture, userGesture);
         }
       }
       return;
@@ -1172,17 +1171,17 @@ bool Window::isSafeScript(const ScriptInterpreter *origin, const ScriptInterpret
     if (origin == target)
         return true;
         
-    Frame *originPart = origin->frame();
-    Frame *targetPart = target->frame();
+    Frame* originFrame = origin->frame();
+    Frame* targetFrame = target->frame();
 
     // JS may be attempting to access the "window" object, which should be valid,
     // even if the document hasn't been constructed yet.  If the document doesn't
     // exist yet allow JS to access the window object.
-    if (!targetPart->document())
+    if (!targetFrame->document())
         return true;
 
-    WebCore::Document *originDocument = originPart->document();
-    WebCore::Document *targetDocument = targetPart->document();
+    WebCore::Document *originDocument = originFrame->document();
+    WebCore::Document *targetDocument = targetFrame->document();
 
     if (!targetDocument) {
         return false;
@@ -1199,14 +1198,12 @@ bool Window::isSafeScript(const ScriptInterpreter *origin, const ScriptInterpret
     // if this document is being initially loaded as empty by its parent
     // or opener, allow access from any document in the same domain as
     // the parent or opener.
-    if (shouldLoadAsEmptyDocument(targetPart->url())) {
-        Frame *ancestorPart = targetPart->opener() ? targetPart->opener() : targetPart->tree()->parent();
-        while (ancestorPart && shouldLoadAsEmptyDocument(ancestorPart->url())) {
-            ancestorPart = ancestorPart->tree()->parent();
-        }
-
-        if (ancestorPart)
-            originDomain = ancestorPart->document()->domain();
+    if (shouldLoadAsEmptyDocument(targetFrame->loader()->url())) {
+        Frame* ancestorFrame = targetFrame->loader()->opener() ? targetFrame->loader()->opener() : targetFrame->tree()->parent();
+        while (ancestorFrame && shouldLoadAsEmptyDocument(ancestorFrame->loader()->url()))
+            ancestorFrame = ancestorFrame->tree()->parent();
+        if (ancestorFrame)
+            originDomain = ancestorFrame->document()->domain();
     }
 
     if ( targetDomain == originDomain )
@@ -1218,7 +1215,7 @@ bool Window::isSafeScript(const ScriptInterpreter *origin, const ScriptInterpret
     }
     String message = String::sprintf("Unsafe JavaScript attempt to access frame with URL %s from frame with URL %s. Domains must match.\n", 
                   targetDocument->URL().latin1(), originDocument->URL().latin1());
-    targetPart->addMessageToConsole(message, 1, String()); //fixme: provide a real line number and sourceurl
+    targetFrame->addMessageToConsole(message, 1, String()); //fixme: provide a real line number and sourceurl
 
     return false;
 }
@@ -1227,10 +1224,10 @@ bool Window::isSafeScript(ExecState *exec) const
 {
   if (!m_frame) // frame deleted ? can't grant access
     return false;
-  Frame *activePart = static_cast<ScriptInterpreter *>( exec->dynamicInterpreter() )->frame();
-  if (!activePart)
+  Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
+  if (!activeFrame)
     return false;
-  if ( activePart == m_frame ) // Not calling from another frame, no problem.
+  if (activeFrame == m_frame) // Not calling from another frame, no problem.
     return true;
 
   // JS may be attempting to access the "window" object, which should be valid,
@@ -1240,12 +1237,12 @@ bool Window::isSafeScript(ExecState *exec) const
       return true;
 
   WebCore::Document* thisDocument = m_frame->document();
-  WebCore::Document* actDocument = activePart->document();
+  WebCore::Document* actDocument = activeFrame->document();
 
   WebCore::String actDomain;
 
   if (!actDocument)
-    actDomain = activePart->url().host();
+    actDomain = activeFrame->loader()->url().host();
   else
     actDomain = actDocument->domain();
   
@@ -1259,14 +1256,13 @@ bool Window::isSafeScript(ExecState *exec) const
   // if this document is being initially loaded as empty by its parent
   // or opener, allow access from any document in the same domain as
   // the parent or opener.
-  if (shouldLoadAsEmptyDocument(m_frame->url())) {
-    Frame *ancestorPart = m_frame->opener() ? m_frame->opener() : m_frame->tree()->parent();
-    while (ancestorPart && shouldLoadAsEmptyDocument(ancestorPart->url())) {
-      ancestorPart = ancestorPart->tree()->parent();
-    }
-    
-    if (ancestorPart)
-      thisDomain = ancestorPart->document()->domain();
+  if (shouldLoadAsEmptyDocument(m_frame->loader()->url())) {
+    Frame* ancestorFrame = m_frame->loader()->opener()
+        ? m_frame->loader()->opener() : m_frame->tree()->parent();
+    while (ancestorFrame && shouldLoadAsEmptyDocument(ancestorFrame->loader()->url()))
+      ancestorFrame = ancestorFrame->tree()->parent();
+    if (ancestorFrame)
+      thisDomain = ancestorFrame->document()->domain();
   }
 
   // FIXME: this should check that URL scheme and port match too, probably
@@ -1585,7 +1581,7 @@ JSValue *WindowFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const Li
           const Window* window = Window::retrieveWindow(frame);
           if (!url.url().startsWith("javascript:", false) || (window && window->isSafeScript(exec))) {
               bool userGesture = static_cast<ScriptInterpreter *>(exec->dynamicInterpreter())->wasRunByUserGesture();
-              frame->scheduleLocationChange(url.url(), activeFrame->referrer(), false/*don't lock history*/, userGesture);
+              frame->loader()->scheduleLocationChange(url.url(), activeFrame->loader()->outgoingReferrer(), false/*don't lock history*/, userGesture);
           }
           return Window::retrieve(frame);
       }
@@ -1596,27 +1592,27 @@ JSValue *WindowFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const Li
           const Window* window = Window::retrieveWindow(frame);
           if (!url.url().startsWith("javascript:", false) || (window && window->isSafeScript(exec))) {
               bool userGesture = static_cast<ScriptInterpreter *>(exec->dynamicInterpreter())->wasRunByUserGesture();
-              frame->scheduleLocationChange(url.url(), activeFrame->referrer(), false/*don't lock history*/, userGesture);
+              frame->loader()->scheduleLocationChange(url.url(), activeFrame->loader()->outgoingReferrer(), false/*don't lock history*/, userGesture);
           }
           return Window::retrieve(frame);
       }
       
       // request window (new or existing if framename is set)
-      frameRequest.resourceRequest().setHTTPReferrer(activeFrame->referrer());
+      frameRequest.resourceRequest().setHTTPReferrer(activeFrame->loader()->outgoingReferrer());
       Frame* newFrame = frame->loader()->createWindow(frameRequest, windowFeatures);
       if (!newFrame)
           return jsUndefined();
-      newFrame->setOpener(frame);
-      newFrame->setOpenedByJS(true);
+      newFrame->loader()->setOpener(frame);
+      newFrame->loader()->setOpenedByJavaScript();
       
       if (!newFrame->document()) {
           Document* oldDoc = frame->document();
           if (oldDoc && oldDoc->baseURL() != 0)
-              newFrame->begin(oldDoc->baseURL());
+              newFrame->loader()->begin(oldDoc->baseURL());
           else
-              newFrame->begin();
-          newFrame->write("<HTML><BODY>");
-          newFrame->end();          
+              newFrame->loader()->begin();
+          newFrame->loader()->write("<HTML><BODY>");
+          newFrame->loader()->end();          
           if (oldDoc) {
               newFrame->document()->setDomain(oldDoc->domain(), true);
               newFrame->document()->setBaseURL(oldDoc->baseURL());
@@ -1626,7 +1622,7 @@ JSValue *WindowFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const Li
           const Window* window = Window::retrieveWindow(newFrame);
           if (!url.url().startsWith("javascript:", false) || (window && window->isSafeScript(exec))) {
               bool userGesture = static_cast<ScriptInterpreter *>(exec->dynamicInterpreter())->wasRunByUserGesture();
-              newFrame->scheduleLocationChange(url.url(), activeFrame->referrer(), false, userGesture);
+              newFrame->loader()->scheduleLocationChange(url.url(), activeFrame->loader()->outgoingReferrer(), false, userGesture);
           }
       }
       return Window::retrieve(newFrame); // global object
@@ -1746,39 +1742,17 @@ JSValue *WindowFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const Li
     frame->unfocusWindow();
     return jsUndefined();
   case Window::Close:
-    /* From http://developer.netscape.com/docs/manuals/js/client/jsref/window.htm :
-       The close method closes only windows opened by JavaScript using the open method.
-       If you attempt to close any other window, a confirm is generated, which
-       lets the user choose whether the window closes.
-       This is a security feature to prevent "mail bombs" containing self.close().
-       However, if the window has only one document (the current one) in its
-       session history, the close is allowed without any confirm. This is a
-       special case for one-off windows that need to open other windows and
-       then dispose of themselves.
-    */
-    if (!frame->openedByJS())
-    {
-      // To conform to the SPEC, we only ask if the window
-      // has more than one entry in the history (NS does that too).
-      History history(exec, frame);
-      if ( history.get( exec, lengthPropertyName )->toInt32(exec) <= 1
-           // FIXME: How are we going to handle this?
-           )
-        (const_cast<Window*>(window))->scheduleClose();
-    }
-    else
-    {
-      (const_cast<Window*>(window))->scheduleClose();
-    }
+    // Do not close windows that have history unless they were opened by JavaScript.
+    if (frame->loader()->openedByJavaScript() || frame->loader()->getHistoryLength() <= 1)
+      const_cast<Window*>(window)->scheduleClose();
     return jsUndefined();
   case Window::CaptureEvents:
   case Window::ReleaseEvents:
-        // If anyone implements these, they need the safescript security check.
-        if (!window->isSafeScript(exec))
-            return jsUndefined();
-
-    // Do nothing for now. These are NS-specific legacy calls.
-    break;
+    // If anyone implements these, they need the safe script security check.
+    if (!window->isSafeScript(exec))
+        return jsUndefined();
+    // Not implemented.
+    return jsUndefined();
   case Window::AddEventListener:
         if (!window->isSafeScript(exec))
             return jsUndefined();
@@ -1840,7 +1814,7 @@ void ScheduledAction::execute(Window *window)
             }
         }
     } else
-        window->m_frame->executeScript(0, m_code);
+        window->m_frame->loader()->executeScript(0, m_code);
   
     // Update our document's rendering following the execution of the timeout callback.
     // FIXME: Why? Why not other documents, for example?
@@ -2085,7 +2059,7 @@ Location::Location(Frame *p) : m_frame(p)
 
 JSValue *Location::getValueProperty(ExecState *exec, int token) const
 {
-  KURL url = m_frame->url();
+  KURL url = m_frame->loader()->url();
   switch (token) {
   case Hash:
     return jsString(url.ref().isNull() ? "" : "#" + url.ref());
@@ -2103,8 +2077,7 @@ JSValue *Location::getValueProperty(ExecState *exec, int token) const
   case Href:
     if (!url.hasPath())
       return jsString(url.prettyURL() + "/");
-    else
-      return jsString(url.prettyURL());
+    return jsString(url.prettyURL());
   case Pathname:
     return jsString(url.path().isEmpty() ? "/" : url.path());
   case Port:
@@ -2139,7 +2112,7 @@ void Location::put(ExecState *exec, const Identifier &p, JSValue *v, int attr)
     return;
 
   DeprecatedString str = v->toString(exec);
-  KURL url = m_frame->url();
+  KURL url = m_frame->loader()->url();
   const HashEntry *entry = Lookup::findEntry(&LocationTable, p);
   if (entry)
     switch (entry->value) {
@@ -2190,11 +2163,11 @@ void Location::put(ExecState *exec, const Identifier &p, JSValue *v, int attr)
   }
 
   const Window* window = Window::retrieveWindow(m_frame);
-  Frame* activePart = Window::retrieveActive(exec)->frame();
+  Frame* activeFrame = Window::retrieveActive(exec)->frame();
   if (!url.url().startsWith("javascript:", false) || (window && window->isSafeScript(exec))) {
     bool userGesture = static_cast<ScriptInterpreter *>(exec->dynamicInterpreter())->wasRunByUserGesture();
     // We want a new history item if this JS was called via a user gesture
-    m_frame->scheduleLocationChange(url.url(), activePart->referrer(), !userGesture, userGesture);
+    m_frame->loader()->scheduleLocationChange(url.url(), activeFrame->loader()->outgoingReferrer(), !userGesture, userGesture);
   }
 }
 
@@ -2205,10 +2178,9 @@ JSValue *Location::toPrimitive(ExecState *exec, JSType) const
 
 UString Location::toString(ExecState *) const
 {
-  if (!m_frame->url().hasPath())
-    return m_frame->url().prettyURL()+"/";
-  else
-    return m_frame->url().prettyURL();
+  if (!m_frame->loader()->url().hasPath())
+    return m_frame->loader()->url().prettyURL()+"/";
+  return m_frame->loader()->url().prettyURL();
 }
 
 JSValue *LocationFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const List &args)
@@ -2232,7 +2204,7 @@ JSValue *LocationFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const
         const Window* window = Window::retrieveWindow(frame);
         if (!str.startsWith("javascript:", false) || (window && window->isSafeScript(exec))) {
           bool userGesture = static_cast<ScriptInterpreter *>(exec->dynamicInterpreter())->wasRunByUserGesture();
-          frame->scheduleLocationChange(p->document()->completeURL(str), p->referrer(), true /*lock history*/, userGesture);
+          frame->loader()->scheduleLocationChange(p->document()->completeURL(str), p->loader()->outgoingReferrer(), true /*lock history*/, userGesture);
         }
       }
       break;
@@ -2240,9 +2212,9 @@ JSValue *LocationFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const
     case Location::Reload:
     {
       const Window* window = Window::retrieveWindow(frame);
-      if (!frame->url().url().startsWith("javascript:", false) || (window && window->isSafeScript(exec))) {
+      if (!frame->loader()->url().url().startsWith("javascript:", false) || (window && window->isSafeScript(exec))) {
         bool userGesture = static_cast<ScriptInterpreter *>(exec->dynamicInterpreter())->wasRunByUserGesture();
-        frame->scheduleRefresh(userGesture);
+        frame->loader()->scheduleRefresh(userGesture);
       }
       break;
     }
@@ -2255,7 +2227,7 @@ JSValue *LocationFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const
             if (!dstUrl.startsWith("javascript:", false) || (window && window->isSafeScript(exec))) {
                 bool userGesture = static_cast<ScriptInterpreter *>(exec->dynamicInterpreter())->wasRunByUserGesture();
                 // We want a new history item if this JS was called via a user gesture
-                frame->scheduleLocationChange(dstUrl, p->referrer(), !userGesture, userGesture);
+                frame->loader()->scheduleLocationChange(dstUrl, p->loader()->outgoingReferrer(), !userGesture, userGesture);
             }
         }
         break;
@@ -2456,7 +2428,7 @@ bool History::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName
 JSValue *History::getValueProperty(ExecState *, int token) const
 {
     ASSERT(token == Length);
-    return m_frame ? jsNumber(m_frame->getHistoryLength()) : jsNumber(0);
+    return m_frame ? jsNumber(m_frame->loader()->getHistoryLength()) : jsNumber(0);
 }
 
 UString History::toString(ExecState *exec) const
@@ -2486,7 +2458,7 @@ JSValue *HistoryFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const L
   }
 
   if (Frame* frame = history->m_frame)
-      frame->scheduleHistoryNavigation(steps);
+      frame->loader()->scheduleHistoryNavigation(steps);
   return jsUndefined();
 }
 
index b518cbcb34cedbb2c2448144a798a6d9915a58d3..581b09285a186c45013c501e31ad4910e8e27dbc 100644 (file)
@@ -343,7 +343,7 @@ static Class elementClass(const QualifiedName& tag, Class defaultClass)
             break;
         case WebCore::Node::XPATH_NAMESPACE_NODE:
             // FIXME: Create an XPath objective C wrapper
-            // See http://bugzilla.opendarwin.org/show_bug.cgi?id=8755
+            // See http://bugs.webkit.org/show_bug.cgi?id=8755
             return nil;
     }
     return [[[wrapperClass alloc] _initWithNode:impl] autorelease];
index 564523f9573c5d6d69c5450af31639efae60a67f..19830b7f8903091d06bf75e39691ed493b0ce5d8 100644 (file)
@@ -116,7 +116,7 @@ public:
     virtual KJS::Bindings::RootObject* bindingRootObject();
 
     void addPluginRootObject(KJS::Bindings::RootObject*);
-    
+
     KJS::Bindings::RootObject* executionContextForDOM();
     
     WebScriptObject* windowScriptObject();
@@ -127,6 +127,9 @@ public:
 
     void willPopupMenu(NSMenu *);
 
+    void cleanupPluginObjects();
+    bool shouldClose();
+
 private:    
     KJS::Bindings::RootObject* _bindingRoot; // The root object used for objects bound outside the context of a plugin.
     Vector<KJS::Bindings::RootObject*> m_rootObjects;
@@ -153,6 +156,8 @@ public:
 
     virtual void print();
 
+    virtual void scheduleClose();
+
 // === to be moved into Editor
 
 public:
@@ -298,66 +303,6 @@ private:
     
     static NSEvent* _currentEvent;
 
-// === to be moved into FrameLoader
-
-public:
-    virtual void urlSelected(const FrameLoadRequest&, Event*);
-    virtual Frame* createFrame(const KURL&, const String& name, Element* ownerElement, const String& referrer);
-    virtual void submitForm(const FrameLoadRequest&, Event*);
-
-    virtual Plugin* createPlugin(Element*, const KURL&,
-        const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType);
-
-    virtual void clear(bool clearWindowProperties = true);
-
-    virtual void frameDetached();
-
-    virtual void setTitle(const String&);
-
-    virtual void scheduleClose();
-
-    virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType);
-    virtual void redirectDataToPlugin(Widget* pluginWidget);
-
-    virtual void saveDocumentState();
-    virtual void restoreDocumentState();
-    
-    bool shouldClose();
-
-    virtual void createEmptyDocument();
-
-    virtual String userAgent() const;
-
-    virtual void tokenizerProcessedData();
-
-    virtual String overrideMediaType() const;
-    
-    void didTellBridgeAboutLoad(const String& URL);
-    bool haveToldBridgeAboutLoad(const String& URL);
-
-    virtual Widget* createJavaAppletWidget(const IntSize&, Element*, const HashMap<String, String>& args);
-
-    virtual void partClearedInBegin();
-    
-    virtual void didFirstLayout();
-
-    virtual void handledOnloadEvents();
-
-    virtual KURL originalRequestURL() const;
-
-    virtual bool canGoBackOrForward(int distance) const;
-    virtual void goBackOrForward(int distance);
-    virtual int getHistoryLength();
-    virtual KURL historyURL(int distance);
-
-private:
-    virtual void startRedirectionTimer();
-    virtual void stopRedirectionTimer();
-    virtual void cleanupPluginObjects();
-    virtual bool isLoadTypeReload();
-
-    HashSet<String> urlsBridgeKnowsAbout;
-
 // === to be moved into the Platform directory
 
 public:
index 301ea0330ae0b3d3e65ed1fce1fe3c44bfa9483e..19bb2f620eb15ed9113e0c185bbb02e29c0a114b 100644 (file)
@@ -181,92 +181,15 @@ FrameMac::~FrameMac()
 {
     setView(0);
     freeClipboard();
-    clearRecordedFormValues();    
+    loader()->clearRecordedFormValues();    
     
     [_bridge clearFrame];
     HardRelease(_bridge);
     _bridge = nil;
 
-    cancelAndClear();
+    loader()->cancelAndClear();
 }
 
-#pragma mark BEGIN LOADING FUNCTIONS
-
-void FrameMac::submitForm(const FrameLoadRequest& request, Event* event)
-{
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
-    // FIXME: We'd like to remove this altogether and fix the multiple form submission issue another way.
-    // We do not want to submit more than one form from the same page,
-    // nor do we want to submit a single form more than once.
-    // This flag prevents these from happening; not sure how other browsers prevent this.
-    // The flag is reset in each time we start handle a new mouse or key down event, and
-    // also in setView since this part may get reused for a page from the back/forward cache.
-    // The form multi-submit logic here is only needed when we are submitting a form that affects this frame.
-    // FIXME: Frame targeting is only one of the ways the submission could end up doing something other
-    // than replacing this frame's content, so this check is flawed. On the other hand, the check is hardly
-    // needed any more now that we reset d->m_submittedFormURL on each mouse or key down event.
-    Frame* target = request.frameName().isEmpty() ? this : tree()->find(request.frameName());
-    bool willReplaceThisFrame = false;
-    for (Frame* p = this; p; p = p->tree()->parent()) {
-        if (p == target) {
-            willReplaceThisFrame = true;
-            break;
-        }
-    }
-    if (willReplaceThisFrame) {
-        if (d->m_submittedFormURL == request.resourceRequest().url())
-            return;
-        d->m_submittedFormURL = request.resourceRequest().url();
-    }
-
-    loader()->load(request, true, event,
-        d->m_formAboutToBeSubmitted.get(), d->m_formValuesAboutToBeSubmitted);
-
-    clearRecordedFormValues();
-
-    END_BLOCK_OBJC_EXCEPTIONS;
-}
-
-void FrameMac::urlSelected(const FrameLoadRequest& request, Event* event)
-{
-    FrameLoadRequest copy = request;
-    if (copy.resourceRequest().httpReferrer().isEmpty())
-        copy.resourceRequest().setHTTPReferrer(referrer());
-
-    // FIXME: How do we know that userGesture is always true?
-    loader()->load(copy, true, event, 0, HashMap<String, String>());
-}
-
-Frame* FrameMac::createFrame(const KURL& url, const String& name, Element* ownerElement, const String& referrer)
-{
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    
-    BOOL allowsScrolling = YES;
-    int marginWidth = -1;
-    int marginHeight = -1;
-    if (ownerElement->hasTagName(frameTag) || ownerElement->hasTagName(iframeTag)) {
-        HTMLFrameElement* o = static_cast<HTMLFrameElement*>(ownerElement);
-        allowsScrolling = o->scrollingMode() != ScrollbarAlwaysOff;
-        marginWidth = o->getMarginWidth();
-        marginHeight = o->getMarginHeight();
-    }
-
-    WebCoreFrameBridge *childBridge = [_bridge createChildFrameNamed:name
-                                                             withURL:url.getNSURL()
-                                                            referrer:referrer 
-                                                          ownerElement:ownerElement
-                                                     allowsScrolling:allowsScrolling
-                                                         marginWidth:marginWidth
-                                                        marginHeight:marginHeight];
-    return [childBridge _frame];
-
-    END_BLOCK_OBJC_EXCEPTIONS;
-    return 0;
-}
-
-#pragma mark END LOADING FUNCTIONS
-
 void FrameMac::freeClipboard()
 {
     if (sharedDragInfo->m_dragClipboard)
@@ -462,50 +385,6 @@ NSString *FrameMac::matchLabelsAgainstElement(NSArray *labels, Element *element)
     return nil;
 }
 
-void FrameMac::frameDetached()
-{
-    Frame::frameDetached();
-
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    [_bridge frameDetached];
-    END_BLOCK_OBJC_EXCEPTIONS;
-}
-
-ObjectContentType FrameMac::objectContentType(const KURL& url, const String& mimeType)
-{
-    return (ObjectContentType)[_bridge determineObjectFromMIMEType:mimeType URL:url.getNSURL()];
-}
-
-static NSArray* nsArray(const Vector<String>& vector)
-{
-    unsigned len = vector.size();
-    NSMutableArray* array = [NSMutableArray arrayWithCapacity:len];
-    for (unsigned x = 0; x < len; x++)
-        [array addObject:vector[x]];
-    return array;
-}
-
-Plugin* FrameMac::createPlugin(Element* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType)
-{
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
-    return new Plugin(new Widget([_bridge viewForPluginWithURL:url.getNSURL()
-                                  attributeNames:nsArray(paramNames)
-                                  attributeValues:nsArray(paramValues)
-                                  MIMEType:mimeType
-                                  DOMElement:(element ? [DOMElement _elementWith:element] : nil)
-                                loadManually:d->m_doc->isPluginDocument()]));
-
-    END_BLOCK_OBJC_EXCEPTIONS;
-    return 0;
-}
-
-void FrameMac::redirectDataToPlugin(Widget* pluginWidget)
-{
-    [_bridge redirectDataToPlugin:pluginWidget->getView()];
-}
-
-
 void FrameMac::setView(FrameView *view)
 {
     Frame::setView(view);
@@ -513,13 +392,7 @@ void FrameMac::setView(FrameView *view)
     // Only one form submission is allowed per view of a part.
     // Since this part may be getting reused as a result of being
     // pulled from the back/forward cache, reset this flag.
-    d->m_submittedFormURL = KURL();
-}
-
-// FIXME: Remove this method; it's superfluous.
-void FrameMac::setTitle(const String &title)
-{
-    loader()->documentLoader()->setTitle(title);
+    loader()->resetMultipleFormSubmissionProtection();
 }
 
 void FrameMac::setStatusBarText(const String& status)
@@ -528,7 +401,7 @@ void FrameMac::setStatusBarText(const String& status)
     text.replace('\\', backslashAsCurrencySymbol());
     
     // We want the temporaries allocated here to be released even before returning to the 
-    // event loop; see <http://bugzilla.opendarwin.org/show_bug.cgi?id=9880>.
+    // event loop; see <http://bugs.webkit.org/show_bug.cgi?id=9880>.
     NSAutoreleasePool* localPool = [[NSAutoreleasePool alloc] init];
 
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
@@ -783,36 +656,6 @@ bool FrameMac::wheelEvent(NSEvent *event)
     return false;
 }
 
-void FrameMac::startRedirectionTimer()
-{
-    stopRedirectionTimer();
-
-    Frame::startRedirectionTimer();
-
-    // Don't report history navigations, just actual redirection.
-    if (d->m_scheduledRedirection != historyNavigationScheduled) {
-        double fireDate = currentTime() + d->m_redirectionTimer.nextFireInterval();
-        loader()->clientRedirected(KURL(d->m_redirectURL).getNSURL(),
-            d->m_delayRedirect, fireDate, d->m_redirectLockHistory, d->m_executingJavaScriptFormAction);
-    }
-}
-
-void FrameMac::stopRedirectionTimer()
-{
-    bool wasActive = d->m_redirectionTimer.isActive();
-
-    Frame::stopRedirectionTimer();
-
-    // Don't report history navigations, just actual redirection.
-    if (wasActive && d->m_scheduledRedirection != historyNavigationScheduled)
-        loader()->clientRedirectCancelledOrFinished(d->m_cancelWithLoadInProgress);
-}
-
-String FrameMac::userAgent() const
-{
-    return loader()->client()->userAgent();
-}
-
 String FrameMac::mimeTypeForFileName(const String& fileName) const
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
@@ -1071,47 +914,6 @@ NPObject *FrameMac::windowScriptNPObject()
     return _windowScriptNPObject;
 }
 
-Widget* FrameMac::createJavaAppletWidget(const IntSize& size, Element* element, const HashMap<String, String>& args)
-{
-    Widget* result = new Widget;
-    
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    
-    NSMutableArray *attributeNames = [[NSMutableArray alloc] init];
-    NSMutableArray *attributeValues = [[NSMutableArray alloc] init];
-    
-    DeprecatedString baseURLString;
-    HashMap<String, String>::const_iterator end = args.end();
-    for (HashMap<String, String>::const_iterator it = args.begin(); it != end; ++it) {
-        if (it->first.lower() == "baseurl")
-            baseURLString = it->second.deprecatedString();
-        [attributeNames addObject:it->first];
-        [attributeValues addObject:it->second];
-    }
-    
-    if (baseURLString.isEmpty())
-        baseURLString = document()->baseURL();
-
-    result->setView([_bridge viewForJavaAppletWithFrame:NSMakeRect(0, 0, size.width(), size.height())
-                                         attributeNames:attributeNames
-                                        attributeValues:attributeValues
-                                                baseURL:completeURL(baseURLString).getNSURL()
-                                             DOMElement:[DOMElement _elementWith:element]]);
-    [attributeNames release];
-    [attributeValues release];
-    view()->addChild(result);
-    
-    END_BLOCK_OBJC_EXCEPTIONS;
-    
-    return result;
-}
-
-void FrameMac::partClearedInBegin()
-{
-    if (javaScriptEnabled())
-        [_bridge windowObjectCleared];
-}
-
 WebCoreFrameBridge *FrameMac::bridgeForWidget(const Widget *widget)
 {
     ASSERT_ARG(widget, widget);
@@ -1127,24 +929,6 @@ NSView *FrameMac::documentViewForNode(Node *node)
     return [bridge documentView];
 }
 
-void FrameMac::saveDocumentState()
-{
-    // Do not save doc state if the page has a password field and a form that would be submitted
-    // via https
-    if (!(d->m_doc && d->m_doc->hasPasswordField() && d->m_doc->hasSecureForm())) {
-        BEGIN_BLOCK_OBJC_EXCEPTIONS;
-        [_bridge saveDocumentState];
-        END_BLOCK_OBJC_EXCEPTIONS;
-    }
-}
-
-void FrameMac::restoreDocumentState()
-{
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    [_bridge restoreDocumentState];
-    END_BLOCK_OBJC_EXCEPTIONS;
-}
-
 void FrameMac::runJavaScriptAlert(const String& message)
 {
     String text = message;
@@ -1210,17 +994,6 @@ void FrameMac::addMessageToConsole(const String &message, unsigned lineNumber, c
     [_bridge addMessageToConsole:dictionary];
 }
 
-void FrameMac::createEmptyDocument()
-{
-    // Although it's not completely clear from the name of this function,
-    // it does nothing if we already have a document, and just creates an
-    // empty one if we have no document at all.
-    if (!d->m_doc) {
-        loader()->loadEmptyDocumentSynchronously();
-        updateBaseURLForEmptyDocument();
-    }
-}
-
 bool FrameMac::keyEvent(NSEvent *event)
 {
     bool result;
@@ -2267,13 +2040,6 @@ NSWritingDirection FrameMac::baseWritingDirectionForSelectionStart() const
     return result;
 }
 
-void FrameMac::tokenizerProcessedData()
-{
-    if (d->m_doc)
-        checkCompleted();
-    loader()->checkLoadComplete();
-}
-
 void FrameMac::setBridge(WebCoreFrameBridge *bridge)
 { 
     if (_bridge == bridge)
@@ -2284,14 +2050,6 @@ void FrameMac::setBridge(WebCoreFrameBridge *bridge)
     _bridge = bridge;
 }
 
-String FrameMac::overrideMediaType() const
-{
-    NSString *overrideType = [_bridge overrideMediaType];
-    if (overrideType)
-        return overrideType;
-    return String();
-}
-
 WebCoreKeyboardUIMode FrameMac::keyboardUIMode() const
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
@@ -2301,25 +2059,6 @@ WebCoreKeyboardUIMode FrameMac::keyboardUIMode() const
     return WebCoreKeyboardAccessDefault;
 }
 
-void FrameMac::didTellBridgeAboutLoad(const String& URL)
-{
-    urlsBridgeKnowsAbout.add(URL);
-}
-
-bool FrameMac::haveToldBridgeAboutLoad(const String& URL)
-{
-    return urlsBridgeKnowsAbout.contains(URL);
-}
-
-void FrameMac::clear(bool clearWindowProperties)
-{
-    // FIXME: commenting the below line causes <http://bugs.webkit.org/show_bug.cgi?id=11212>, but putting it
-    // back causes a measurable performance regression which we will need to fix to restore the correct behavior
-    // urlsBridgeKnowsAbout.clear();
-    setMarkedTextRange(0, nil, nil);
-    Frame::clear();
-}
-
 void FrameMac::print()
 {
     [Mac(this)->_bridge print];
@@ -2846,16 +2585,6 @@ void FrameMac::setMarkedTextRange(const Range *range, NSArray *attributes, NSArr
         m_markedTextRange->startContainer(exception)->renderer()->repaint();
 }
 
-bool FrameMac::canGoBackOrForward(int distance) const
-{
-    return [_bridge canGoBackOrForward:distance];
-}
-
-void FrameMac::didFirstLayout()
-{
-    loader()->didFirstLayout();
-}
-
 NSMutableDictionary *FrameMac::dashboardRegionsDictionary()
 {
     Document *doc = document();
@@ -2910,11 +2639,6 @@ bool FrameMac::isCharacterSmartReplaceExempt(UChar c, bool isPreviousChar)
     return [_bridge isCharacterSmartReplaceExempt:c isPreviousCharacter:isPreviousChar];
 }
 
-void FrameMac::handledOnloadEvents()
-{
-    loader()->client()->dispatchDidHandleOnloadEvents();
-}
-
 bool FrameMac::shouldClose()
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
@@ -2988,34 +2712,4 @@ void FrameMac::paintCustomHighlight(const AtomicString& type, const FloatRect& b
     [_bridge paintCustomHighlight:type forBox:boxRect onLine:lineRect behindText:text entireLine:line];
 }
 
-KURL FrameMac::originalRequestURL() const
-{
-    return [_bridge originalRequestURL];
-}
-
-bool FrameMac::isLoadTypeReload()
-{
-    return loader()->loadType() == FrameLoadTypeReload;
-}
-
-int FrameMac::getHistoryLength()
-{
-    return [_bridge historyLength];
-}
-
-void FrameMac::goBackOrForward(int distance)
-{
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    [_bridge goBackOrForward:distance];
-    END_BLOCK_OBJC_EXCEPTIONS;
-}
-
-KURL FrameMac::historyURL(int distance)
-{
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    return KURL([_bridge historyURL:distance]);
-    END_BLOCK_OBJC_EXCEPTIONS;
-    return KURL();
-}
-
 } // namespace WebCore
index 134e2505a21f9d5c1cac55a5dc50916ac3618e91..207cc7ac701e07588333eb1c0d25499bae18f40d 100644 (file)
@@ -146,7 +146,6 @@ typedef enum {
 - (NSURL *)baseURL;
 
 - (void)installInFrame:(NSView *)view;
-- (void)removeFromFrame;
 
 - (BOOL)scrollOverflowInDirection:(WebScrollDirection)direction granularity:(WebScrollGranularity)granularity;
 
@@ -302,8 +301,6 @@ typedef enum {
 - (BOOL)canProvideDocumentSource;
 - (BOOL)canSaveAsWebArchive;
 
-- (NSURL*)originalRequestURL;
-- (void)frameDetached;
 - (void)receivedData:(NSData *)data textEncodingName:(NSString *)textEncodingName;
 
 @end
index b7d07118f0493c637c2b81a7203c17afe2ee94b4..dba710dae2139abd32f569ed42f3b9464355fce5 100644 (file)
@@ -372,7 +372,6 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
 
 - (void)close
 {
-    [self removeFromFrame];
     [self clearFrame];
     _closed = YES;
 }
@@ -387,7 +386,7 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
     // has been created. 
     if (doc) {
         doc->setShouldCreateRenderers([self shouldCreateRenderers]);
-        m_frame->addData((const char *)[data bytes], [data length]);
+        m_frame->loader()->addData((const char *)[data bytes], [data length]);
     }
 }
 
@@ -439,7 +438,8 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
 - (void)createFrameViewWithNSView:(NSView *)view marginWidth:(int)mw marginHeight:(int)mh
 {
     // If we own the view, delete the old one - otherwise the render m_frame will take care of deleting the view.
-    [self removeFromFrame];
+    if (m_frame)
+        m_frame->setView(0);
 
     FrameView* frameView = new FrameView(m_frame);
     m_frame->setView(frameView);
@@ -504,11 +504,12 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
 
 - (void)reapplyStylesForDeviceType:(WebCoreDeviceType)deviceType
 {
-    m_frame->setMediaType(deviceType == WebCoreDeviceScreen ? "screen" : "print");
+    if (m_frame->view())
+        m_frame->view()->setMediaType(deviceType == WebCoreDeviceScreen ? "screen" : "print");
     Document *doc = m_frame->document();
     if (doc)
         doc->setPrinting(deviceType == WebCoreDevicePrinter);
-    return m_frame->reparseConfiguration();
+    m_frame->reparseConfiguration();
 }
 
 static BOOL nowPrinting(WebCoreFrameBridge *self)
@@ -658,12 +659,6 @@ static BOOL nowPrinting(WebCoreFrameBridge *self)
     return [self copyRenderNode:renderer copier:copier];
 }
 
-- (void)removeFromFrame
-{
-    if (m_frame)
-        m_frame->setView(0);
-}
-
 - (void)installInFrame:(NSView *)view
 {
     // If this isn't the main frame, it must have a render m_frame set, or it
@@ -893,8 +888,8 @@ static HTMLFormElement *formElementFromDOMElement(DOMElement *element)
 
 - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)string forceUserGesture:(BOOL)forceUserGesture
 {
-    m_frame->createEmptyDocument();
-    JSValue* result = m_frame->executeScript(0, string, forceUserGesture);
+    m_frame->loader()->createEmptyDocument();
+    JSValue* result = m_frame->loader()->executeScript(0, string, forceUserGesture);
     if (!result || !result->isString())
         return 0;
     JSLock lock;
@@ -903,8 +898,8 @@ static HTMLFormElement *formElementFromDOMElement(DOMElement *element)
 
 - (NSAppleEventDescriptor *)aeDescByEvaluatingJavaScriptFromString:(NSString *)string
 {
-    m_frame->createEmptyDocument();
-    JSValue* result = m_frame->executeScript(0, string, true);
+    m_frame->loader()->createEmptyDocument();
+    JSValue* result = m_frame->loader()->executeScript(0, string, true);
     if (!result) // FIXME: pass errors
         return 0;
     JSLock lock;
@@ -951,7 +946,7 @@ static HTMLFormElement *formElementFromDOMElement(DOMElement *element)
 
 - (NSURL *)baseURL
 {
-    return m_frame->completeURL(m_frame->document()->baseURL()).getNSURL();
+    return m_frame->loader()->completeURL(m_frame->document()->baseURL()).getNSURL();
 }
 
 - (NSString *)stringWithData:(NSData *)data
@@ -1587,7 +1582,7 @@ static PlatformMouseEvent createMouseEventFromDraggingInfo(NSWindow* window, id
     if (m_frame) {
         RefPtr<FrameView> v = m_frame->view();
         if (v) {
-            ClipboardAccessPolicy policy = m_frame->baseURL().isLocalFile() ? ClipboardReadable : ClipboardTypesReadable;
+            ClipboardAccessPolicy policy = m_frame->loader()->baseURL().isLocalFile() ? ClipboardReadable : ClipboardTypesReadable;
             RefPtr<ClipboardMac> clipboard = new ClipboardMac(true, [info draggingPasteboard], policy);
             NSDragOperation srcOp = [info draggingSourceOperationMask];
             clipboard->setSourceOperation(srcOp);
@@ -1625,7 +1620,7 @@ static PlatformMouseEvent createMouseEventFromDraggingInfo(NSWindow* window, id
         RefPtr<FrameView> v = m_frame->view();
         if (v) {
             // Sending an event can result in the destruction of the view and part.
-            ClipboardAccessPolicy policy = m_frame->baseURL().isLocalFile() ? ClipboardReadable : ClipboardTypesReadable;
+            ClipboardAccessPolicy policy = m_frame->loader()->baseURL().isLocalFile() ? ClipboardReadable : ClipboardTypesReadable;
             RefPtr<ClipboardMac> clipboard = new ClipboardMac(true, [info draggingPasteboard], policy);
             clipboard->setSourceOperation([info draggingSourceOperationMask]);            
             v->cancelDragAndDrop(createMouseEventFromDraggingInfo([self window], info), clipboard.get());
@@ -1786,7 +1781,7 @@ static NSCharacterSet *_getPostSmartSet(void)
 
 - (BOOL)canProvideDocumentSource
 {
-    String mimeType = m_frame->responseMIMEType();
+    String mimeType = m_frame->loader()->responseMIMEType();
     
     if (WebCore::DOMImplementation::isTextMIMEType(mimeType) ||
         Image::supportsType(mimeType) ||
@@ -1803,17 +1798,6 @@ static NSCharacterSet *_getPostSmartSet(void)
     return [self canProvideDocumentSource];
 }
 
-- (NSURL*)originalRequestURL
-{
-    return [m_frame->loader()->activeDocumentLoader()->initialRequest() URL];
-}
-
-- (void)frameDetached
-{
-    m_frame->loader()->stopLoading();
-    m_frame->loader()->detachFromParent();
-}
-
 - (void)receivedData:(NSData *)data textEncodingName:(NSString *)textEncodingName
 {
     // Set the encoding. This only needs to be done once, but it's harmless to do it again later.
@@ -1823,7 +1807,7 @@ static NSCharacterSet *_getPostSmartSet(void)
     bool userChosen = !encoding.isNull();
     if (encoding.isNull())
         encoding = textEncodingName;
-    m_frame->setEncoding(encoding, userChosen);
+    m_frame->loader()->setEncoding(encoding, userChosen);
     [self addData:data];
 }
 
index 60106867a1261cd30bd8791d5973bb43a476253f..dd3882f2a40574eac5663ec6e120215376561626 100644 (file)
@@ -1616,7 +1616,7 @@ bool CSSParser::parseContent(int propId, bool important)
             // close-quote
             // no-open-quote
             // no-close-quote
-            // FIXME: These are not yet implemented (http://bugzilla.opendarwin.org/show_bug.cgi?id=6503).
+            // FIXME: These are not yet implemented (http://bugs.webkit.org/show_bug.cgi?id=6503).
         } else if (val->unit == CSSPrimitiveValue::CSS_STRING) {
             parsedValue = new CSSPrimitiveValue(domString(val->string), CSSPrimitiveValue::CSS_STRING);
         }
index 9bdddd894dc1aacd46cc1ff546bcb85c681a565f..52142a1d05e65fad8dc7331d2624916577c7d6d1 100644 (file)
 #include "Element.h"
 #include "ExceptionCode.h"
 #include "HTMLDocument.h"
+#include "HTMLViewSourceDocument.h"
+#include "Image.h"
+#include "ImageDocument.h"
 #include "MediaList.h"
+#include "PluginDocument.h"
+#include "PlugInInfoStore.h"
 #include "RegularExpression.h"
 #include "TextDocument.h"
 
@@ -287,14 +292,14 @@ PassRefPtr<CSSStyleSheet> DOMImplementation::createCSSStyleSheet(const String&,
     return sheet.release();
 }
 
-PassRefPtr<Document> DOMImplementation::createDocument(FrameView* v)
+PassRefPtr<Document> DOMImplementation::createDocument(FrameView* view)
 {
-    return new Document(this, v);
+    return new Document(this, view);
 }
 
-PassRefPtr<HTMLDocument> DOMImplementation::createHTMLDocument(FrameView* v)
+PassRefPtr<HTMLDocument> DOMImplementation::createHTMLDocument(FrameView* view)
 {
-    return new HTMLDocument(this, v);
+    return new HTMLDocument(this, view);
 }
 
 DOMImplementation* DOMImplementation::instance()
@@ -326,17 +331,31 @@ bool DOMImplementation::isTextMIMEType(const String& mimeType)
 
 PassRefPtr<HTMLDocument> DOMImplementation::createHTMLDocument(const String& title)
 {
-    RefPtr<HTMLDocument> d = createHTMLDocument();
+    RefPtr<HTMLDocument> d = new HTMLDocument(this, 0);
     d->open();
     d->write("<html><head><title>" + title + "</title></head><body></body></html>");
     return d.release();
 }
 
-#ifdef SVG_SUPPORT
-PassRefPtr<SVGDocument> DOMImplementation::createSVGDocument(FrameView* v)
+PassRefPtr<Document> DOMImplementation::createDocument(const String& type, FrameView* view, bool inViewSourceMode)
 {
-    return new SVGDocument(this, v);
-}
+#ifdef SVG_SUPPORT
+    if (type == "image/svg+xml")
+        return new SVGDocument(this, view);
 #endif
+    if (isXMLMIMEType(type))
+        return new Document(this, view);
+    if (isTextMIMEType(type))
+        return new TextDocument(this, view);
+    if ((type == "application/pdf" || type == "text/pdf") && PlugInInfoStore::supportsMIMEType(type))
+        return new PluginDocument(this, view);
+    if (Image::supportsType(type))
+        return new ImageDocument(this, view);
+    if (PlugInInfoStore::supportsMIMEType(type))
+        return new PluginDocument(this, view);
+    if (inViewSourceMode)
+        return new HTMLViewSourceDocument(this, view);
+    return new HTMLDocument(this, view);
+}
 
 }
index 10a2bbcb5706d516c94e097598dce7f4cdfe7412..e9f178abcd24204b2a3f3b9cb7341b1f36614d25 100644 (file)
@@ -36,11 +36,7 @@ class Document;
 class DocumentType;
 class FrameView;
 class HTMLDocument;
-#ifdef SVG_SUPPORT
-class SVGDocument;
-#endif
 class String;
-class TextDocument;
 
 typedef int ExceptionCode;
 
@@ -62,18 +58,16 @@ public:
     PassRefPtr<HTMLDocument> createHTMLDocument(const String& title);
 
     // Other methods (not part of DOM)
-    PassRefPtr<Document> createDocument(FrameView* = 0);
-    PassRefPtr<HTMLDocument> createHTMLDocument(FrameView* = 0);
-#ifdef SVG_SUPPORT
-    PassRefPtr<SVGDocument> createSVGDocument(FrameView* = 0);
-#endif
+    PassRefPtr<Document> createDocument(const String& MIMEType, FrameView*, bool inViewSourceMode);
+    PassRefPtr<Document> createDocument(FrameView*);
+    PassRefPtr<HTMLDocument> createHTMLDocument(FrameView*);
 
     // Returns the static instance of this class - only one instance of this class should
     // ever be present, and is used as a factory method for creating Document objects
     static DOMImplementation* instance();
 
-    static bool isXMLMIMEType(const String& mimeType);
-    static bool isTextMIMEType(const String& mimeType);
+    static bool isXMLMIMEType(const String& MIMEType);
+    static bool isTextMIMEType(const String& MIMEType);
 };
 
 } //namespace
index 9c158f66883ab98203b24ff1998b0e09c377e5d9..7db95a093b8c5b9b81cd8a14da92ffd5393ffb07 100644 (file)
@@ -31,9 +31,9 @@
 #include "CSSValueKeywords.h"
 #include "Comment.h"
 #include "DOMImplementation.h"
-#include "TextResourceDecoder.h"
 #include "DocLoader.h"
 #include "DocumentFragment.h"
+#include "DocumentLoader.h"
 #include "DocumentType.h"
 #include "EditingText.h"
 #include "EntityReference.h"
 #include "StyleSheetList.h"
 #include "SystemTime.h"
 #include "TextIterator.h"
+#include "TextResourceDecoder.h"
 #include "TreeWalker.h"
 #include "UIEvent.h"
+#include "XMLTokenizer.h"
 #include "csshelper.h"
 #include "cssstyleselector.h"
 #include "kjs_binding.h"
 #include "kjs_proxy.h"
-#include "XMLTokenizer.h"
 #include "xmlhttprequest.h"
 
 #ifdef XPATH_SUPPORT
@@ -640,7 +641,7 @@ Element *Document::getElementById(const AtomicString& elementId) const
 String Document::readyState() const
 {
     if (Frame* f = frame()) {
-        if (f->isComplete()) 
+        if (f->loader()->isComplete()) 
             return "complete";
         if (parsing()) 
             return "loading";
@@ -726,7 +727,7 @@ Element* Document::getElementByAccessKey(const String& key) const
 void Document::updateTitle()
 {
     if (Frame* f = frame())
-        f->setTitle(m_title);
+        f->loader()->setTitle(m_title);
 }
 
 void Document::setTitle(const String& title, Node* titleElement)
@@ -1131,13 +1132,13 @@ void Document::open()
         setURL(DeprecatedString());
         
 
-    if ((frame() && frame()->isLoadingMainResource()) || (tokenizer() && tokenizer()->executingScript()))
+    if ((frame() && frame()->loader()->isLoadingMainResource()) || (tokenizer() && tokenizer()->executingScript()))
         return;
 
     implicitOpen();
 
     if (frame())
-        frame()->didExplicitOpen();
+        frame()->loader()->didExplicitOpen();
 }
 
 void Document::cancelParsing()
@@ -1183,7 +1184,7 @@ HTMLElement* Document::body()
 void Document::close()
 {
     if (frame())
-        frame()->endIfNotLoading();
+        frame()->loader()->endIfNotLoading();
     implicitClose();
 }
 
@@ -1195,7 +1196,7 @@ void Document::implicitClose()
         return;
     }
 
-    bool wasLocationChangePending = frame() && frame()->isScheduledLocationChangePending();
+    bool wasLocationChangePending = frame() && frame()->loader()->isScheduledLocationChangePending();
     bool doload = !parsing() && m_tokenizer && !m_processingLoadEvent && !wasLocationChangePending;
     
     if (!doload)
@@ -1225,8 +1226,8 @@ void Document::implicitClose()
     
     dispatchImageLoadEventsNow();
     this->dispatchWindowEvent(loadEvent, false, false);
-    if (Frame *p = frame())
-        p->handledOnloadEvents();
+    if (Frame* f = frame())
+        f->loader()->handledOnloadEvents();
 #ifdef INSTRUMENT_LAYOUT_SCHEDULING
     if (!ownerElement())
         printf("onload fired at %d\n", elapsedTime());
@@ -1238,7 +1239,7 @@ void Document::implicitClose()
     // fires. This will improve onload scores, and other browsers do it.
     // If they wanna cheat, we can too. -dwh
 
-    if (frame() && frame()->isScheduledLocationChangePending() && elapsedTime() < cLayoutScheduleThreshold) {
+    if (frame() && frame()->loader()->isScheduledLocationChangePending() && elapsedTime() < cLayoutScheduleThreshold) {
         // Just bail out. Before or during the onload we were shifted to another page.
         // The old i-Bench suite does this. When this happens don't bother painting or laying out.        
         view()->unscheduleRelayout();
@@ -1246,7 +1247,7 @@ void Document::implicitClose()
     }
 
     if (frame())
-        frame()->checkEmitLoadEvent();
+        frame()->loader()->checkEmitLoadEvent();
 
     // Now do our painting/layout, but only if we aren't in a subframe or if we're in a subframe
     // that has been sized already.  Otherwise, our view size would be incorrect, so doing any 
@@ -1634,7 +1635,7 @@ void Document::processHttpEquiv(const String &equiv, const String &content)
             delay = str.toInt(&ok);
             // We want a new history item if the refresh timeout > 1 second
             if (ok && frame)
-                frame->scheduleRedirection(delay, frame->url().url(), delay <= 1);
+                frame->loader()->scheduleRedirection(delay, frame->loader()->url().url(), delay <= 1);
         } else {
             double delay = 0;
             bool ok = false;
@@ -1651,19 +1652,16 @@ void Document::processHttpEquiv(const String &equiv, const String &content)
             str = parseURL(String(str)).deprecatedString();
             if (ok && frame)
                 // We want a new history item if the refresh timeout > 1 second
-                frame->scheduleRedirection(delay, completeURL(str), delay <= 1);
+                frame->loader()->scheduleRedirection(delay, completeURL(str), delay <= 1);
         }
     } else if (equalIgnoringCase(equiv, "expires")) {
         String str = content.stripWhiteSpace();
         time_t expire_date = str.toInt();
         m_docLoader->setExpireDate(expire_date);
-    } else if ((equalIgnoringCase(equiv, "pragma") || equalIgnoringCase(equiv, "cache-control")) && frame) {
-        DeprecatedString str = content.deprecatedString().lower().stripWhiteSpace();
-        KURL url = frame->url();
     } else if (equalIgnoringCase(equiv, "set-cookie")) {
-        // ### FIXME: make setCookie work on XML documents too; e.g. in case of <html:meta .....>
+        // FIXME: make setCookie work on XML documents too; e.g. in case of <html:meta .....>
         if (isHTMLDocument())
-            static_cast<HTMLDocument *>(this)->setCookie(content);
+            static_cast<HTMLDocument*>(this)->setCookie(content);
     }
 }
 
@@ -2377,10 +2375,8 @@ Element *Document::ownerElement() const
 
 String Document::referrer() const
 {
-#if PLATFORM(MAC)
     if (frame())
         return frame()->loader()->referrer();
-#endif
     return String();
 }
 
@@ -3312,7 +3308,7 @@ void Document::finishedParsing()
 {
     setParsing(false);
     if (Frame* f = frame())
-        f->finishedParsing();
+        f->loader()->finishedParsing();
 }
 
 Vector<String> Document::formElementsState() const
index 6f575bae437a5e5bbdb7ab14c7cf1d8c26821fa6..526f6726b1306aeb3a5b099d960694c40ea7d540 100644 (file)
@@ -29,6 +29,7 @@
 #include "DocLoader.h"
 #include "ExceptionCode.h"
 #include "Frame.h"
+#include "FrameLoader.h"
 #include "XSLStyleSheet.h"
 #include "XMLTokenizer.h" // for parseAttributes()
 
@@ -161,7 +162,7 @@ bool ProcessingInstruction::checkStyleSheet()
                     {
                         String charset = attrs.get("charset");
                         if (charset.isEmpty())
-                            charset = document()->frame()->encoding();
+                            charset = document()->frame()->loader()->encoding();
 
                         m_cachedSheet = document()->docLoader()->requestCSSStyleSheet(document()->completeURL(href), charset);
                     }
index 6e584d7f0ca61881e30f292878a9b26923bca43e..d84e881e59632b7cb2fa409cf716ec3c64696ad5 100644 (file)
@@ -35,6 +35,7 @@
 #include "DocumentType.h"
 #include "EventNames.h"
 #include "Frame.h"
+#include "FrameLoader.h"
 #include "FrameView.h"
 #include "HTMLNames.h"
 #include "HTMLScriptElement.h"
@@ -845,7 +846,7 @@ void XMLTokenizer::endElementNs()
                 if (child->isTextNode() || child->nodeType() == Node::CDATA_SECTION_NODE)
                     scriptCode += static_cast<CharacterData*>(child)->data();
             }
-            m_view->frame()->executeScript(m_doc->URL(), m_scriptStartLine - 1, 0, scriptCode);
+            m_view->frame()->loader()->executeScript(m_doc->URL(), m_scriptStartLine - 1, 0, scriptCode);
         }
         
         m_requestingScript = false;
@@ -1183,7 +1184,7 @@ static void ignorableWhitespaceHandler(void *ctx, const xmlChar *ch, int len)
 {
     // nothing to do, but we need this to work around a crasher
     // http://bugzilla.gnome.org/show_bug.cgi?id=172255
-    // http://bugzilla.opendarwin.org/show_bug.cgi?id=5792
+    // http://bugs.webkit.org/show_bug.cgi?id=5792
 }
 
 void XMLTokenizer::initializeParserContext()
@@ -1339,7 +1340,7 @@ void XMLTokenizer::notifyFinished(CachedResource *finishedObj)
     if (errorOccurred) 
         EventTargetNodeCast(e.get())->dispatchHTMLEvent(errorEvent, true, false);
     else {
-        m_view->frame()->executeScript(cachedScriptUrl, 0, 0, scriptSource);
+        m_view->frame()->loader()->executeScript(cachedScriptUrl, 0, 0, scriptSource);
         EventTargetNodeCast(e.get())->dispatchHTMLEvent(loadEvent, false, false);
     }
     
index b073a2c59e930eb102139e9b24d7507f36f34071..11cfbecd419b1968bc2fbac56b0a6ac008b0f550 100644 (file)
@@ -1031,7 +1031,7 @@ PassRefPtr<Range> TextIterator::rangeFromLocationAndLength(Element *scope, int r
 
     TextIterator it(rangeOfContents(scope).get());
     
-    // FIXME: the atEnd() check shouldn't be necessary, workaround for <http://bugzilla.opendarwin.org/show_bug.cgi?id=6289>.
+    // FIXME: the atEnd() check shouldn't be necessary, workaround for <http://bugs.webkit.org/show_bug.cgi?id=6289>.
     if (rangeLocation == 0 && rangeLength == 0 && it.atEnd()) {
         int exception = 0;
         textRunRange = it.range();
index 1be1b21cffc38afb4989c1cc93a58893ae76202d..3b1d66fc49ee9e0c33789572c4e335106a28cf0d 100644 (file)
@@ -29,6 +29,7 @@
 #include "Event.h"
 #include "EventNames.h"
 #include "Frame.h"
+#include "FrameLoader.h"
 #include "HTMLImageElement.h"
 #include "HTMLNames.h"
 #include "KeyboardEvent.h"
@@ -208,7 +209,7 @@ void HTMLAnchorElement::defaultEventHandler(Event* evt)
         }
 
         if (!evt->defaultPrevented() && document()->frame())
-            document()->frame()->urlSelected(document()->completeURL(url), target, evt);
+            document()->frame()->loader()->urlSelected(document()->completeURL(url), target, evt);
 
         evt->setDefaultHandled();
     } else if (m_isLink && isContentEditable()) {
index b510b5944f5fcfda0516aed1f54a1988102f062c..9e70d77448b2987a011fad990bad2c6cf85656bd 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "Document.h"
 #include "Frame.h"
+#include "FrameLoader.h"
 #include "HTMLNames.h"
 #include "KURL.h"
 #include "csshelper.h"
@@ -78,7 +79,7 @@ void HTMLBaseElement::process()
         return;
 
     if (!m_href.isEmpty() && document()->frame())
-        document()->setBaseURL(KURL(document()->frame()->url(), m_href.deprecatedString()).url());
+        document()->setBaseURL(KURL(document()->frame()->loader()->url(), m_href.deprecatedString()).url());
 
     if (!m_target.isEmpty())
         document()->setBaseTarget(m_target.deprecatedString());
index cef8df3e69ea247d38a3a072d7b186aded75e1ad..1439c8bc640531587b07a50a6d6fa54e90620730 100644 (file)
@@ -61,6 +61,7 @@
 #include "DocumentType.h"
 #include "ExceptionCode.h"
 #include "Frame.h"
+#include "FrameLoader.h"
 #include "HTMLElement.h"
 #include "HTMLElementFactory.h"
 #include "HTMLNames.h"
@@ -87,8 +88,8 @@ HTMLDocument::~HTMLDocument()
 
 String HTMLDocument::lastModified() const
 {
-    if ( frame() )
-        return frame()->lastModified();
+    if (frame())
+        return frame()->loader()->lastModified();
     return String();
 }
 
index 4fde5b0eca8086fe75bbe92925a72dd40b9cee6d..23754d6ae28228dbb4d8533f44c8780ad536d18d 100644 (file)
@@ -32,6 +32,7 @@
 #include "FormData.h"
 #include "FormDataList.h"
 #include "Frame.h"
+#include "FrameLoader.h"
 #include "HTMLDocument.h"
 #include "HTMLFormCollection.h"
 #include "HTMLImageElement.h"
@@ -198,7 +199,7 @@ bool HTMLFormElement::formData(FormData& result) const
             break;
     if (!encoding.isValid()) {
         if (frame)
-            encoding = frame->encoding();
+            encoding = frame->loader()->encoding();
         else
             encoding = Latin1Encoding();
     }
@@ -347,13 +348,13 @@ void HTMLFormElement::submit(Event* event, bool activateSubmitButton)
     HTMLGenericFormElement* firstSuccessfulSubmitButton = 0;
     bool needButtonActivation = activateSubmitButton; // do we need to activate a submit button?
     
-    frame->clearRecordedFormValues();
+    frame->loader()->clearRecordedFormValues();
     for (unsigned i = 0; i < formElements.size(); ++i) {
         HTMLGenericFormElement* current = formElements[i];
         if (current->hasLocalName(inputTag)) {
             HTMLInputElement* input = static_cast<HTMLInputElement*>(current);
             if (input->isTextField()) {
-                frame->recordFormValue(input->name(), input->value(), this);
+                frame->loader()->recordFormValue(input->name(), input->value(), this);
                 if (input->renderer() && input->inputType() == HTMLInputElement::SEARCH)
                     static_cast<RenderLineEdit*>(input->renderer())->addSearchResult();
             }
@@ -375,9 +376,9 @@ void HTMLFormElement::submit(Event* event, bool activateSubmitButton)
     FormData postData;
     if (formData(postData)) {
         if (m_post)
-            frame->submitForm("POST", m_url, postData, m_target, enctype(), boundary(), event);
+            frame->loader()->submitForm("POST", m_url, postData, m_target, enctype(), boundary(), event);
         else
-            frame->submitForm("GET", m_url, postData, m_target, String(), String(), event);
+            frame->loader()->submitForm("GET", m_url, postData, m_target, String(), String(), event);
     }
 
     if (needButtonActivation && firstSuccessfulSubmitButton)
index 323b57d464822a6d3daa232eb9da0df5045ec7b8..b9f9c9f67558493443fe466670ef547636860da7 100644 (file)
 #include "config.h"
 #include "HTMLFrameElementBase.h"
 
-#include "csshelper.h"
 #include "Document.h"
 #include "EventNames.h"
 #include "Frame.h"
+#include "FrameLoader.h"
 #include "FrameTree.h"
 #include "FrameView.h"
-#include "HTMLNames.h"
 #include "HTMLFrameSetElement.h"
+#include "HTMLNames.h"
 #include "KURL.h"
 #include "Page.h"
 #include "RenderFrame.h"
+#include "csshelper.h"
 
 namespace WebCore {
 
@@ -78,7 +79,7 @@ bool HTMLFrameElementBase::isURLAllowed(const AtomicString& URLString) const
     // But we don't allow more than one.
     bool foundSelfReference = false;
     for (Frame* frame = document()->frame(); frame; frame = frame->tree()->parent()) {
-        KURL frameURL = frame->url();
+        KURL frameURL = frame->loader()->url();
         frameURL.setRef(DeprecatedString::null);
         if (frameURL == completeURL) {
             if (foundSelfReference)
@@ -98,7 +99,7 @@ void HTMLFrameElementBase::openURL()
     if (m_URL.isEmpty())
         m_URL = "about:blank";
 
-    document()->frame()->requestFrame(this, m_URL, m_name);
+    document()->frame()->loader()->requestFrame(this, m_URL, m_name);
 
     if (contentFrame())
         contentFrame()->setInViewSourceMode(viewSourceMode());
@@ -187,7 +188,7 @@ void HTMLFrameElementBase::willRemove()
 {
     if (Frame* frame = contentFrame()) {
         frame->disconnectOwnerElement();
-        frame->frameDetached();
+        frame->loader()->frameDetached();
     }
 
     HTMLElement::willRemove();
index cfad4483aa8b40a8ffc6f19014366fe79f92ebad..333e8b2c369a778d7a2fa52bc33767b99b375b2c 100644 (file)
@@ -1115,7 +1115,7 @@ void HTMLInputElement::setValueFromRenderer(const String& value)
 
     // Workaround for bug where trailing \n is included in the result of textContent.
     // The assert macro above may also be simplified to:  value == constrainValue(value)
-    // http://bugzilla.opendarwin.org/show_bug.cgi?id=9661
+    // http://bugs.webkit.org/show_bug.cgi?id=9661
     if (value == "\n")
         m_value = "";
     else
index 470c6ab0d401797fdf903c462c34508920a23f04..596c4e59bb262504fbd89f30a5cf0fa597573b2d 100644 (file)
@@ -28,6 +28,7 @@
 #include "DocLoader.h"
 #include "Document.h"
 #include "Frame.h"
+#include "FrameLoader.h"
 #include "FrameTree.h"
 #include "HTMLNames.h"
 #include "MediaList.h"
@@ -178,7 +179,7 @@ void HTMLLinkElement::process()
             
             String chset = getAttribute(charsetAttr);
             if (chset.isEmpty() && document()->frame())
-                chset = document()->frame()->encoding();
+                chset = document()->frame()->loader()->encoding();
             
             if (m_cachedSheet) {
                 if (m_loading) {
index 5023ba0a4f71e50d579f09c6b2c18b9c297f0e39..73925e1d63f8be2c3ae695ec9f126ee8f8f30b49 100644 (file)
@@ -502,7 +502,7 @@ bool HTMLParser::handleError(Node* n, bool flat, const AtomicString& localName,
                     Node *node = current;
                     Node *parent = node->parentNode();
                     // A script may have removed the current node's parent from the DOM
-                    // http://bugzilla.opendarwin.org/show_bug.cgi?id=7137
+                    // http://bugs.webkit.org/show_bug.cgi?id=7137
                     // FIXME: we should do real recovery here and re-parent with the correct node.
                     if (!parent)
                         return false;
@@ -1060,7 +1060,7 @@ void HTMLParser::handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem)
          
     // Check if the block is still in the tree. If it isn't, then we don't
     // want to remove it from its parent (that would crash) or insert it into
-    // a new parent later. See http://bugzilla.opendarwin.org/show_bug.cgi?id=6778
+    // a new parent later. See http://bugs.webkit.org/show_bug.cgi?id=6778
     bool isBlockStillInTree = blockElem->parentNode();
 
     // We need to make a clone of |residualElem| and place it just inside |blockElem|.
index 899734aa87ec340e76e5d369deb926d89be955ea..4b9b6b0ec01632c96d26376856a9105d150af566 100644 (file)
@@ -22,7 +22,7 @@ module html {
 
     interface [LegacyParent=KJS::JSHTMLElement] HTMLPreElement : HTMLElement {
         // FIXME: DOM spec says that width should be of type DOMString
-        // see http://bugzilla.opendarwin.org/show_bug.cgi?id=8992
+        // see http://bugs.webkit.org/show_bug.cgi?id=8992
         attribute long width;
         
         // Extensions
index 751eb519a2f254b1d03f6863e9058e07fbdf9248..8b5611b0fe4e1c5076c9cab9090621ad5e269c2b 100644 (file)
@@ -74,7 +74,7 @@ void HTMLScriptElement::parseMappedAttribute(MappedAttribute *attr)
             return;
 
         // FIXME: Evaluate scripts in viewless documents.
-        // See http://bugzilla.opendarwin.org/show_bug.cgi?id=5727
+        // See http://bugs.webkit.org/show_bug.cgi?id=5727
         if (!document()->frame())
             return;
     
@@ -109,7 +109,7 @@ void HTMLScriptElement::insertedIntoDocument()
     
     // FIXME: Eventually we'd like to evaluate scripts which are inserted into a 
     // viewless document but this'll do for now.
-    // See http://bugzilla.opendarwin.org/show_bug.cgi?id=5727
+    // See http://bugs.webkit.org/show_bug.cgi?id=5727
     if (!document()->frame())
         return;
     
index 60873aa2004c91f2818d4186c20f69ed9e7841ce..a18133818314b818a7af746bf020baef08a6c3c0 100644 (file)
@@ -34,6 +34,7 @@
 #include "DocumentFragment.h"
 #include "EventNames.h"
 #include "Frame.h"
+#include "FrameLoader.h"
 #include "FrameView.h"
 #include "HTMLViewSourceDocument.h"
 #include "HTMLElement.h"
@@ -497,7 +498,7 @@ HTMLTokenizer::State HTMLTokenizer::scriptExecution(const DeprecatedString& str,
 #endif
 
     m_state = state;
-    m_doc->frame()->executeScript(url,baseLine,0,str);
+    m_doc->frame()->loader()->executeScript(url, baseLine, 0, str);
     state = m_state;
 
     state.setAllowYield(true);
@@ -1159,7 +1160,7 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString &src, State state)
                     if ((a = currToken.attrs->getAttributeItem(charsetAttr)))
                         scriptSrcCharset = a->value().domString().stripWhiteSpace();
                     if (scriptSrcCharset.isEmpty())
-                        scriptSrcCharset = m_doc->frame()->encoding();
+                        scriptSrcCharset = m_doc->frame()->loader()->encoding();
                     /* Check type before language, since language is deprecated */
                     if ((a = currToken.attrs->getAttributeItem(typeAttr)) != 0 && !a->value().isEmpty())
                         foundTypeAttribute = true;
@@ -1364,7 +1365,7 @@ bool HTMLTokenizer::write(const SegmentedString& str, bool appendData)
 
     State state = m_state;
 
-    while (!src.isEmpty() && (!frame || !frame->isScheduledLocationChangePending())) {
+    while (!src.isEmpty() && (!frame || !frame->loader()->isScheduledLocationChangePending())) {
         if (!continueProcessing(processedCount, startTime, state))
             break;
 
@@ -1494,7 +1495,7 @@ void HTMLTokenizer::stopParsing()
     // The part needs to know that the tokenizer has finished with its data,
     // regardless of whether it happened naturally or due to manual intervention.
     if (!m_fragment && m_doc->frame())
-        m_doc->frame()->tokenizerProcessedData();
+        m_doc->frame()->loader()->tokenizerProcessedData();
 }
 
 bool HTMLTokenizer::processingData() const
@@ -1523,7 +1524,7 @@ void HTMLTokenizer::timerFired(Timer<HTMLTokenizer>*)
   
     // If we called end() during the write,  we need to let WebKit know that we're done processing the data.
     if (didCallEnd && frame)
-        frame->tokenizerProcessedData();
+        frame->loader()->tokenizerProcessedData();
 }
 
 void HTMLTokenizer::end()
index f04f9131454d36d2c75a748fb51de283f1704e4e..0c8cbe9a06c01e8b0f4f5cdcccaeb7f73f414401 100644 (file)
@@ -124,8 +124,8 @@ void KCanvasFilterQuartz::prepareFilter(const FloatRect &bbox)
     // Use of CGBegin/EndTransparencyLayer around this call causes over release
     // of cgContext due to it being created on an autorelease pool, and released
     // after CGEndTransparencyLayer. Create local pool to fix.
-    // <http://bugzilla.opendarwin.org/show_bug.cgi?id=8425>
-    // <http://bugzilla.opendarwin.org/show_bug.cgi?id=6947>
+    // <http://bugs.webkit.org/show_bug.cgi?id=8425>
+    // <http://bugs.webkit.org/show_bug.cgi?id=6947>
     // <rdar://problem/4647735>
     NSAutoreleasePool *filterContextPool = [[NSAutoreleasePool alloc] init];
     m_filterCIContext = HardRetain([CIContext contextWithCGContext:cgContext options:contextOptions]);
index b66e3023f14564cb2989d42b730ece349f125f9f..729b3e68bf07b18fdd9da070672926563c67ced8 100644 (file)
@@ -31,6 +31,7 @@
 #include "Event.h"
 #include "EventNames.h"
 #include "Frame.h"
+#include "FrameLoader.h"
 #include "KRenderingDevice.h"
 #include "MouseEvent.h"
 #include "MouseEvent.h"
@@ -101,7 +102,7 @@ void SVGAElement::defaultEventHandler(Event *evt)
 
         if (!evt->defaultPrevented())
             if (document() && document()->frame())
-                document()->frame()->urlSelected(document()->completeURL(url), target, evt);
+                document()->frame()->loader()->urlSelected(document()->completeURL(url), target, evt);
 
         evt->setDefaultHandled();
     }
index c9f6d341e4da91692fa3d2d6550d73da1bf954e0..a859a806b9fda9b9e5e041028a431363963ae0aa 100644 (file)
@@ -171,7 +171,7 @@ void SVGElement::sendSVGLoadEventIfPossible(bool sendParentLoadEvents)
         if (sendParentLoadEvents)
             parent = currentTarget->parentNode(); // save the next parent to dispatch too incase dispatching the event changes the tree
         
-        // FIXME: This malloc could be avoided by walking the tree first to check if any listeners are present: http://bugzilla.opendarwin.org/show_bug.cgi?id=10264
+        // FIXME: This malloc could be avoided by walking the tree first to check if any listeners are present: http://bugs.webkit.org/show_bug.cgi?id=10264
         RefPtr<Event> event = new Event(loadEvent, false, false);
         event->setTarget(currentTarget.get());
         ExceptionCode ignored = 0;
index a835698d79c959fd94e2f0e234e8e7e280a7d845..f276b0903599a415527fd8c08799bf0dc3ff450b 100644 (file)
@@ -35,6 +35,7 @@
 #include "CachedXSLStyleSheet.h"
 #include "Document.h"
 #include "Frame.h"
+#include "FrameLoader.h"
 #include "LoaderFunctions.h"
 #include "loader.h"
 
@@ -172,7 +173,7 @@ void DocLoader::setLoadInProgress(bool load)
 {
     m_loadInProgress = load;
     if (!load)
-        m_frame->loadDone();
+        m_frame->loader()->loadDone();
 }
 
 }
index 080a3773242bdabc146885a9e8ca9ffdcba700ba..6fe7246cf2ac849ff32096934bef289f38fe9963 100644 (file)
 #include "config.h"
 #include "FrameLoader.h"
 
+#include "Cache.h"
 #include "Chrome.h"
+#include "DOMImplementation.h"
+#include "DocLoader.h"
+#include "Document.h"
 #include "DocumentLoader.h"
+#include "EditCommand.h"
+#include "Editor.h"
 #include "Element.h"
+#include "EventNames.h"
 #include "FloatRect.h"
 #include "FormState.h"
 #include "Frame.h"
 #include "FrameLoadRequest.h"
 #include "FrameLoaderClient.h"
+#include "FramePrivate.h"
 #include "FrameTree.h"
+#include "FrameView.h"
+#include "HTMLFormElement.h"
+#include "HTMLNames.h"
+#include "HTMLObjectElement.h"
+#include "HTMLPlugInElement.h"
+#include "IconDatabase.h"
+#include "IconLoader.h"
 #include "MainResourceLoader.h"
 #include "Page.h"
+#include "PageState.h"
+#include "RenderPart.h"
+#include "RenderWidget.h"
+#include "ResourceRequest.h"
+#include "SegmentedString.h"
+#include "Settings.h"
+#include "SystemTime.h"
+#include "TextResourceDecoder.h"
 #include "WindowFeatures.h"
+#include "XMLTokenizer.h"
+#include "kjs_binding.h"
+#include "kjs_proxy.h"
+#include "kjs_window.h"
+#include "xmlhttprequest.h"
+#include <kjs/JSLock.h>
+#include <kjs/object.h>
+
+#if PLATFORM(MAC)
+#include "FrameMac.h"
+#endif
+
+using namespace KJS;
 
 namespace WebCore {
 
+using namespace HTMLNames;
+using namespace EventNames;
+
+struct FormSubmission {
+    const char* action;
+    String URL;
+    FormData data;
+    String target;
+    String contentType;
+    String boundary;
+    RefPtr<Event> event;
+
+    FormSubmission(const char* a, const String& u, const FormData& d, const String& t,
+            const String& ct, const String& b, PassRefPtr<Event> e)
+        : action(a)
+        , URL(u)
+        , data(d)
+        , target(t)
+        , contentType(ct)
+        , boundary(b)
+        , event(e)
+    {
+    }
+};
+
+struct ScheduledRedirection {
+    enum Type { redirection, locationChange, historyNavigation, locationChangeDuringLoad };
+    Type type;
+    double delay;
+    String URL;
+    String referrer;
+    int historySteps;
+    bool lockHistory;
+    bool wasUserGesture;
+
+    ScheduledRedirection(double redirectDelay, const String& redirectURL, bool redirectLockHistory)
+        : type(redirection)
+        , delay(redirectDelay)
+        , URL(redirectURL)
+        , historySteps(0)
+        , lockHistory(redirectLockHistory)
+        , wasUserGesture(false)
+    {
+    }
+
+    ScheduledRedirection(Type locationChangeType,
+            const String& locationChangeURL, const String& locationChangeReferrer,
+            bool locationChangeLockHistory, bool locationChangeWasUserGesture)
+        : type(locationChangeType)
+        , delay(0)
+        , URL(locationChangeURL)
+        , referrer(locationChangeReferrer)
+        , historySteps(0)
+        , lockHistory(locationChangeLockHistory)
+        , wasUserGesture(locationChangeWasUserGesture)
+    {
+    }
+
+    explicit ScheduledRedirection(int historyNavigationSteps)
+        : type(historyNavigation)
+        , delay(0)
+        , historySteps(historyNavigationSteps)
+        , lockHistory(false)
+        , wasUserGesture(false)
+    {
+    }
+};
+
+static double storedTimeOfLastCompletedLoad;
+
+static void cancelAll(const ResourceLoaderSet& loaders)
+{
+    const ResourceLoaderSet copy = loaders;
+    ResourceLoaderSet::const_iterator end = copy.end();
+    for (ResourceLoaderSet::const_iterator it = copy.begin(); it != end; ++it)
+        (*it)->cancel();
+}
+
+static bool getString(JSValue* result, String& string)
+{
+    if (!result)
+        return false;
+    JSLock lock;
+    UString ustring;
+    if (!result->getString(ustring))
+        return false;
+    string = ustring;
+    return true;
+}
+
+bool isBackForwardLoadType(FrameLoadType type)
+{
+    switch (type) {
+        case FrameLoadTypeStandard:
+        case FrameLoadTypeReload:
+        case FrameLoadTypeReloadAllowingStaleData:
+        case FrameLoadTypeSame:
+        case FrameLoadTypeInternal:
+        case FrameLoadTypeReplace:
+            return false;
+        case FrameLoadTypeBack:
+        case FrameLoadTypeForward:
+        case FrameLoadTypeIndexedBackForward:
+            return true;
+    }
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
+static int numRequests(Document* document)
+{
+    if (document)
+        return cache()->loader()->numRequests(document->docLoader());
+    return 0;
+}
+
 FrameLoader::FrameLoader(Frame* frame)
     : m_frame(frame)
     , m_client(0)
     , m_state(FrameStateCommittedPage)
     , m_loadType(FrameLoadTypeStandard)
+    , m_policyLoadType(FrameLoadTypeStandard)
     , m_delegateIsHandlingProvisionalLoadError(false)
     , m_delegateIsDecidingNavigationPolicy(false)
     , m_delegateIsHandlingUnimplementablePolicy(false)
     , m_firstLayoutDone(false)
     , m_quickRedirectComing(false)
     , m_sentRedirectNotification(false)
-    , m_isStoppingLoad(false)
+    , m_inStopAllLoaders(false)
+    , m_cachePolicy(CachePolicyVerify)
+    , m_isExecutingJavaScriptFormAction(false)
+    , m_isRunningScript(false)
+    , m_wasLoadEventEmitted(false)
+    , m_wasUnloadEventEmitted(false)
+    , m_isComplete(false)
+    , m_isLoadingMainResource(false)
+    , m_cancellingWithLoadInProgress(false)
+    , m_needsClear(false)
+    , m_receivedData(false)
+    , m_encodingWasChosenByUser(false)
+    , m_containsPlugIns(false)
+    , m_redirectionTimer(this, &FrameLoader::redirectionTimerFired)
+    , m_opener(0)
+    , m_openedByJavaScript(false)
 {
 }
 
@@ -63,6 +231,12 @@ FrameLoader::~FrameLoader()
 {
     if (m_client)
         m_client->detachFrameLoader();
+
+    setOpener(0);
+
+    HashSet<Frame*>::iterator end = m_openedFrames.end();
+    for (HashSet<Frame*>::iterator it = m_openedFrames.begin(); it != end; ++it)
+        (*it)->loader()->m_opener = 0;
 }
 
 static void setAllDefersLoading(const ResourceLoaderSet& loaders, bool defers)
@@ -88,8 +262,8 @@ Frame* FrameLoader::createWindow(const FrameLoadRequest& request, const WindowFe
 
     if (!request.frameName().isEmpty())
         if (Frame* frame = m_frame->tree()->find(request.frameName())) {
-            if (!request.resourceRequest().url().isEmpty())
 #if PLATFORM(MAC)
+            if (!request.resourceRequest().url().isEmpty())
                 frame->loader()->load(request, true, 0, 0, HashMap<String, String>());
 #endif
             frame->page()->chrome()->focus();
@@ -98,7 +272,7 @@ Frame* FrameLoader::createWindow(const FrameLoadRequest& request, const WindowFe
 
     // FIXME: Setting the referrer should be the caller's responsibility.
     FrameLoadRequest requestWithReferrer = request;
-    requestWithReferrer.resourceRequest().setHTTPReferrer(m_frame->referrer());
+    requestWithReferrer.resourceRequest().setHTTPReferrer(outgoingReferrer());
     
     Page* page;
     if (features.dialog)
@@ -138,4 +312,1948 @@ Frame* FrameLoader::createWindow(const FrameLoadRequest& request, const WindowFe
     return frame;
 }
 
+void FrameLoader::changeLocation(const String& URL, const String& referrer, bool lockHistory, bool userGesture)
+{
+    if (URL.find("javascript:", 0, false) == 0) {
+        String script = KURL::decode_string(URL.substring(strlen("javascript:")).deprecatedString());
+        JSValue* result = executeScript(0, script, userGesture);
+        String scriptResult;
+        if (getString(result, scriptResult)) {
+            begin(m_URL);
+            write(scriptResult);
+            end();
+        }
+        return;
+    }
+
+    ResourceRequestCachePolicy policy = (m_cachePolicy == CachePolicyReload) || (m_cachePolicy == CachePolicyRefresh)
+        ? ReloadIgnoringCacheData : UseProtocolCachePolicy;
+    ResourceRequest request(completeURL(URL), referrer, policy);
+    
+    urlSelected(request, "_self", 0, lockHistory);
+}
+
+void FrameLoader::urlSelected(const ResourceRequest& request, const String& _target, Event* triggeringEvent, bool lockHistory)
+{
+    String target = _target;
+    if (target.isEmpty() && m_frame->document())
+        target = m_frame->document()->baseTarget();
+
+    const KURL& url = request.url();
+    if (url.url().startsWith("javascript:", false)) {
+        executeScript(0, KURL::decode_string(url.url().mid(strlen("javascript:"))), true);
+        return;
+    }
+
+    if (!url.isValid())
+        return;
+
+    FrameLoadRequest frameRequest(request, target);
+
+    if (frameRequest.resourceRequest().httpReferrer().isEmpty())
+        frameRequest.resourceRequest().setHTTPReferrer(m_outgoingReferrer);
+
+    urlSelected(frameRequest, triggeringEvent);
+}
+
+bool FrameLoader::requestFrame(Element* ownerElement, const String& urlParam, const AtomicString& frameName)
+{
+    DeprecatedString urlString = urlParam.deprecatedString();
+
+    // Support for <frame src="javascript:string">
+    KURL scriptURL;
+    KURL url;
+    if (urlString.startsWith("javascript:", false)) {
+        scriptURL = urlString;
+        url = "about:blank";
+    } else
+        url = completeURL(urlString);
+
+    Frame* frame = m_frame->tree()->child(frameName);
+    if (frame) {
+        ResourceRequestCachePolicy policy = (m_cachePolicy == CachePolicyReload) || (m_cachePolicy == CachePolicyRefresh)
+            ? ReloadIgnoringCacheData : UseProtocolCachePolicy;
+        frame->loader()->urlSelected(ResourceRequest(url, m_outgoingReferrer, policy), 0);
+    } else
+        frame = loadSubframe(ownerElement, url, frameName, m_outgoingReferrer);
+    
+    if (!frame)
+        return false;
+
+    if (!scriptURL.isEmpty())
+        frame->loader()->replaceContentsWithScriptResult(scriptURL);
+
+    return true;
+}
+
+Frame* FrameLoader::loadSubframe(Element* ownerElement, const KURL& url, const String& name, const String& referrer)
+{
+    Frame* frame = createFrame(url, name, ownerElement, referrer);
+    if (!frame)  {
+        checkEmitLoadEvent();
+        return 0;
+    }
+    
+    frame->loader()->m_isComplete = false;
+    
+    if (ownerElement->renderer() && frame->view())
+        static_cast<RenderWidget*>(ownerElement->renderer())->setWidget(frame->view());
+    
+    checkEmitLoadEvent();
+    
+    // In these cases, the synchronous load would have finished
+    // before we could connect the signals, so make sure to send the 
+    // completed() signal for the child by hand
+    // FIXME: In this case the Frame will have finished loading before 
+    // it's being added to the child list. It would be a good idea to
+    // create the child first, then invoke the loader separately.
+    if (url.isEmpty() || url == "about:blank") {
+        frame->loader()->completed();
+        frame->loader()->checkCompleted();
+    }
+
+    return frame;
+}
+
+void FrameLoader::submitFormAgain()
+{
+    if (m_isRunningScript)
+        return;
+    OwnPtr<FormSubmission> form(m_deferredFormSubmission.release());
+    if (form)
+        submitForm(form->action, form->URL, form->data, form->target,
+            form->contentType, form->boundary, form->event.get());
+}
+
+void FrameLoader::submitForm(const char* action, const String& url, const FormData& formData,
+    const String& target, const String& contentType, const String& boundary, Event* event)
+{
+    KURL u = completeURL(url);
+    if (!u.isValid())
+        return;
+
+    DeprecatedString urlString = u.url();
+    if (urlString.startsWith("javascript:", false)) {
+        m_isExecutingJavaScriptFormAction = true;
+        executeScript(0, KURL::decode_string(urlString.mid(strlen("javascript:"))));
+        m_isExecutingJavaScriptFormAction = false;
+        return;
+    }
+
+    if (m_isRunningScript) {
+        if (m_deferredFormSubmission)
+            return;
+        m_deferredFormSubmission.set(new FormSubmission(action, url, formData, target,
+            contentType, boundary, event));
+        return;
+    }
+
+    FrameLoadRequest frameRequest;
+
+    if (!m_outgoingReferrer.isEmpty())
+        frameRequest.resourceRequest().setHTTPReferrer(m_outgoingReferrer);
+
+    frameRequest.setFrameName(target.isEmpty() ? m_frame->document()->baseTarget() : target);
+
+    // Handle mailto: forms
+    bool mailtoForm = u.protocol() == "mailto";
+    if (mailtoForm) {
+        // Append body=
+        DeprecatedString encodedBody;
+        if (equalIgnoringCase(contentType, "multipart/form-data"))
+            // FIXME: is this correct? I suspect not, but what site can we test this on?
+            encodedBody = KURL::encode_string(formData.flattenToString().deprecatedString());
+        else if (equalIgnoringCase(contentType, "text/plain")) {
+            // Convention seems to be to decode, and s/&/\n/
+            encodedBody = formData.flattenToString().deprecatedString();
+            encodedBody.replace('&', '\n');
+            encodedBody.replace('+', ' ');
+            encodedBody = KURL::decode_string(encodedBody); // Decode the rest of it
+            encodedBody = KURL::encode_string(encodedBody); // Recode for the URL
+        } else
+            encodedBody = KURL::encode_string(formData.flattenToString().deprecatedString());
+
+        DeprecatedString query = u.query();
+        if (!query.isEmpty())
+            query += '&';
+        query += "body=";
+        query += encodedBody;
+        u.setQuery(query);
+    }
+
+    if (strcmp(action, "GET") == 0) {
+        if (!mailtoForm)
+            u.setQuery(formData.flattenToString().deprecatedString());
+    } else {
+        frameRequest.resourceRequest().setHTTPBody(formData);
+        frameRequest.resourceRequest().setHTTPMethod("POST");
+
+        // construct some user headers if necessary
+        if (contentType.isNull() || contentType == "application/x-www-form-urlencoded")
+            frameRequest.resourceRequest().setHTTPContentType(contentType);
+        else // contentType must be "multipart/form-data"
+            frameRequest.resourceRequest().setHTTPContentType(contentType + "; boundary=" + boundary);
+    }
+
+    frameRequest.resourceRequest().setURL(u);
+
+    submitForm(frameRequest, event);
+}
+
+void FrameLoader::stopLoading(bool sendUnload)
+{
+    if (m_frame->document() && m_frame->document()->tokenizer())
+        m_frame->document()->tokenizer()->stopParsing();
+  
+    m_responseRefreshHeader = String();
+    m_responseModifiedHeader = String();
+
+    if (sendUnload) {
+        if (m_frame->document()) {
+            if (m_wasLoadEventEmitted && !m_wasUnloadEventEmitted) {
+                Node* currentFocusNode = m_frame->document()->focusNode();
+                if (currentFocusNode)
+                    currentFocusNode->aboutToUnload();
+                m_frame->document()->dispatchWindowEvent(unloadEvent, false, false);
+                if (m_frame->document())
+                    m_frame->document()->updateRendering();
+                m_wasUnloadEventEmitted = true;
+            }
+        }
+        if (m_frame->document() && !m_frame->document()->inPageCache())
+            m_frame->document()->removeAllEventListenersFromAllNodes();
+    }
+
+    m_isComplete = true; // to avoid calling completed() in finishedParsing() (David)
+    m_isLoadingMainResource = false;
+    m_wasLoadEventEmitted = true; // don't want that one either
+    m_cachePolicy = CachePolicyVerify; // Why here?
+
+    if (m_frame->document() && m_frame->document()->parsing()) {
+        finishedParsing();
+        m_frame->document()->setParsing(false);
+    }
+  
+    m_workingURL = KURL();
+
+    if (Document* doc = m_frame->document()) {
+        if (DocLoader* docLoader = doc->docLoader())
+            cache()->loader()->cancelRequests(docLoader);
+        XMLHttpRequest::cancelRequests(doc);
+    }
+
+    // tell all subframes to stop as well
+    for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
+        child->loader()->stopLoading(sendUnload);
+
+    cancelRedirection();
+}
+
+void FrameLoader::stop()
+{
+    // http://bugs.webkit.org/show_bug.cgi?id=10854
+    // The frame's last ref may be removed and it will be deleted by checkCompleted().
+    RefPtr<Frame> protector(m_frame);
+    
+    if (m_frame->document()) {
+        if (m_frame->document()->tokenizer())
+            m_frame->document()->tokenizer()->stopParsing();
+        m_frame->document()->finishParsing();
+    } else
+        // WebKit partially uses WebCore when loading non-HTML docs.  In these cases doc==nil, but
+        // WebCore is enough involved that we need to checkCompleted() in order for m_bComplete to
+        // become true. An example is when a subframe is a pure text doc, and that subframe is the
+        // last one to complete.
+        checkCompleted();
+    if (m_iconLoader)
+        m_iconLoader->stopLoading();
+}
+
+bool FrameLoader::closeURL()
+{
+    saveDocumentState();
+    stopLoading(true);
+    m_frame->clearUndoRedoOperations();
+    return true;
+}
+
+void FrameLoader::cancelRedirection(bool cancelWithLoadInProgress)
+{
+    m_cancellingWithLoadInProgress = cancelWithLoadInProgress;
+
+    stopRedirectionTimer();
+
+    m_scheduledRedirection.clear();
+}
+
+KURL FrameLoader::iconURL()
+{
+    // If this isn't a top level frame, return nothing
+    if (m_frame->tree() && m_frame->tree()->parent())
+        return "";
+        
+    // If we have an iconURL from a Link element, return that
+    if (m_frame->document() && !m_frame->document()->iconURL().isEmpty())
+        return m_frame->document()->iconURL().deprecatedString();
+        
+    // Don't return a favicon iconURL unless we're http or https
+    if (m_URL.protocol() != "http" && m_URL.protocol() != "https")
+        return "";
+        
+    KURL url;
+    url.setProtocol(m_URL.protocol());
+    url.setHost(m_URL.host());
+    url.setPath("/favicon.ico");
+    return url;
+}
+
+bool FrameLoader::didOpenURL(const KURL& url)
+{
+    if (m_scheduledRedirection && m_scheduledRedirection->type == ScheduledRedirection::locationChangeDuringLoad)
+        // A redirect was scheduled before the document was created.
+        // This can happen when one frame changes another frame's location.
+        return false;
+
+    cancelRedirection();
+    m_frame->editor()->setLastEditCommand(0);
+    closeURL();
+
+    m_isComplete = false;
+    m_isLoadingMainResource = true;
+    m_wasLoadEventEmitted = false;
+
+    m_frame->d->m_kjsStatusBarText = String();
+    m_frame->d->m_kjsDefaultStatusBarText = String();
+
+    m_frame->d->m_bJScriptEnabled = m_frame->settings()->isJavaScriptEnabled();
+    m_frame->d->m_bJavaEnabled = m_frame->settings()->isJavaEnabled();
+    m_frame->d->m_bPluginsEnabled = m_frame->settings()->isPluginsEnabled();
+
+    m_URL = url;
+    if (m_URL.protocol().startsWith("http") && !m_URL.host().isEmpty() && m_URL.path().isEmpty())
+        m_URL.setPath("/");
+    m_workingURL = m_URL;
+
+    started();
+
+    return true;
+}
+
+void FrameLoader::didExplicitOpen()
+{
+    m_isComplete = false;
+    m_wasLoadEventEmitted = false;
+
+    // Prevent window.open(url) -- eg window.open("about:blank") -- from blowing away results
+    // from a subsequent window.document.open / window.document.write call. 
+    // Cancelling redirection here works for all cases because document.open 
+    // implicitly precedes document.write.
+    cancelRedirection(); 
+    m_URL = m_frame->document()->URL();
+}
+
+void FrameLoader::replaceContentsWithScriptResult(const KURL& url)
+{
+    JSValue* result = executeScript(0, KURL::decode_string(url.url().mid(strlen("javascript:"))));
+    String scriptResult;
+    if (!getString(result, scriptResult))
+        return;
+    begin();
+    write(scriptResult);
+    end();
+}
+
+JSValue* FrameLoader::executeScript(Node* node, const String& script, bool forceUserGesture)
+{
+    return executeScript(forceUserGesture ? String() : String(m_URL.url()), 0, node, script);
+}
+
+JSValue* FrameLoader::executeScript(const String& URL, int baseLine, Node* node, const String& script)
+{
+    KJSProxy* proxy = m_frame->scriptProxy();
+    if (!proxy)
+        return 0;
+
+    bool wasRunningScript = m_isRunningScript;
+    m_isRunningScript = true;
+
+    JSValue* result = proxy->evaluate(URL, baseLine, script, node);
+
+    if (!wasRunningScript) {
+        m_isRunningScript = false;
+        submitFormAgain();
+        Document::updateDocumentsRendering();
+    }
+
+    return result;
+}
+
+void FrameLoader::cancelAndClear()
+{
+    cancelRedirection();
+
+    if (!m_isComplete)
+        closeURL();
+
+    clear(false);
+}
+
+void FrameLoader::clear(bool clearWindowProperties)
+{
+    // FIXME: Commenting out the below line causes <http://bugs.webkit.org/show_bug.cgi?id=11212>, but putting it
+    // back causes a measurable performance regression which we will need to fix to restore the correct behavior
+    // urlsBridgeKnowsAbout.clear();
+
+#if PLATFORM(MAC)
+    Mac(m_frame)->setMarkedTextRange(0, nil, nil);
+#endif
+
+    if (!m_needsClear)
+        return;
+    m_needsClear = false;
+    m_frame->d->m_mousePressNode = 0;
+
+#if !PLATFORM(MAC)
+    // FIXME: Remove this after making other platforms do loading more like Mac.
+    detachChildren();
+#endif
+
+    if (m_frame->document()) {
+        m_frame->document()->cancelParsing();
+        m_frame->document()->detach();
+    }
+
+    // Do this after detaching the document so that the unload event works.
+    if (clearWindowProperties && m_frame->scriptProxy())
+        m_frame->scriptProxy()->clear();
+
+    if (m_frame->view())
+        m_frame->view()->clear();
+
+    // Do not drop the document before the script proxy and view are cleared, as some destructors
+    // might still try to access the document.
+    m_frame->d->m_doc = 0;
+    m_decoder = 0;
+
+    m_containsPlugIns = false;
+    m_frame->cleanupPluginObjects();
+  
+    m_scheduledRedirection.clear();
+
+    m_receivedData = false;
+
+    m_frame->d->m_bMousePressed = false;
+
+    if (!m_encodingWasChosenByUser)
+        m_encoding = String();
+}
+
+void FrameLoader::receivedFirstData()
+{
+    begin(m_workingURL);
+
+    m_frame->document()->docLoader()->setCachePolicy(m_cachePolicy);
+    m_workingURL = KURL();
+
+    DeprecatedString refresh = m_responseRefreshHeader.deprecatedString();
+    if (!refresh.isEmpty()) {
+        double delay;
+        String URL;
+
+        int pos = refresh.find(';');
+        if (pos == -1)
+            pos = refresh.find(',');
+        if (pos == -1) {
+            delay = refresh.stripWhiteSpace().toDouble();
+            URL = m_URL.url();
+        } else {
+            int end_pos = refresh.length();
+            delay = refresh.left(pos).stripWhiteSpace().toDouble();
+            while (refresh[++pos] == ' ')
+                ;
+            if (refresh.find("url", pos, false) == pos) {
+                pos += 3;
+                while (refresh[pos] == ' ' || refresh[pos] == '=')
+                    pos++;
+                if (refresh[pos] == '"') {
+                    pos++;
+                    int index = end_pos-1;
+                    while (index > pos) {
+                        if (refresh[index] == '"')
+                            break;
+                        index--;
+                    }
+                    if (index > pos)
+                        end_pos = index;
+                }
+            }
+            URL = m_frame->document()->completeURL(refresh.mid(pos, end_pos));
+        }
+
+        // We want a new history item if the refresh timeout > 1 second
+        scheduleRedirection(delay, URL, delay <= 1);
+    }
+}
+
+const String& FrameLoader::responseMIMEType() const
+{
+    return m_responseMIMEType;
+}
+
+void FrameLoader::setResponseMIMEType(const String& type)
+{
+    m_responseMIMEType = type;
+}
+
+void FrameLoader::begin()
+{
+    begin(KURL());
+}
+
+void FrameLoader::begin(const KURL& url)
+{
+    if (m_workingURL.isEmpty())
+        createEmptyDocument(); // Creates an empty document if we don't have one already
+
+    clear();
+    partClearedInBegin();
+
+    m_needsClear = true;
+    m_isComplete = false;
+    m_wasLoadEventEmitted = false;
+    m_isLoadingMainResource = true;
+
+    KURL ref(url);
+    ref.setUser(DeprecatedString());
+    ref.setPass(DeprecatedString());
+    ref.setRef(DeprecatedString());
+    m_outgoingReferrer = ref.url();
+    m_URL = url;
+    KURL baseurl;
+
+    if (!m_URL.isEmpty())
+        baseurl = m_URL;
+
+    RefPtr<Document> document = DOMImplementation::instance()->
+        createDocument(m_responseMIMEType, m_frame->view(), m_frame->inViewSourceMode());
+    m_frame->d->m_doc = document;
+
+    if (!document->attached())
+        document->attach();
+    document->setURL(m_URL.url());
+    // We prefer m_baseURL over m_URL because m_URL changes when we are
+    // about to load a new page.
+    document->setBaseURL(baseurl.url());
+    if (m_decoder)
+        document->setDecoder(m_decoder.get());
+
+    updatePolicyBaseURL();
+
+    document->docLoader()->setAutoLoadImages(m_frame->settings()->autoLoadImages());
+
+    const KURL& userStyleSheet = m_frame->settings()->userStyleSheetLocation();
+    if (!userStyleSheet.isEmpty())
+        m_frame->setUserStyleSheetLocation(KURL(userStyleSheet));
+
+    restoreDocumentState();
+
+    document->implicitOpen();
+
+    if (m_frame->view())
+        m_frame->view()->resizeContents(0, 0);
+}
+
+void FrameLoader::write(const char* str, int len)
+{
+    if (len == 0)
+        return;
+    
+    if (len == -1)
+        len = strlen(str);
+
+    Tokenizer* tokenizer = m_frame->document()->tokenizer();
+    if (tokenizer && tokenizer->wantsRawData()) {
+        tokenizer->writeRawData(str, len);
+        return;
+    }
+    
+    if (!m_decoder) {
+        m_decoder = new TextResourceDecoder(m_responseMIMEType, m_frame->settings()->encoding());
+        if (!m_encoding.isNull())
+            m_decoder->setEncoding(m_encoding,
+                m_encodingWasChosenByUser ? TextResourceDecoder::UserChosenEncoding : TextResourceDecoder::EncodingFromHTTPHeader);
+        if (m_frame->document())
+            m_frame->document()->setDecoder(m_decoder.get());
+    }
+
+    String decoded = m_decoder->decode(str, len);
+    if (decoded.isEmpty())
+        return;
+
+    if (!m_receivedData) {
+        m_receivedData = true;
+        m_frame->document()->determineParseMode(decoded);
+        if (m_decoder->encoding().usesVisualOrdering())
+            m_frame->document()->setVisuallyOrdered();
+        m_frame->document()->recalcStyle(Node::Force);
+    }
+
+    if (tokenizer) {
+        ASSERT(!tokenizer->wantsRawData());
+        tokenizer->write(decoded, true);
+    }
+}
+
+void FrameLoader::write(const String& str)
+{
+    if (str.isNull())
+        return;
+
+    if (!m_receivedData) {
+        m_receivedData = true;
+        m_frame->document()->setParseMode(Document::Strict);
+    }
+
+    if (Tokenizer* tokenizer = m_frame->document()->tokenizer())
+        tokenizer->write(str, true);
+}
+
+void FrameLoader::end()
+{
+    m_isLoadingMainResource = false;
+    endIfNotLoading();
+}
+
+void FrameLoader::endIfNotLoading()
+{
+    // http://bugs.webkit.org/show_bug.cgi?id=10854
+    // The frame's last ref may be removed and it can be deleted by checkCompleted(), 
+    // so we'll add a protective refcount
+    RefPtr<Frame> protector(m_frame);
+
+    if (m_isLoadingMainResource)
+        return;
+
+    // make sure nothing's left in there
+    if (m_frame->document()) {
+        if (m_decoder) {
+            String decoded = m_decoder->flush();
+            if (!m_receivedData) {
+                m_receivedData = true;
+                m_frame->document()->determineParseMode(decoded);
+            }
+            write(decoded);
+        }
+        m_frame->document()->finishParsing();
+    } else
+        // WebKit partially uses WebCore when loading non-HTML docs.  In these cases doc==nil, but
+        // WebCore is enough involved that we need to checkCompleted() in order for m_bComplete to
+        // become true.  An example is when a subframe is a pure text doc, and that subframe is the
+        // last one to complete.
+        checkCompleted();
+
+    startIconLoader();
+}
+
+void FrameLoader::startIconLoader()
+{
+    // FIXME: We kick off the icon loader when the frame is done receiving its main resource.
+    // But we should instead do it when we're done parsing the head element.
+    if (!isLoadingMainFrame())
+        return;
+
+    IconDatabase* iconDB = IconDatabase::sharedIconDatabase();
+    if (!iconDB)
+        return;
+    if (!iconDB->enabled())
+        return;
+
+    KURL url(iconURL());
+    String urlString(url.url());
+    if (urlString.isEmpty())
+        return;
+
+    // If we already have an unexpired icon, we won't kick off a load but we *will* map the appropriate URLs to it
+    if (iconDB->hasEntryForIconURL(urlString) && loadType() != FrameLoadTypeReload && !iconDB->isIconExpiredForIconURL(urlString)) {
+        commitIconURLToIconDatabase(url);
+        return;
+    }
+
+    if (!m_iconLoader)
+        m_iconLoader.set(IconLoader::create(m_frame).release());
+    m_iconLoader->startLoading();
+}
+
+void FrameLoader::commitIconURLToIconDatabase(const KURL& icon)
+{
+    IconDatabase* iconDB = IconDatabase::sharedIconDatabase();
+    ASSERT(iconDB);
+    iconDB->setIconURLForPageURL(icon.url(), m_URL.url());
+    iconDB->setIconURLForPageURL(icon.url(), originalRequestURL().url());
+}
+
+void FrameLoader::gotoAnchor()
+{
+    // If our URL has no ref, then we have no place we need to jump to.
+    if (!m_URL.hasRef())
+        return;
+
+    DeprecatedString ref = m_URL.encodedHtmlRef();
+    if (!gotoAnchor(ref)) {
+        // Can't use htmlRef() here because it doesn't know which encoding to use to decode.
+        // Decoding here has to match encoding in completeURL, which means it has to use the
+        // page's encoding rather than UTF-8.
+        if (m_decoder)
+            gotoAnchor(KURL::decode_string(ref, m_decoder->encoding()));
+    }
+}
+
+void FrameLoader::finishedParsing()
+{
+    // This can be called from the Frame's destructor, in which case we shouldn't protect ourselves
+    // because doing so will cause us to re-enter the destructor when protector goes out of scope.
+    RefPtr<Frame> protector = m_frame->refCount() > 0 ? m_frame : 0;
+
+    checkCompleted();
+
+    if (!m_frame->view())
+        return; // We are being destroyed by something checkCompleted called.
+
+    // Check if the scrollbars are really needed for the content.
+    // If not, remove them, relayout, and repaint.
+    m_frame->view()->restoreScrollbar();
+
+    gotoAnchor();
+}
+
+void FrameLoader::loadDone()
+{
+    if (m_frame->document())
+        checkCompleted();
+}
+
+void FrameLoader::checkCompleted()
+{
+    // Any frame that hasn't completed yet?
+    for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
+        if (!child->loader()->m_isComplete)
+            return;
+
+    // Have we completed before?
+    if (m_isComplete)
+        return;
+
+    // Are we still parsing?
+    if (m_frame->document() && m_frame->document()->parsing())
+        return;
+
+    // Still waiting for images/scripts?
+    if (m_frame->document() && m_frame->document()->docLoader())
+        if (cache()->loader()->numRequests(m_frame->document()->docLoader()))
+            return;
+
+    // OK, completed.
+    m_isComplete = true;
+
+    checkEmitLoadEvent(); // if we didn't do it before
+
+    // Do not start a redirection timer for subframes here.
+    // That is deferred until the parent is completed.
+    if (m_scheduledRedirection && !m_frame->tree()->parent())
+        startRedirectionTimer();
+
+    completed();
+}
+
+void FrameLoader::checkEmitLoadEvent()
+{
+    if (m_wasLoadEventEmitted || !m_frame->document() || m_frame->document()->parsing())
+        return;
+
+    for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
+        if (!child->loader()->m_isComplete) // still got a frame running -> too early
+            return;
+
+    // All frames completed -> set their domain to the frameset's domain
+    // This must only be done when loading the frameset initially (#22039),
+    // not when following a link in a frame (#44162).
+    if (m_frame->document()) {
+        String domain = m_frame->document()->domain();
+        for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
+            if (child->document())
+                child->document()->setDomain(domain);
+    }
+
+    m_wasLoadEventEmitted = true;
+    m_wasUnloadEventEmitted = false;
+    if (m_frame->document())
+        m_frame->document()->implicitClose();
+}
+
+KURL FrameLoader::baseURL() const
+{
+    if (!m_frame->document())
+        return KURL();
+    return m_frame->document()->baseURL();
+}
+
+String FrameLoader::baseTarget() const
+{
+    if (!m_frame->document())
+        return String();
+    return m_frame->document()->baseTarget();
+}
+
+KURL FrameLoader::completeURL(const String& url)
+{
+    if (!m_frame->document())
+        return url.deprecatedString();
+    return m_frame->document()->completeURL(url).deprecatedString();
+}
+
+void FrameLoader::scheduleRedirection(double delay, const String& url, bool doLockHistory)
+{
+    if (delay < 0 || delay > INT_MAX / 1000)
+        return;
+    if (!m_scheduledRedirection || delay <= m_scheduledRedirection->delay)
+        scheduleRedirection(new ScheduledRedirection(delay, url, doLockHistory));
+}
+
+void FrameLoader::scheduleLocationChange(const String& url, const String& referrer, bool lockHistory, bool wasUserGesture)
+{    
+    // If the URL we're going to navigate to is the same as the current one, except for the
+    // fragment part, we don't need to schedule the location change.
+    KURL u(url.deprecatedString());
+    if (u.hasRef() && equalIgnoringRef(m_URL, u)) {
+        changeLocation(url, referrer, lockHistory, wasUserGesture);
+        return;
+    }
+
+    // Handle a location change of a page with no document as a special case.
+    // This may happen when a frame changes the location of another frame.
+    bool duringLoad = !m_frame->document();
+
+    // If a redirect was scheduled during a load, then stop the current load.
+    // Otherwise when the current load transitions from a provisional to a 
+    // committed state, pending redirects may be cancelled. 
+    if (duringLoad)
+        stopLoading(true);   
+
+    ScheduledRedirection::Type type = duringLoad
+        ? ScheduledRedirection::locationChange : ScheduledRedirection::locationChangeDuringLoad;
+    scheduleRedirection(new ScheduledRedirection(type, url, referrer, lockHistory, wasUserGesture));
+}
+
+void FrameLoader::scheduleRefresh(bool wasUserGesture)
+{
+    // Handle a location change of a page with no document as a special case.
+    // This may happen when a frame requests a refresh of another frame.
+    bool duringLoad = !m_frame->document();
+    
+    // If a refresh was scheduled during a load, then stop the current load.
+    // Otherwise when the current load transitions from a provisional to a 
+    // committed state, pending redirects may be cancelled. 
+    if (duringLoad)
+        stopLoading(true);   
+
+    ScheduledRedirection::Type type = duringLoad
+        ? ScheduledRedirection::locationChange : ScheduledRedirection::locationChangeDuringLoad;
+    scheduleRedirection(new ScheduledRedirection(type, m_URL.url(), m_outgoingReferrer, true, wasUserGesture));
+    m_cachePolicy = CachePolicyRefresh;
+}
+
+bool FrameLoader::isScheduledLocationChangePending() const
+{
+    if (!m_scheduledRedirection)
+        return false;
+    switch (m_scheduledRedirection->type) {
+        case ScheduledRedirection::redirection:
+            return false;
+        case ScheduledRedirection::historyNavigation:
+        case ScheduledRedirection::locationChange:
+        case ScheduledRedirection::locationChangeDuringLoad:
+            return true;
+    }
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
+void FrameLoader::scheduleHistoryNavigation(int steps)
+{
+    // navigation will always be allowed in the 0 steps case, which is OK because
+    // that's supposed to force a reload.
+    if (!canGoBackOrForward(steps)) {
+        cancelRedirection();
+        return;
+    }
+
+    // If the URL we're going to navigate to is the same as the current one, except for the
+    // fragment part, we don't need to schedule the navigation.
+    if (equalIgnoringRef(m_URL, historyURL(steps))) {
+        goBackOrForward(steps);
+        return;
+    }
+    
+    scheduleRedirection(new ScheduledRedirection(steps));
+}
+
+void FrameLoader::redirectionTimerFired(Timer<FrameLoader>*)
+{
+    OwnPtr<ScheduledRedirection> redirection(m_scheduledRedirection.release());
+
+    switch (redirection->type) {
+        case ScheduledRedirection::redirection:
+        case ScheduledRedirection::locationChange:
+        case ScheduledRedirection::locationChangeDuringLoad:
+            changeLocation(redirection->URL, redirection->referrer,
+                redirection->lockHistory, redirection->wasUserGesture);
+            return;
+        case ScheduledRedirection::historyNavigation:
+            if (redirection->historySteps == 0) {
+                // Special case for go(0) from a frame -> reload only the frame
+                urlSelected(m_URL, "", 0);
+                return;
+            }
+            // go(i!=0) from a frame navigates into the history of the frame only,
+            // in both IE and NS (but not in Mozilla). We can't easily do that.
+            goBackOrForward(redirection->historySteps);
+            return;
+    }
+    ASSERT_NOT_REACHED();
+}
+
+String FrameLoader::encoding() const
+{
+    if (m_encodingWasChosenByUser && !m_encoding.isEmpty())
+        return m_encoding;
+    if (m_decoder && m_decoder->encoding().isValid())
+        return m_decoder->encoding().name();
+    return m_frame->settings()->encoding();
+}
+
+bool FrameLoader::gotoAnchor(const String& name)
+{
+    if (!m_frame->document())
+        return false;
+
+    Node* anchorNode = m_frame->document()->getElementById(AtomicString(name));
+    if (!anchorNode)
+        anchorNode = m_frame->document()->anchors()->namedItem(name, !m_frame->document()->inCompatMode());
+
+    m_frame->document()->setCSSTarget(anchorNode); // Setting to null will clear the current target.
+  
+    // Implement the rule that "" and "top" both mean top of page as in other browsers.
+    if (!anchorNode && !(name.isEmpty() || equalIgnoringCase(name, "top")))
+        return false;
+
+    // We need to update the layout before scrolling, otherwise we could
+    // really mess things up if an anchor scroll comes at a bad moment.
+    if (m_frame->document()) {
+        m_frame->document()->updateRendering();
+        // Only do a layout if changes have occurred that make it necessary.      
+        if (m_frame->view() && m_frame->document()->renderer() && m_frame->document()->renderer()->needsLayout())
+            m_frame->view()->layout();
+    }
+  
+    // Scroll nested layers and frames to reveal the anchor.
+    // Align to the top and to the closest side (this matches other browsers).
+    RenderObject* renderer;
+    IntRect rect;
+    if (!anchorNode)
+        renderer = m_frame->document()->renderer(); // top of document
+    else {
+        renderer = anchorNode->renderer();
+        rect = anchorNode->getRect();
+    }
+    if (renderer)
+        renderer->enclosingLayer()->scrollRectToVisible(rect, RenderLayer::gAlignToEdgeIfNeeded, RenderLayer::gAlignTopAlways);
+
+    return true;
+}
+
+bool FrameLoader::requestObject(RenderPart* renderer, const String& url, const AtomicString& frameName,
+    const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues)
+{
+    if (url.isEmpty() && mimeType.isEmpty())
+        return true;
+
+    KURL completedURL;
+    if (!url.isEmpty())
+        completedURL = completeURL(url);
+
+    bool useFallback;
+    if (shouldUsePlugin(renderer->element(), completedURL, mimeType, renderer->hasFallbackContent(), useFallback))
+        return loadPlugin(renderer, completedURL, mimeType, paramNames, paramValues, useFallback);
+
+    ASSERT(renderer->node()->hasTagName(objectTag) || renderer->node()->hasTagName(embedTag));
+    AtomicString uniqueFrameName = m_frame->tree()->uniqueChildName(frameName);
+    static_cast<HTMLPlugInElement*>(renderer->node())->setFrameName(uniqueFrameName);
+    
+    // FIXME: OK to always make a new one? When does the old frame get removed?
+    return loadSubframe(static_cast<Element*>(renderer->node()), completedURL, uniqueFrameName, m_outgoingReferrer);
+}
+
+bool FrameLoader::shouldUsePlugin(Node* element, const KURL& url, const String& mimeType, bool hasFallback, bool& useFallback)
+{
+    ObjectContentType objectType = objectContentType(url, mimeType);
+    // If an object's content can't be handled and it has no fallback, let
+    // it be handled as a plugin to show the broken plugin icon.
+    useFallback = objectType == ObjectContentNone && hasFallback;
+    return objectType == ObjectContentNone || objectType == ObjectContentPlugin;
+}
+
+bool FrameLoader::loadPlugin(RenderPart* renderer, const KURL& url, const String& mimeType, 
+    const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback)
+{
+    Widget* widget = 0;
+
+    if (renderer && !useFallback) {
+        Element* pluginElement = 0;
+        if (renderer->node() && renderer->node()->isElementNode())
+            pluginElement = static_cast<Element*>(renderer->node());
+
+        widget = createPlugin(pluginElement, url, paramNames, paramValues, mimeType);
+        if (widget) {
+            renderer->setWidget(widget);
+            m_containsPlugIns = true;
+        }
+    }
+
+    checkEmitLoadEvent();
+    return widget != 0;
+}
+
+void FrameLoader::clearRecordedFormValues()
+{
+    m_formAboutToBeSubmitted = 0;
+    m_formValuesAboutToBeSubmitted.clear();
+}
+
+void FrameLoader::recordFormValue(const String& name, const String& value, PassRefPtr<HTMLFormElement> element)
+{
+    m_formAboutToBeSubmitted = element;
+    m_formValuesAboutToBeSubmitted.set(name, value);
+}
+
+void FrameLoader::parentCompleted()
+{
+    if (m_scheduledRedirection && !m_redirectionTimer.isActive())
+        startRedirectionTimer();
+}
+
+String FrameLoader::outgoingReferrer() const
+{
+    return m_outgoingReferrer;
+}
+
+String FrameLoader::lastModified() const
+{
+    return m_responseModifiedHeader;
+}
+
+Frame* FrameLoader::opener()
+{
+    return m_opener;
+}
+
+void FrameLoader::setOpener(Frame* opener)
+{
+    if (m_opener)
+        m_opener->loader()->m_openedFrames.remove(m_frame);
+    if (opener)
+        opener->loader()->m_openedFrames.add(m_frame);
+    m_opener = opener;
+}
+
+bool FrameLoader::openedByJavaScript()
+{
+    return m_openedByJavaScript;
+}
+
+void FrameLoader::setOpenedByJavaScript()
+{
+    m_openedByJavaScript = true;
+}
+
+void FrameLoader::handleFallbackContent()
+{
+    Element* owner = m_frame->ownerElement();
+    if (!owner || !owner->hasTagName(objectTag))
+        return;
+    static_cast<HTMLObjectElement*>(owner)->renderFallbackContent();
+}
+
+void FrameLoader::provisionalLoadStarted()
+{
+    m_firstLayoutDone = false;
+    cancelRedirection(true);
+    m_client->provisionalLoadStarted();
+}
+
+bool FrameLoader::userGestureHint()
+{
+    Frame* rootFrame = m_frame;
+    while (rootFrame->tree()->parent())
+        rootFrame = rootFrame->tree()->parent();
+
+    if (rootFrame->scriptProxy())
+        return rootFrame->scriptProxy()->interpreter()->wasRunByUserGesture();
+
+    return true; // If JavaScript is disabled, a user gesture must have initiated the navigation
+}
+
+void FrameLoader::didNotOpenURL(const KURL& URL)
+{
+    if (m_submittedFormURL == URL)
+        m_submittedFormURL = KURL();
+}
+
+void FrameLoader::resetMultipleFormSubmissionProtection()
+{
+    m_submittedFormURL = KURL();
+}
+
+void FrameLoader::setEncoding(const String& name, bool userChosen)
+{
+    if (!m_workingURL.isEmpty())
+        receivedFirstData();
+    m_encoding = name;
+    m_encodingWasChosenByUser = userChosen;
+}
+
+void FrameLoader::addData(const char* bytes, int length)
+{
+    ASSERT(m_workingURL.isEmpty());
+    ASSERT(m_frame->document());
+    ASSERT(m_frame->document()->parsing());
+    write(bytes, length);
+}
+
+bool FrameLoader::canCachePage()
+{
+    return m_frame->document()
+        && !m_frame->tree()->childCount()
+        && !m_frame->tree()->parent()
+        && !m_containsPlugIns
+        && !m_URL.protocol().startsWith("https")
+        && !m_frame->document()->applets()->length()
+        && !m_frame->document()->hasWindowEventListener(unloadEvent)
+        && !m_frame->document()->hasPasswordField();
+}
+
+void FrameLoader::updatePolicyBaseURL()
+{
+    if (m_frame->tree()->parent() && m_frame->tree()->parent()->document())
+        setPolicyBaseURL(m_frame->tree()->parent()->document()->policyBaseURL());
+    else
+        setPolicyBaseURL(m_URL.url());
+}
+
+void FrameLoader::setPolicyBaseURL(const String& s)
+{
+    if (m_frame->document())
+        m_frame->document()->setPolicyBaseURL(s);
+    for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
+        child->loader()->setPolicyBaseURL(s);
+}
+
+// This does the same kind of work that FrameLoader::openURL does, except it relies on the fact
+// that a higher level already checked that the URLs match and the scrolling is the right thing to do.
+void FrameLoader::scrollToAnchor(const KURL& URL)
+{
+    m_URL = URL;
+    started();
+
+    gotoAnchor();
+
+    // It's important to model this as a load that starts and immediately finishes.
+    // Otherwise, the parent frame may think we never finished loading.
+    m_isComplete = false;
+    checkCompleted();
+}
+
+bool FrameLoader::isComplete() const
+{
+    return m_isComplete;
+}
+
+bool FrameLoader::isLoadingMainResource() const
+{
+    return m_isLoadingMainResource;
+}
+
+KURL FrameLoader::url() const
+{
+    return m_URL;
+}
+
+void FrameLoader::scheduleRedirection(ScheduledRedirection* redirection)
+{
+    stopRedirectionTimer();
+    m_scheduledRedirection.set(redirection);
+    if (m_isComplete)
+        startRedirectionTimer();
+}
+
+void FrameLoader::startRedirectionTimer()
+{
+    ASSERT(m_scheduledRedirection);
+
+    m_redirectionTimer.stop();
+    m_redirectionTimer.startOneShot(m_scheduledRedirection->delay);
+
+    switch (m_scheduledRedirection->type) {
+        case ScheduledRedirection::redirection:
+        case ScheduledRedirection::locationChange:
+        case ScheduledRedirection::locationChangeDuringLoad:
+            clientRedirected(m_scheduledRedirection->URL.deprecatedString(),
+                m_scheduledRedirection->delay,
+                currentTime() + m_redirectionTimer.nextFireInterval(),
+                m_scheduledRedirection->lockHistory,
+                m_isExecutingJavaScriptFormAction);
+            return;
+        case ScheduledRedirection::historyNavigation:
+            // Don't report history navigations.
+            return;
+    }
+    ASSERT_NOT_REACHED();
+}
+
+void FrameLoader::stopRedirectionTimer()
+{
+    if (!m_redirectionTimer.isActive())
+        return;
+
+    m_redirectionTimer.stop();
+
+    if (m_scheduledRedirection) {
+        switch (m_scheduledRedirection->type) {
+            case ScheduledRedirection::redirection:
+            case ScheduledRedirection::locationChange:
+            case ScheduledRedirection::locationChangeDuringLoad:
+                clientRedirectCancelledOrFinished(m_cancellingWithLoadInProgress);
+                return;
+            case ScheduledRedirection::historyNavigation:
+                // Don't report history navigations.
+                return;
+        }
+        ASSERT_NOT_REACHED();
+    }
+}
+
+void FrameLoader::updateBaseURLForEmptyDocument()
+{
+    Element* owner = m_frame->ownerElement();
+    // FIXME: Should embed be included?
+    if (owner && (owner->hasTagName(iframeTag) || owner->hasTagName(objectTag) || owner->hasTagName(embedTag)))
+        m_frame->document()->setBaseURL(m_frame->tree()->parent()->document()->baseURL());
+}
+
+void FrameLoader::completed()
+{
+    RefPtr<Frame> protect(m_frame);
+    for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
+        child->loader()->parentCompleted();
+    if (Frame* parent = m_frame->tree()->parent())
+        parent->loader()->checkCompleted();
+    submitFormAgain();
+}
+
+void FrameLoader::started()
+{
+    for (Frame* frame = m_frame; frame; frame = frame->tree()->parent())
+        frame->loader()->m_isComplete = false;
+}
+
+bool FrameLoader::containsPlugins() const 
+{ 
+    return m_containsPlugIns;
+}
+
+void FrameLoader::prepareForLoadStart()
+{
+    m_client->progressStarted();
+    m_client->dispatchDidStartProvisionalLoad();
+}
+
+void FrameLoader::setupForReplace()
+{
+    setState(FrameStateProvisional);
+    m_provisionalDocumentLoader = m_documentLoader;
+    m_documentLoader = 0;
+    detachChildren();
+}
+
+void FrameLoader::setupForReplaceByMIMEType(const String& newMIMEType)
+{
+    activeDocumentLoader()->setupForReplaceByMIMEType(newMIMEType);
+}
+
+void FrameLoader::finalSetupForReplace(DocumentLoader* loader)
+{
+    m_client->clearUnarchivingState(loader);
+}
+
+#if PLATFORM(MAC)
+void FrameLoader::load(const KURL& URL, Event* event)
+{
+    load(ResourceRequest(URL), true, event, 0, HashMap<String, String>());
+}
+#endif
+
+bool FrameLoader::canTarget(Frame* target) const
+{
+    // This method prevents this exploit:
+    // <rdar://problem/3715785> multiple frame injection vulnerability reported by Secunia, affects almost all browsers
+
+    if (!target)
+        return true;
+
+    // Allow with navigation within the same page/frameset.
+    if (m_frame->page() == target->page())
+        return true;
+
+    String domain;
+    if (Document* document = m_frame->document())
+        domain = document->domain();
+    // Allow if the request is made from a local file.
+    if (domain.isEmpty())
+        return true;
+    
+    Frame* parent = target->tree()->parent();
+    // Allow if target is an entire window.
+    if (!parent)
+        return true;
+    
+    String parentDomain;
+    if (Document* parentDocument = parent->document())
+        domain = parentDocument->domain();
+    // Allow if the domain of the parent of the targeted frame equals this domain.
+    return equalIgnoringCase(parentDomain, domain);
+}
+
+void FrameLoader::stopLoadingPlugIns()
+{
+    cancelAll(m_plugInStreamLoaders);
+}
+
+void FrameLoader::stopLoadingSubresources()
+{
+    cancelAll(m_subresourceLoaders);
+}
+
+void FrameLoader::stopLoadingSubframes()
+{
+    for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
+        child->loader()->stopAllLoaders();
+}
+
+void FrameLoader::stopAllLoaders()
+{
+    // If this method is called from within this method, infinite recursion can occur (3442218). Avoid this.
+    if (m_inStopAllLoaders)
+        return;
+
+    m_inStopAllLoaders = true;
+
+    stopPolicyCheck();
+
+    stopLoadingSubframes();
+    if (m_provisionalDocumentLoader)
+        m_provisionalDocumentLoader->stopLoading();
+    if (m_documentLoader)
+        m_documentLoader->stopLoading();
+    setProvisionalDocumentLoader(0);
+    m_client->clearArchivedResources();
+
+    m_inStopAllLoaders = false;    
+}
+
+void FrameLoader::cancelMainResourceLoad()
+{
+    if (m_mainResourceLoader)
+        m_mainResourceLoader->cancel();
+}
+
+void FrameLoader::cancelPendingArchiveLoad(ResourceLoader* loader)
+{
+    m_client->cancelPendingArchiveLoad(loader);
+}
+
+DocumentLoader* FrameLoader::activeDocumentLoader() const
+{
+    if (m_state == FrameStateProvisional)
+        return m_provisionalDocumentLoader.get();
+    return m_documentLoader.get();
+}
+
+void FrameLoader::addPlugInStreamLoader(ResourceLoader* loader)
+{
+    m_plugInStreamLoaders.add(loader);
+    activeDocumentLoader()->setLoading(true);
+}
+
+void FrameLoader::removePlugInStreamLoader(ResourceLoader* loader)
+{
+    m_plugInStreamLoaders.remove(loader);
+    activeDocumentLoader()->updateLoading();
+}
+
+bool FrameLoader::hasMainResourceLoader() const
+{
+    return m_mainResourceLoader != 0;
+}
+
+bool FrameLoader::isLoadingSubresources() const
+{
+    return !m_subresourceLoaders.isEmpty();
+}
+
+bool FrameLoader::isLoadingPlugIns() const
+{
+    return !m_plugInStreamLoaders.isEmpty();
+}
+
+bool FrameLoader::isLoading() const
+{
+    return isLoadingMainResource() || isLoadingSubresources() || isLoadingPlugIns();
+}
+
+void FrameLoader::addSubresourceLoader(ResourceLoader* loader)
+{
+    ASSERT(!m_provisionalDocumentLoader);
+    m_subresourceLoaders.add(loader);
+    activeDocumentLoader()->setLoading(true);
+}
+
+void FrameLoader::removeSubresourceLoader(ResourceLoader* loader)
+{
+    m_subresourceLoaders.remove(loader);
+    activeDocumentLoader()->updateLoading();
+    checkLoadComplete();
+}
+
+void FrameLoader::releaseMainResourceLoader()
+{
+    m_mainResourceLoader = 0;
+}
+
+void FrameLoader::setDocumentLoader(DocumentLoader* loader)
+{
+    if (!loader && !m_documentLoader)
+        return;
+    
+    ASSERT(loader != m_documentLoader);
+    ASSERT(!loader || loader->frameLoader() == this);
+
+    m_client->prepareForDataSourceReplacement();
+    if (m_documentLoader)
+        m_documentLoader->detachFromFrame();
+
+    m_documentLoader = loader;
+}
+
+DocumentLoader* FrameLoader::documentLoader() const
+{
+    return m_documentLoader.get();
+}
+
+void FrameLoader::setPolicyDocumentLoader(DocumentLoader* loader)
+{
+    if (m_policyDocumentLoader == loader)
+        return;
+
+    ASSERT(m_frame);
+    if (loader)
+        loader->setFrame(m_frame);
+    if (m_policyDocumentLoader
+            && m_policyDocumentLoader != m_provisionalDocumentLoader
+            && m_policyDocumentLoader != m_documentLoader)
+        m_policyDocumentLoader->detachFromFrame();
+
+    m_policyDocumentLoader = loader;
+}
+   
+DocumentLoader* FrameLoader::provisionalDocumentLoader()
+{
+    return m_provisionalDocumentLoader.get();
+}
+
+void FrameLoader::setProvisionalDocumentLoader(DocumentLoader* loader)
+{
+    ASSERT(!loader || !m_provisionalDocumentLoader);
+    ASSERT(!loader || loader->frameLoader() == this);
+
+    if (m_provisionalDocumentLoader && m_provisionalDocumentLoader != m_documentLoader)
+        m_provisionalDocumentLoader->detachFromFrame();
+
+    m_provisionalDocumentLoader = loader;
+}
+
+FrameState FrameLoader::state() const
+{
+    return m_state;
+}
+
+double FrameLoader::timeOfLastCompletedLoad()
+{
+    return storedTimeOfLastCompletedLoad;
+}
+
+void FrameLoader::setState(FrameState newState)
+{    
+    m_state = newState;
+    
+    if (newState == FrameStateProvisional)
+        provisionalLoadStarted();
+    else if (newState == FrameStateComplete) {
+        frameLoadCompleted();
+        storedTimeOfLastCompletedLoad = currentTime();
+        if (m_documentLoader)
+            m_documentLoader->stopRecordingResponses();
+    }
+}
+
+void FrameLoader::clearProvisionalLoad()
+{
+    setProvisionalDocumentLoader(0);
+    m_client->progressCompleted();
+    setState(FrameStateComplete);
+}
+
+void FrameLoader::markLoadComplete()
+{
+    setState(FrameStateComplete);
+}
+
+void FrameLoader::commitProvisionalLoad()
+{
+    stopLoadingSubresources();
+    stopLoadingPlugIns();
+
+    setDocumentLoader(m_provisionalDocumentLoader.get());
+    setProvisionalDocumentLoader(0);
+    setState(FrameStateCommittedPage);
+}
+
+bool FrameLoader::privateBrowsingEnabled() const
+{
+    return m_client->privateBrowsingEnabled();
+}
+
+void FrameLoader::clientRedirectCancelledOrFinished(bool cancelWithLoadInProgress)
+{
+    // Note that -webView:didCancelClientRedirectForFrame: is called on the frame load delegate even if
+    // the redirect succeeded.  We should either rename this API, or add a new method, like
+    // -webView:didFinishClientRedirectForFrame:
+    m_client->dispatchDidCancelClientRedirect();
+
+    if (!cancelWithLoadInProgress)
+        m_quickRedirectComing = false;
+
+    m_sentRedirectNotification = false;
+}
+
+void FrameLoader::clientRedirected(const KURL& URL, double seconds, double fireDate, bool lockHistory, bool isJavaScriptFormAction)
+{
+    m_client->dispatchWillPerformClientRedirect(URL, seconds, fireDate);
+    
+    // Remember that we sent a redirect notification to the frame load delegate so that when we commit
+    // the next provisional load, we can send a corresponding -webView:didCancelClientRedirectForFrame:
+    m_sentRedirectNotification = true;
+    
+    // If a "quick" redirect comes in an, we set a special mode so we treat the next
+    // load as part of the same navigation. If we don't have a document loader, we have
+    // no "original" load on which to base a redirect, so we treat the redirect as a normal load.
+    m_quickRedirectComing = lockHistory && m_documentLoader && !isJavaScriptFormAction;
+}
+
+bool FrameLoader::shouldReload(const KURL& currentURL, const KURL& destinationURL)
+{
+    // This function implements the rule: "Don't reload if navigating by fragment within
+    // the same URL, but do reload if going to a new URL or to the same URL with no
+    // fragment identifier at all."
+    if (!currentURL.hasRef() && !destinationURL.hasRef())
+        return true;
+    return !equalIgnoringRef(currentURL, destinationURL);
+}
+
+void FrameLoader::closeOldDataSources()
+{
+    // FIXME: Is it important for this traversal to be postorder instead of preorder?
+    // If so, add helpers for postorder traversal, and use them. If not, then lets not
+    // use a recursive algorithm here.
+    for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
+        child->loader()->closeOldDataSources();
+    
+    if (m_documentLoader)
+        m_client->dispatchWillClose();
+
+    m_client->setMainFrameDocumentReady(false); // stop giving out the actual DOMDocument to observers
+}
+
+void FrameLoader::open(PageState& state)
+{
+    ASSERT(m_frame->page()->mainFrame() == m_frame);
+
+    cancelRedirection();
+
+    // We still have to close the previous part page.
+    closeURL();
+
+    m_isComplete = false;
+    
+    // Don't re-emit the load event.
+    m_wasLoadEventEmitted = true;
+    
+    // Delete old status bar messages (if it _was_ activated on last URL).
+    if (m_frame->javaScriptEnabled()) {
+        m_frame->d->m_kjsStatusBarText = String();
+        m_frame->d->m_kjsDefaultStatusBarText = String();
+    }
+
+    KURL URL = state.URL();
+
+    if (URL.protocol().startsWith("http") && !URL.host().isEmpty() && URL.path().isEmpty())
+        URL.setPath("/");
+    
+    m_URL = URL;
+    m_workingURL = URL;
+
+    started();
+
+    clear();
+
+    Document* document = state.document();
+    document->setInPageCache(false);
+
+    m_needsClear = true;
+    m_isComplete = false;
+    m_wasLoadEventEmitted = false;
+    m_outgoingReferrer = URL.url();
+    
+    m_frame->setView(document->view());
+    
+    m_frame->d->m_doc = document;
+    m_frame->d->m_mousePressNode = state.mousePressNode();
+    m_decoder = document->decoder();
+
+    updatePolicyBaseURL();
+
+    state.restoreJavaScriptState(m_frame->page());
+
+    checkCompleted();
+}
+
+bool FrameLoader::isStopping() const
+{
+    return activeDocumentLoader()->isStopping();
+}
+
+void FrameLoader::finishedLoading()
+{
+    // Retain because the stop may release the last reference to it.
+    RefPtr<Frame> protect(m_frame);
+
+#if PLATFORM(MAC)
+    RefPtr<DocumentLoader> dl = activeDocumentLoader();
+    dl->finishedLoading();
+    if (dl->mainDocumentError() || !dl->frameLoader())
+        return;
+    dl->setPrimaryLoadComplete(true);
+    m_client->dispatchDidLoadMainResource(dl.get());
+#endif
+    checkLoadComplete();
+}
+
+KURL FrameLoader::URL() const
+{
+    return activeDocumentLoader()->URL();
+}
+
+bool FrameLoader::isArchiveLoadPending(ResourceLoader* loader) const
+{
+    return m_client->isArchiveLoadPending(loader);
+}
+
+bool FrameLoader::isHostedByObjectElement() const
+{
+    Element* owner = m_frame->ownerElement();
+    return owner && owner->hasTagName(objectTag);
+}
+
+bool FrameLoader::isLoadingMainFrame() const
+{
+    Page* page = m_frame->page();
+    return page && m_frame == page->mainFrame();
+}
+
+bool FrameLoader::canShowMIMEType(const String& MIMEType) const
+{
+    return m_client->canShowMIMEType(MIMEType);
+}
+
+bool FrameLoader::representationExistsForURLScheme(const String& URLScheme)
+{
+    return m_client->representationExistsForURLScheme(URLScheme);
+}
+
+String FrameLoader::generatedMIMETypeForURLScheme(const String& URLScheme)
+{
+    return m_client->generatedMIMETypeForURLScheme(URLScheme);
+}
+
+void FrameLoader::cancelContentPolicyCheck()
+{
+    m_client->cancelPolicyCheck();
+    m_policyCheck.clear();
+}
+
+void FrameLoader::didReceiveServerRedirectForProvisionalLoadForFrame()
+{
+    m_client->dispatchDidReceiveServerRedirectForProvisionalLoad();
+}
+
+void FrameLoader::finishedLoadingDocument(DocumentLoader* loader)
+{
+    m_client->finishedLoading(loader);
+}
+
+bool FrameLoader::isReplacing() const
+{
+    return m_loadType == FrameLoadTypeReplace;
+}
+
+void FrameLoader::setReplacing()
+{
+    m_loadType = FrameLoadTypeReplace;
+}
+
+void FrameLoader::revertToProvisional(DocumentLoader* loader)
+{
+    m_client->revertToProvisionalState(loader);
+}
+
+bool FrameLoader::subframeIsLoading() const
+{
+    // It's most likely that the last added frame is the last to load so we walk backwards.
+    for (Frame* child = m_frame->tree()->lastChild(); child; child = child->tree()->previousSibling()) {
+        FrameLoader* childLoader = child->loader();
+        DocumentLoader* documentLoader = childLoader->documentLoader();
+        if (documentLoader && documentLoader->isLoadingInAPISense())
+            return true;
+        documentLoader = childLoader->provisionalDocumentLoader();
+        if (documentLoader && documentLoader->isLoadingInAPISense())
+            return true;
+    }
+    return false;
+}
+
+void FrameLoader::willChangeTitle(DocumentLoader* loader)
+{
+    m_client->willChangeTitle(loader);
+}
+
+FrameLoadType FrameLoader::loadType() const
+{
+    return m_loadType;
+}
+
+void FrameLoader::stopPolicyCheck()
+{
+    m_client->cancelPolicyCheck();
+    PolicyCheck check = m_policyCheck;
+    m_policyCheck.clear();
+    check.clearRequest();
+    check.call();
+}
+
+void FrameLoader::continueAfterContentPolicy(PolicyAction policy)
+{
+    PolicyCheck check = m_policyCheck;
+    m_policyCheck.clear();
+    check.call(policy);
+}
+
+#if PLATFORM(MAC)
+void FrameLoader::continueAfterWillSubmitForm(PolicyAction)
+{
+    startLoading();
+}
+#endif
+
+#if PLATFORM(MAC)
+void FrameLoader::didFirstLayout()
+{
+    if (isBackForwardLoadType(m_loadType) && m_client->hasBackForwardList())
+        m_client->restoreScrollPositionAndViewState();
+
+    m_firstLayoutDone = true;
+    m_client->dispatchDidFirstLayout();
+}
+#endif
+
+void FrameLoader::frameLoadCompleted()
+{
+    m_client->frameLoadCompleted();
+
+    // After a canceled provisional load, firstLayoutDone is false.
+    // Reset it to true if we're displaying a page.
+    if (m_documentLoader)
+        m_firstLayoutDone = true;
+}
+
+bool FrameLoader::firstLayoutDone() const
+{
+    return m_firstLayoutDone;
+}
+
+bool FrameLoader::isQuickRedirectComing() const
+{
+    return m_quickRedirectComing;
+}
+
+void FrameLoader::closeDocument()
+{
+    m_client->willCloseDocument();
+    closeURL();
+}
+
+void FrameLoader::detachChildren()
+{
+    // FIXME: Is it really necessary to do this in reverse order?
+    Frame* previous;
+    for (Frame* child = m_frame->tree()->lastChild(); child; child = previous) {
+        previous = child->tree()->previousSibling();
+        child->loader()->detachFromParent();
+    }
+}
+
+// Called every time a resource is completely loaded, or an error is received.
+void FrameLoader::checkLoadComplete()
+{
+    ASSERT(m_client->hasWebView());
+    for (RefPtr<Frame> frame = m_frame; frame; frame = frame->tree()->parent())
+        frame->loader()->checkLoadCompleteForThisFrame();
+}
+
+int FrameLoader::numPendingOrLoadingRequests(bool recurse) const
+{
+    if (!recurse)
+        return numRequests(m_frame->document());
+
+    int count = 0;
+    for (Frame* frame = m_frame; frame; frame = frame->tree()->traverseNext(m_frame))
+        count += numRequests(frame->document());
+    return count;
+}
+
+void FrameLoader::setClient(FrameLoaderClient* client)
+{
+    ASSERT(client);
+    ASSERT(!m_client);
+    m_client = client;
+}
+
+FrameLoaderClient* FrameLoader::client() const
+{
+    return m_client;
+}
+
+#if PLATFORM(MAC)
+void FrameLoader::submitForm(const FrameLoadRequest& request, Event* event)
+{
+    // FIXME: We'd like to remove this altogether and fix the multiple form submission issue another way.
+    // We do not want to submit more than one form from the same page,
+    // nor do we want to submit a single form more than once.
+    // This flag prevents these from happening; not sure how other browsers prevent this.
+    // The flag is reset in each time we start handle a new mouse or key down event, and
+    // also in setView since this part may get reused for a page from the back/forward cache.
+    // The form multi-submit logic here is only needed when we are submitting a form that affects this frame.
+    // FIXME: Frame targeting is only one of the ways the submission could end up doing something other
+    // than replacing this frame's content, so this check is flawed. On the other hand, the check is hardly
+    // needed any more now that we reset m_submittedFormURL on each mouse or key down event.
+    Frame* target = m_frame->tree()->find(request.frameName());
+    if (m_frame->tree()->isDescendantOf(target)) {
+        if (m_submittedFormURL == request.resourceRequest().url())
+            return;
+        m_submittedFormURL = request.resourceRequest().url();
+    }
+
+    // FIXME: Why do we always pass true for userGesture?
+    load(request, true, event, m_formAboutToBeSubmitted.get(), m_formValuesAboutToBeSubmitted);
+
+    clearRecordedFormValues();
+}
+#endif
+
+#if PLATFORM(MAC)
+void FrameLoader::urlSelected(const FrameLoadRequest& request, Event* event)
+{
+    FrameLoadRequest copy = request;
+    if (copy.resourceRequest().httpReferrer().isEmpty())
+        copy.resourceRequest().setHTTPReferrer(outgoingReferrer());
+
+    // FIXME: Why do we always pass true for userGesture?
+    load(copy, true, event, 0, HashMap<String, String>());
+}
+#endif
+
+String FrameLoader::userAgent() const
+{
+    return m_client->userAgent();
+}
+
+void FrameLoader::createEmptyDocument()
+{
+    // Although it's not completely clear from the name of this function,
+    // it does nothing if we already have a document, and just creates an
+    // empty one if we have no document at all.
+#if PLATFORM(MAC)
+    if (!m_frame->document()) {
+        loadEmptyDocumentSynchronously();
+        updateBaseURLForEmptyDocument();
+    }
+#endif
+}
+
+void FrameLoader::tokenizerProcessedData()
+{
+    if (m_frame->document())
+        checkCompleted();
+    checkLoadComplete();
+}
+
+void FrameLoader::didTellBridgeAboutLoad(const String& URL)
+{
+    m_urlsBridgeKnowsAbout.add(URL);
+}
+
+bool FrameLoader::haveToldBridgeAboutLoad(const String& URL)
+{
+    return m_urlsBridgeKnowsAbout.contains(URL);
+}
+
+void FrameLoader::handledOnloadEvents()
+{
+    m_client->dispatchDidHandleOnloadEvents();
+}
+
+void FrameLoader::frameDetached()
+{
+    stopAllLoaders();
+    detachFromParent();
+}
+
+#if PLATFORM(MAC)
+void FrameLoader::setTitle(const String& title)
+{
+    documentLoader()->setTitle(title);
+}
+#endif
+
+FrameLoaderClient::~FrameLoaderClient()
+{
+}
+
 }
index 297d1f368fe4fb7608fb4061d764b330921235be..9fac2a88c669ba3296b2bb0d0186e40eedbca60e 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "CachePolicy.h"
 #include "FrameLoaderTypes.h"
-#include "PlatformString.h"
+#include "KURL.h"
+#include "StringHash.h"
+#include "Timer.h"
 #include <wtf/Forward.h>
 #include <wtf/HashSet.h>
 #include <wtf/HashMap.h>
 #include <wtf/Noncopyable.h>
+#include <wtf/OwnPtr.h>
 #include <wtf/RefPtr.h>
 
 #if PLATFORM(MAC)
@@ -65,6 +69,10 @@ class NSURLResponse;
 
 #endif // PLATFORM(MAC)
 
+namespace KJS {
+    class JSValue;
+}
+
 namespace WebCore {
 
     class DocumentLoader;
@@ -74,19 +82,32 @@ namespace WebCore {
     class FormState;
     class Frame;
     class FrameLoaderClient;
-    class KURL;
+    class HTMLFormElement;
+    class IconLoader;
+    class IntSize;
     class MainResourceLoader;
     class NavigationAction;
+    class Node;
     class PageState;
+    class RenderPart;
     class ResourceLoader;
     class ResourceRequest;
     class ResourceResponse;
-    class String;
     class SubresourceLoader;
+    class TextResourceDecoder;
+    class Widget;
 
+    struct FormSubmission;
     struct FrameLoadRequest;
+    struct ScheduledRedirection;
     struct WindowFeatures;
 
+    template <typename T> class Timer;
+
+    enum ObjectContentType {
+        ObjectContentNone, ObjectContentImage, ObjectContentFrame, ObjectContentPlugin
+    };
+
     typedef HashSet<RefPtr<ResourceLoader> > ResourceLoaderSet;
 
     bool isBackForwardLoadType(FrameLoadType);
@@ -99,35 +120,41 @@ namespace WebCore {
 #endif
     typedef void (*ContentPolicyDecisionFunction)(void* argument, PolicyAction);
 
-#if PLATFORM(MAC)
     class PolicyCheck {
     public:
         PolicyCheck();
 
         void clear();
+#if PLATFORM(MAC)
         void set(NSURLRequest *, PassRefPtr<FormState>,
             NavigationPolicyDecisionFunction, void* argument);
         void set(NSURLRequest *, PassRefPtr<FormState>, const String& frameName,
             NewWindowPolicyDecisionFunction, void* argument);
+#endif
         void set(ContentPolicyDecisionFunction, void* argument);
 
+#if PLATFORM(MAC)
         NSURLRequest *request() const { return m_request.get(); }
+#endif
         void clearRequest();
 
         void call();
         void call(PolicyAction);
 
     private:
+#if PLATFORM(MAC)
         RetainPtr<NSURLRequest> m_request;
+#endif
         RefPtr<FormState> m_formState;
         String m_frameName;
 
+#if PLATFORM(MAC)
         NavigationPolicyDecisionFunction m_navigationFunction;
         NewWindowPolicyDecisionFunction m_newWindowFunction;
+#endif
         ContentPolicyDecisionFunction m_contentFunction;
         void* m_argument;
     };
-#endif
 
     class FrameLoader : Noncopyable {
     public:
@@ -169,14 +196,15 @@ namespace WebCore {
         void stopLoadingPlugIns();
         void stopLoadingSubresources();
 #if PLATFORM(MAC)
-        void stopLoading(NSError *);
+        void cancelMainResourceLoad(NSError *);
 #endif
-        void stopLoading();
+        void stopAllLoaders();
         void cancelMainResourceLoad();
         void cancelPendingArchiveLoad(ResourceLoader*);
 
         void addPlugInStreamLoader(ResourceLoader*);
         void removePlugInStreamLoader(ResourceLoader*);
+        bool hasMainResourceLoader() const;
         bool isLoadingMainResource() const;
         bool isLoadingSubresources() const;
         bool isLoading() const;
@@ -190,6 +218,7 @@ namespace WebCore {
         int numPendingOrLoadingRequests(bool recurse) const;
         bool isReloading() const;
         String referrer() const;
+        String outgoingReferrer() const;
         void loadEmptyDocumentSynchronously();
 
         DocumentLoader* activeDocumentLoader() const;
@@ -304,7 +333,164 @@ namespace WebCore {
 
         void setDefersLoading(bool);
 
+        void changeLocation(const String& URL, const String& referrer, bool lockHistory = true, bool userGesture = false);
+        void urlSelected(const ResourceRequest&, const String& target, Event*, bool lockHistory = false);
+        void urlSelected(const FrameLoadRequest&, Event*);
+      
+        bool requestFrame(Element* ownerElement, const String& URL, const AtomicString& frameName);
+        Frame* createFrame(const KURL& URL, const String& name, Element* ownerElement, const String& referrer);
+        Frame* loadSubframe(Element* ownerElement, const KURL& URL, const String& name, const String& referrer);
+
+        void submitForm(const char* action, const String& URL, const FormData&, const String& target, const String& contentType, const String& boundary, Event*);
+        void submitFormAgain();
+        void submitForm(const FrameLoadRequest&, Event*);
+
+        void stop();
+        void stopLoading(bool sendUnload);
+        bool closeURL();
+
+        void didExplicitOpen();
+
+        KURL iconURL();
+        void commitIconURLToIconDatabase(const KURL&);
+
+        KURL baseURL() const;
+        String baseTarget() const;
+
+        void scheduleRedirection(double delay, const String& URL, bool lockHistory = true);
+
+        void scheduleLocationChange(const String& URL, const String& referrer, bool lockHistory = true, bool userGesture = false);
+        void scheduleRefresh(bool userGesture = false);
+        bool isScheduledLocationChangePending() const;
+
+        void scheduleHistoryNavigation(int steps);
+
+        bool canGoBackOrForward(int distance) const;
+        void goBackOrForward(int distance);
+        int getHistoryLength();
+        KURL historyURL(int distance);
+
+        void begin();
+        void begin(const KURL&);
+        void write(const char* str, int len = -1);
+        void write(const String&);
+        void end();
+
+        void endIfNotLoading();
+
+        void setEncoding(const String& encoding, bool userChosen);
+        String encoding() const;
+
+        KJS::JSValue* executeScript(const String& URL, int baseLine, Node*, const String& script);
+        KJS::JSValue* executeScript(Node*, const String& script, bool forceUserGesture = false);
+
+        bool gotoAnchor(const String& name); // returns true if the anchor was found
+        void scrollToAnchor(const KURL&);
+
+        void tokenizerProcessedData();
+
+        String lastModified() const;
+
+        void handledOnloadEvents();
+        String userAgent() const;
+
+        Widget* createJavaAppletWidget(const IntSize&, Element*, const HashMap<String, String>& args);
+
+        void createEmptyDocument();
+
+        void partClearedInBegin(); 
+        void saveDocumentState();
+        void restoreDocumentState();
+
+        String overrideMediaType() const;
+
+        void redirectDataToPlugin(Widget* pluginWidget);
+
+        Frame* opener();
+        void setOpener(Frame*);
+        bool openedByJavaScript();
+        void setOpenedByJavaScript();
+
+        void provisionalLoadStarted();
+
+        bool userGestureHint();
+
+        void resetMultipleFormSubmissionProtection();
+        void didNotOpenURL(const KURL&);
+
+        void addData(const char* bytes, int length);
+
+        bool canCachePage();
+
+        void checkEmitLoadEvent();
+        bool didOpenURL(const KURL&);
+
+        void frameDetached();
+
+        KURL url() const;
+
+        void updateBaseURLForEmptyDocument();
+
+        void setResponseMIMEType(const String&);
+        const String& responseMIMEType() const;
+
+        bool containsPlugins() const;
+
+        void loadDone();
+        void finishedParsing();
+        void checkCompleted();
+
+        void clearRecordedFormValues();
+        void recordFormValue(const String& name, const String& value, PassRefPtr<HTMLFormElement>);
+
+        bool isComplete() const;
+
+        bool requestObject(RenderPart* frame, const String& URL, const AtomicString& frameName,
+            const String& serviceType, const Vector<String>& paramNames, const Vector<String>& paramValues);
+
+        KURL completeURL(const String& URL);
+
+        Widget* createPlugin(Element*, const KURL&, const Vector<String>& paramNames,
+            const Vector<String>& paramValues, const String& mimeType);
+
+        void clear(bool clearWindowProperties = true);
+
+        ObjectContentType objectContentType(const KURL& url, const String& mimeType);
+
+        void didTellBridgeAboutLoad(const String& URL);
+        bool haveToldBridgeAboutLoad(const String& URL);
+
+        KURL originalRequestURL() const;
+
+        void cancelAndClear();
+
+        void setTitle(const String&);
+
     private:
+        void redirectionTimerFired(Timer<FrameLoader>*);
+
+        void cancelRedirection(bool newLoadInProgress = false);
+
+        void started();
+
+        void completed();
+        void parentCompleted();
+
+        bool shouldUsePlugin(Node* element, const KURL&, const String& mimeType, bool hasFallback, bool& useFallback);
+        bool loadPlugin(RenderPart*, const KURL&, const String& mimeType,
+        const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback);
+
+        void emitLoadEvent();
+
+        void receivedFirstData();
+
+        void gotoAnchor();
+
+        void updatePolicyBaseURL();
+        void setPolicyBaseURL(const String&);
+
+        void replaceContentsWithScriptResult(const KURL&);
+
         // Also not cool.
         void startLoading();
 #if PLATFORM(MAC)
@@ -315,7 +501,6 @@ namespace WebCore {
         void clearProvisionalLoad();
         void markLoadComplete();
         void commitProvisionalLoad();
-        void provisionalLoadStarted();
         void frameLoadCompleted();
 
 #if PLATFORM(MAC)
@@ -375,6 +560,12 @@ namespace WebCore {
 
         bool canTarget(Frame*) const;
 
+        void scheduleRedirection(ScheduledRedirection*);
+        void startRedirectionTimer();
+        void stopRedirectionTimer();
+
+        void startIconLoader();
+
         Frame* m_frame;
         FrameLoaderClient* m_client;
 
@@ -385,16 +576,12 @@ namespace WebCore {
         ResourceLoaderSet m_subresourceLoaders;
         ResourceLoaderSet m_plugInStreamLoaders;
 
-#if PLATFORM(MAC)
         RefPtr<DocumentLoader> m_documentLoader;
         RefPtr<DocumentLoader> m_provisionalDocumentLoader;
         RefPtr<DocumentLoader> m_policyDocumentLoader;
-#endif
 
         FrameLoadType m_policyLoadType;
-#if PLATFORM(MAC)
         PolicyCheck m_policyCheck;
-#endif
 
         bool m_delegateIsHandlingProvisionalLoadError;
         bool m_delegateIsDecidingNavigationPolicy;
@@ -403,7 +590,57 @@ namespace WebCore {
         bool m_firstLayoutDone;
         bool m_quickRedirectComing;
         bool m_sentRedirectNotification;
-        bool m_isStoppingLoad;
+        bool m_inStopAllLoaders;
+
+        String m_outgoingReferrer;
+
+        CachePolicy m_cachePolicy;
+
+        HashSet<String> m_urlsBridgeKnowsAbout;
+
+        OwnPtr<FormSubmission> m_deferredFormSubmission;
+
+        bool m_isExecutingJavaScriptFormAction;
+        bool m_isRunningScript;
+
+        String m_responseRefreshHeader;
+        String m_responseModifiedHeader;
+        String m_responseMIMEType;
+
+        bool m_wasLoadEventEmitted;
+        bool m_wasUnloadEventEmitted;
+        bool m_isComplete;
+        bool m_isLoadingMainResource;
+
+        KURL m_URL;
+        KURL m_workingURL;
+
+        OwnPtr<IconLoader> m_iconLoader;
+
+        bool m_cancellingWithLoadInProgress;
+
+        OwnPtr<ScheduledRedirection> m_scheduledRedirection;
+
+        bool m_needsClear;
+        bool m_receivedData;
+
+        bool m_encodingWasChosenByUser;
+        String m_encoding;
+        RefPtr<TextResourceDecoder> m_decoder;
+
+        bool m_containsPlugIns;
+
+        RefPtr<HTMLFormElement> m_formAboutToBeSubmitted;
+        HashMap<String, String> m_formValuesAboutToBeSubmitted;
+        KURL m_submittedFormURL;
+    
+        Timer<FrameLoader> m_redirectionTimer;
+
+        Frame* m_opener;
+        HashSet<Frame*> m_openedFrames;
+
+        bool m_openedByJavaScript;
+
     };
 
 }
index feeed91f63dcb9a4035e01276c55e692b6039cf9..950e96944bdc18241ad55d42f1791d6b4d1d2644 100644 (file)
@@ -59,7 +59,6 @@ namespace WebCore {
     public:
         virtual void detachFrameLoader() = 0;
 
-#if PLATFORM(MAC)
         virtual bool hasWebView() const = 0; // mainly for assertions
         virtual bool hasFrameView() const = 0; // ditto
 
@@ -74,7 +73,9 @@ namespace WebCore {
 
         virtual void makeDocumentView() = 0;
         virtual void makeRepresentation(DocumentLoader*) = 0;
+#if PLATFORM(MAC)
         virtual void setDocumentViewFromPageCache(NSDictionary *) = 0;
+#endif
         virtual void forceLayout() = 0;
         virtual void forceLayoutForNonHTML() = 0;
 
@@ -102,6 +103,7 @@ namespace WebCore {
 
         virtual void loadedFromPageCache() = 0;
 
+#if PLATFORM(MAC)
         virtual void download(NSURLConnection *, NSURLRequest *, NSURLResponse *, id proxy) = 0;
 
         virtual id dispatchIdentifierForInitialRequest(DocumentLoader*, NSURLRequest *) = 0;
@@ -113,6 +115,7 @@ namespace WebCore {
         virtual void dispatchDidFinishLoading(DocumentLoader*, id identifier) = 0;
         virtual void dispatchDidFailLoading(DocumentLoader*, id identifier, NSError *) = 0;
         virtual bool dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, NSURLRequest *, NSURLResponse *, int length) = 0;
+#endif
 
         virtual void dispatchDidHandleOnloadEvents() = 0;
         virtual void dispatchDidReceiveServerRedirectForProvisionalLoad() = 0;
@@ -120,24 +123,34 @@ namespace WebCore {
         virtual void dispatchWillPerformClientRedirect(const KURL&, double interval, double fireDate) = 0;
         virtual void dispatchDidChangeLocationWithinPage() = 0;
         virtual void dispatchWillClose() = 0;
+#if PLATFORM(MAC)
         virtual void dispatchDidReceiveIcon(NSImage *) = 0;
+#endif
         virtual void dispatchDidStartProvisionalLoad() = 0;
         virtual void dispatchDidReceiveTitle(const String& title) = 0;
         virtual void dispatchDidCommitLoad() = 0;
+#if PLATFORM(MAC)
         virtual void dispatchDidFailProvisionalLoad(NSError *) = 0;
         virtual void dispatchDidFailLoad(NSError *) = 0;
+#endif
         virtual void dispatchDidFinishLoad() = 0;
         virtual void dispatchDidFirstLayout() = 0;
 
+#if PLATFORM(MAC)
         virtual Frame* dispatchCreatePage(NSURLRequest *) = 0;
+#endif
         virtual void dispatchShow() = 0;
 
+#if PLATFORM(MAC)
         virtual void dispatchDecidePolicyForMIMEType(FramePolicyFunction, const String& MIMEType, NSURLRequest *) = 0;
         virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction, const NavigationAction&, NSURLRequest *, const String& frameName) = 0;
         virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction, const NavigationAction&, NSURLRequest *) = 0;
+#endif
         virtual void cancelPolicyCheck() = 0;
 
+#if PLATFORM(MAC)
         virtual void dispatchUnableToImplementPolicy(NSError *) = 0;
+#endif
 
         virtual void dispatchWillSubmitForm(FramePolicyFunction, PassRefPtr<FormState>) = 0;
 
@@ -145,27 +158,36 @@ namespace WebCore {
         virtual void clearLoadingFromPageCache(DocumentLoader*) = 0;
         virtual bool isLoadingFromPageCache(DocumentLoader*) = 0;
         virtual void revertToProvisionalState(DocumentLoader*) = 0;
+#if PLATFORM(MAC)
         virtual void setMainDocumentError(DocumentLoader*, NSError *) = 0;
+#endif
         virtual void clearUnarchivingState(DocumentLoader*) = 0;
 
         virtual void progressStarted() = 0;
         virtual void progressCompleted() = 0;
 
+#if PLATFORM(MAC)
         virtual void incrementProgress(id identifier, NSURLResponse *) = 0;
         virtual void incrementProgress(id identifier, NSData *) = 0;
         virtual void completeProgress(id identifier) = 0;
+#endif
 
         virtual void setMainFrameDocumentReady(bool) = 0;
 
+#if PLATFORM(MAC)
         virtual void startDownload(NSURLRequest *) = 0;
+#endif
 
         virtual void willChangeTitle(DocumentLoader*) = 0;
         virtual void didChangeTitle(DocumentLoader*) = 0;
 
+#if PLATFORM(MAC)
         virtual void committedLoad(DocumentLoader*, NSData *) = 0;
+#endif
         virtual void finishedLoading(DocumentLoader*) = 0;
         virtual void finalSetupForReplace(DocumentLoader*) = 0;
 
+#if PLATFORM(MAC)
         virtual NSError *cancelledError(NSURLRequest *) = 0;
         virtual NSError *cannotShowURLError(NSURLRequest *) = 0;
         virtual NSError *interruptForPolicyChangeError(NSURLRequest *) = 0;
@@ -180,11 +202,14 @@ namespace WebCore {
 
 #if PLATFORM(MAC)
         virtual bool willUseArchive(ResourceLoader*, NSURLRequest *, NSURL *originalURL) const = 0;
+#endif
         virtual bool isArchiveLoadPending(ResourceLoader*) const = 0;
         virtual void cancelPendingArchiveLoad(ResourceLoader*) = 0;
         virtual void clearArchivedResources() = 0;
 
+#if PLATFORM(MAC)
         virtual bool canHandleRequest(NSURLRequest *) const = 0;
+#endif
         virtual bool canShowMIMEType(const String& MIMEType) const = 0;
         virtual bool representationExistsForURLScheme(const String& URLScheme) const = 0;
         virtual String generatedMIMETypeForURLScheme(const String& URLScheme) const = 0;
@@ -196,11 +221,12 @@ namespace WebCore {
         virtual void addHistoryItemForFragmentScroll() = 0;
         virtual void didFinishLoad() = 0;
         virtual void prepareForDataSourceReplacement() = 0;
+#if PLATFORM(MAC)
         virtual PassRefPtr<DocumentLoader> createDocumentLoader(NSURLRequest *) = 0;
+#endif
         virtual void setTitle(const String& title, const KURL&) = 0;
 
         virtual String userAgent() = 0;
-#endif
 
     protected:
         virtual ~FrameLoaderClient();
index 889c329ea06af8a8725383671aa7520737e83cb4..0a01f85a74a757d4332913ae6f483b07e67197b3 100644 (file)
  */
 
 #include "config.h"
-
 #include "PluginDocument.h"
 
 #include "Frame.h"
+#include "FrameLoader.h"
 #include "Element.h"
 #include "HTMLNames.h"
 #include "RenderWidget.h"
@@ -83,7 +83,7 @@ void PluginTokenizer::createDocumentStructure()
     
     m_embedElement->setAttribute(nameAttr, "plugin");
     m_embedElement->setSrc(m_doc->URL());
-    m_embedElement->setType(m_doc->frame()->responseMIMEType());
+    m_embedElement->setType(m_doc->frame()->loader()->responseMIMEType());
     
     body->appendChild(embedElement, ec);    
 }
@@ -94,8 +94,7 @@ bool PluginTokenizer::writeRawData(const char* data, int len)
         createDocumentStructure();
 
         if (m_doc->frame()->pluginsEnabled()) {
-            m_doc->frame()->redirectDataToPlugin(static_cast<RenderWidget*>(m_embedElement->renderer())->widget());
-        
+            m_doc->frame()->loader()->redirectDataToPlugin(static_cast<RenderWidget*>(m_embedElement->renderer())->widget());
             finish();
         }
         
index 4a9a0b5ecba0189335e1624e9f12ecec765ba507..8c8e9c06b2102c5720a45ade62c200f8643386ae 100644 (file)
@@ -72,12 +72,14 @@ namespace WebCore {
     public:
         virtual ~ResourceLoader();
 
+        void cancel();
+
 #if PLATFORM(MAC)
         virtual bool load(NSURLRequest *);
 
         FrameLoader *frameLoader() const;
 
-        virtual void cancel(NSError * = nil);
+        virtual void cancel(NSError *);
         NSError *cancelledError();
 #endif
 
index 2a33b62d2437d625026d9cdd9905d235e48f9576..43f5bed532b029f32aa4f347dbdb2c5598bbbdf4 100644 (file)
@@ -481,10 +481,10 @@ bool TextResourceDecoder::checkForHeadCharset(const char* data, size_t len, bool
     // We stop scanning when a tag that is not permitted in <head>
     // is seen, rather when </head> is seen, because that more closely
     // matches behavior in other browsers; more details in
-    // <http://bugzilla.opendarwin.org/show_bug.cgi?id=3590>.
+    // <http://bugs.webkit.org/show_bug.cgi?id=3590>.
     
     // Additionally, we ignore things that looks like tags in <title>; see
-    // <http://bugzilla.opendarwin.org/show_bug.cgi?id=4560>.
+    // <http://bugs.webkit.org/show_bug.cgi?id=4560>.
     
     bool withinTitle = false;
 
index 722f82525bfae3848feb80ece19e03bc1eb60968..1ae9332bb96c4f551ce71d710b65ef96b931a19d 100644 (file)
@@ -76,10 +76,10 @@ void IconLoader::startLoading()
     m_loadIsInProgress = true;
     m_buffer.reserveCapacity(defaultBufferSize);
 
-    RefPtr<ResourceHandle> loader = ResourceHandle::create(m_frame->iconURL(),
+    RefPtr<ResourceHandle> loader = ResourceHandle::create(m_frame->loader()->iconURL(),
         this, m_frame->document()->docLoader());
     if (!loader)
-        LOG_ERROR("Failed to start load for icon at url %s", m_frame->iconURL().url().ascii());
+        LOG_ERROR("Failed to start load for icon at url %s", m_frame->loader()->iconURL().url().ascii());
 
     // Store the handle so we can cancel the load if stopLoading is called later.
     // But only do it if the load hasn't already completed.
@@ -123,7 +123,7 @@ void IconLoader::finishLoading(const KURL& iconURL)
     IconDatabase::sharedIconDatabase()->setIconDataForIconURL(m_buffer.data(), m_buffer.size(), iconURL.url());
 
     // Tell the frame to map its URL(s) to its iconURL in the database.
-    m_frame->commitIconURLToIconDatabase(iconURL);
+    m_frame->loader()->commitIconURLToIconDatabase(iconURL);
 
     // Send the notification to the app that this icon is finished loading.
 #if PLATFORM(MAC) // turn this on for other platforms when FrameLoader is deployed more fully
index ca83d552c072405a0ccfb279ee7da84d91db67b7..d2ffb6275bf9ae178208ec895a378f7c8163e892 100644 (file)
@@ -34,6 +34,7 @@
 #include "CachedResource.h"
 #include "DocLoader.h"
 #include "Frame.h"
+#include "FrameLoader.h"
 #include "HTMLDocument.h"
 #include "LoaderFunctions.h"
 #include "Request.h"
@@ -145,7 +146,7 @@ void Loader::didReceiveResponse(ResourceHandle* handle, const ResourceResponse&
         ASSERT(req->cachedResource()->isImage());
         static_cast<CachedImage*>(req->cachedResource())->clear();
         if (req->docLoader()->frame())
-            req->docLoader()->frame()->checkCompleted();
+            req->docLoader()->frame()->loader()->checkCompleted();
      } else if (response.isMultipart()) {
         req->setIsMultipart(true);
         if (!req->cachedResource()->isImage())
index 403778015b96a1481c21dfc346b58bc28f71e673..42abd729b5b3015cb768109bb72898ebfcd82796 100644 (file)
@@ -128,8 +128,7 @@ FrameLoader* DocumentLoader::frameLoader() const
 DocumentLoader::~DocumentLoader()
 {
     ASSERT(!m_frame || frameLoader()->activeDocumentLoader() != this || !frameLoader()->isLoading());
-}    
-
+}
 
 void DocumentLoader::setMainResourceData(NSData *data)
 {
@@ -269,7 +268,7 @@ void DocumentLoader::stopLoading()
     // Always attempt to stop the frame because it may still be loading/parsing after the data source
     // is done loading and not stopping it can cause a world leak.
     if (m_committed)
-        m_frame->stopLoading();
+        m_frame->loader()->stopLoading(false);
     
     if (!m_loading)
         return;
@@ -281,7 +280,7 @@ void DocumentLoader::stopLoading()
 
     FrameLoader* frameLoader = DocumentLoader::frameLoader();
     
-    if (frameLoader->isLoadingMainResource())
+    if (frameLoader->hasMainResourceLoader())
         // Stop the main resource loader and let it send the cancelled message.
         frameLoader->cancelMainResourceLoad();
     else if (frameLoader->isLoadingSubresources())
@@ -318,7 +317,7 @@ void DocumentLoader::finishedLoading()
     m_gotFirstByte = true;   
     commitIfReady();
     frameLoader()->finishedLoadingDocument(this);
-    m_frame->end();
+    m_frame->loader()->end();
 }
 
 void DocumentLoader::setCommitted(bool f)
@@ -378,7 +377,7 @@ void DocumentLoader::setupForReplaceByMIMEType(const String& newMIMEType)
     }
     
     frameLoader()->finishedLoadingDocument(this);
-    m_frame->end();
+    m_frame->loader()->end();
     
     frameLoader()->setReplacing();
     m_gotFirstByte = false;
@@ -459,7 +458,7 @@ void DocumentLoader::setPrimaryLoadComplete(bool flag)
 {
     m_primaryLoadComplete = flag;
     if (flag) {
-        if (frameLoader()->isLoadingMainResource()) {
+        if (frameLoader()->hasMainResourceLoader()) {
             setMainResourceData(frameLoader()->mainResourceData());
             frameLoader()->releaseMainResourceLoader();
         }
index 83cbc219faeee375e088cce8f95dc1533f3b3db4..34665c38d20415814160efeb930a5ee89cc688b2 100644 (file)
 #import "config.h"
 #import "FrameLoader.h"
 
+#import "BlockExceptions.h"
 #import "Cache.h"
 #import "Chrome.h"
 #import "DOMElementInternal.h"
 #import "Document.h"
 #import "DocumentLoader.h"
-#import "Element.h"
 #import "FloatRect.h"
 #import "FormDataStreamMac.h"
 #import "FormState.h"
 #import "FrameLoaderClient.h"
 #import "FrameMac.h"
 #import "FramePrivate.h"
-#import "PageState.h"
 #import "FrameTree.h"
+#import "FrameView.h"
+#import "HTMLFormElement.h"
+#import "HTMLFrameElement.h"
 #import "HTMLNames.h"
 #import "LoaderNSURLExtras.h"
 #import "LoaderNSURLRequestExtras.h"
 #import "MainResourceLoader.h"
 #import "NavigationAction.h"
 #import "Page.h"
+#import "PageState.h"
 #import "Plugin.h"
 #import "ResourceResponse.h"
 #import "ResourceResponseMac.h"
 #import "SubresourceLoader.h"
+#import "SystemTime.h"
 #import "TextResourceDecoder.h"
 #import "WebCoreFrameBridge.h"
 #import "WebCoreIconDatabaseBridge.h"
 #import "WebCorePageState.h"
 #import "WebCoreSystemInterface.h"
 #import "WebDataProtocol.h"
+#import "Widget.h"
 #import "WindowFeatures.h"
 #import <kjs/JSLock.h>
 #import <wtf/Assertions.h>
@@ -68,71 +73,6 @@ namespace WebCore {
 
 using namespace HTMLNames;
 
-static double storedTimeOfLastCompletedLoad;
-
-static void cancelAll(const ResourceLoaderSet& loaders)
-{
-    const ResourceLoaderSet copy = loaders;
-    ResourceLoaderSet::const_iterator end = copy.end();
-    for (ResourceLoaderSet::const_iterator it = copy.begin(); it != end; ++it)
-        (*it)->cancel();
-}
-
-bool isBackForwardLoadType(FrameLoadType type)
-{
-    switch (type) {
-        case FrameLoadTypeStandard:
-        case FrameLoadTypeReload:
-        case FrameLoadTypeReloadAllowingStaleData:
-        case FrameLoadTypeSame:
-        case FrameLoadTypeInternal:
-        case FrameLoadTypeReplace:
-            return false;
-        case FrameLoadTypeBack:
-        case FrameLoadTypeForward:
-        case FrameLoadTypeIndexedBackForward:
-            return true;
-    }
-    ASSERT_NOT_REACHED();
-    return false;
-}
-
-static int numRequests(Document* document)
-{
-    if (document)
-        return cache()->loader()->numRequests(document->docLoader());
-    return 0;
-}
-
-void FrameLoader::prepareForLoadStart()
-{
-    m_client->progressStarted();
-    m_client->dispatchDidStartProvisionalLoad();
-}
-
-void FrameLoader::setupForReplace()
-{
-    setState(FrameStateProvisional);
-    m_provisionalDocumentLoader = m_documentLoader;
-    m_documentLoader = nil;
-    detachChildren();
-}
-
-void FrameLoader::setupForReplaceByMIMEType(const String& newMIMEType)
-{
-    activeDocumentLoader()->setupForReplaceByMIMEType(newMIMEType);
-}
-
-void FrameLoader::finalSetupForReplace(DocumentLoader* loader)
-{
-    m_client->clearUnarchivingState(loader);
-}
-
-void FrameLoader::load(const KURL& URL, Event* event)
-{
-    load(ResourceRequest(URL), true, event, 0, HashMap<String, String>());
-}
-
 void FrameLoader::load(const FrameLoadRequest& request, bool userGesture, Event* event,
     Element* submitForm, const HashMap<String, String>& formValues)
 {
@@ -141,7 +81,7 @@ void FrameLoader::load(const FrameLoadRequest& request, bool userGesture, Event*
     if (!argsReferrer.isEmpty())
         referrer = argsReferrer;
     else
-        referrer = m_frame->referrer();
+        referrer = outgoingReferrer();
  
     bool hideReferrer;
     if (!canLoad(request.resourceRequest().url().getNSURL(), referrer, hideReferrer))
@@ -210,7 +150,7 @@ void FrameLoader::load(const KURL& URL, const String& referrer, FrameLoadType ne
     if (!isFormSubmission
         && newLoadType != FrameLoadTypeReload
         && newLoadType != FrameLoadTypeSame
-        && !shouldReload(URL, m_frame->url())
+        && !shouldReload(URL, url())
         // We don't want to just scroll if a link from within a
         // frameset is trying to reload the frameset into _top.
         && !m_frame->isFrameSet()) {
@@ -342,37 +282,6 @@ bool FrameLoader::canLoad(NSURL *URL, const String& referrer, bool& hideReferrer
     return !URLIsFileURL || referrerIsLocalURL;
 }
 
-bool FrameLoader::canTarget(Frame* target) const
-{
-    // This method prevents this exploit:
-    // <rdar://problem/3715785> multiple frame injection vulnerability reported by Secunia, affects almost all browsers
-
-    if (!target)
-        return true;
-
-    // Allow with navigation within the same page/frameset.
-    if (m_frame->page() == target->page())
-        return true;
-
-    String domain;
-    if (Document* document = m_frame->document())
-        domain = document->domain();
-    // Allow if the request is made from a local file.
-    if (domain.isEmpty())
-        return true;
-    
-    Frame* parent = target->tree()->parent();
-    // Allow if target is an entire window.
-    if (!parent)
-        return true;
-    
-    String parentDomain;
-    if (Document* parentDocument = parent->document())
-        domain = parentDocument->domain();
-    // Allow if the domain of the parent of the targeted frame equals this domain.
-    return equalIgnoringCase(parentDomain, domain);
-}
-
 bool FrameLoader::startLoadingMainResource(NSMutableURLRequest *request, id identifier)
 {
     ASSERT(!m_mainResourceLoader);
@@ -394,7 +303,7 @@ void FrameLoader::startLoading()
 {
     m_provisionalDocumentLoader->prepareForLoadStart();
 
-    if (isLoadingMainResource())
+    if (m_mainResourceLoader)
         return;
 
     m_client->clearLoadingFromPageCache(m_provisionalDocumentLoader.get());
@@ -406,229 +315,11 @@ void FrameLoader::startLoading()
         m_provisionalDocumentLoader->updateLoading();
 }
 
-void FrameLoader::stopLoadingPlugIns()
-{
-    cancelAll(m_plugInStreamLoaders);
-}
-
-void FrameLoader::stopLoadingSubresources()
-{
-    cancelAll(m_subresourceLoaders);
-}
-
-void FrameLoader::stopLoading(NSError *error)
+void FrameLoader::cancelMainResourceLoad(NSError *error)
 {
     m_mainResourceLoader->cancel(error);
 }
 
-void FrameLoader::stopLoadingSubframes()
-{
-    for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
-        child->loader()->stopLoading();
-}
-
-void FrameLoader::stopLoading()
-{
-    // If this method is called from within this method, infinite recursion can occur (3442218). Avoid this.
-    if (m_isStoppingLoad)
-        return;
-
-    m_isStoppingLoad = true;
-
-    stopPolicyCheck();
-
-    stopLoadingSubframes();
-    if (m_provisionalDocumentLoader)
-        m_provisionalDocumentLoader->stopLoading();
-    if (m_documentLoader)
-        m_documentLoader->stopLoading();
-    setProvisionalDocumentLoader(0);
-    m_client->clearArchivedResources();
-
-    m_isStoppingLoad = false;    
-}
-
-void FrameLoader::cancelMainResourceLoad()
-{
-    if (m_mainResourceLoader)
-        m_mainResourceLoader->cancel();
-}
-
-void FrameLoader::cancelPendingArchiveLoad(ResourceLoader* loader)
-{
-    m_client->cancelPendingArchiveLoad(loader);
-}
-
-DocumentLoader* FrameLoader::activeDocumentLoader() const
-{
-    if (m_state == FrameStateProvisional)
-        return m_provisionalDocumentLoader.get();
-    return m_documentLoader.get();
-}
-
-void FrameLoader::addPlugInStreamLoader(ResourceLoader* loader)
-{
-    m_plugInStreamLoaders.add(loader);
-    activeDocumentLoader()->setLoading(true);
-}
-
-void FrameLoader::removePlugInStreamLoader(ResourceLoader* loader)
-{
-    m_plugInStreamLoaders.remove(loader);
-    activeDocumentLoader()->updateLoading();
-}
-
-bool FrameLoader::isLoadingMainResource() const
-{
-    return m_mainResourceLoader;
-}
-
-bool FrameLoader::isLoadingSubresources() const
-{
-    return !m_subresourceLoaders.isEmpty();
-}
-
-bool FrameLoader::isLoadingPlugIns() const
-{
-    return !m_plugInStreamLoaders.isEmpty();
-}
-
-bool FrameLoader::isLoading() const
-{
-    return isLoadingMainResource() || isLoadingSubresources() || isLoadingPlugIns();
-}
-
-void FrameLoader::addSubresourceLoader(ResourceLoader* loader)
-{
-    ASSERT(!m_provisionalDocumentLoader);
-    m_subresourceLoaders.add(loader);
-    activeDocumentLoader()->setLoading(true);
-}
-
-void FrameLoader::removeSubresourceLoader(ResourceLoader* loader)
-{
-    m_subresourceLoaders.remove(loader);
-    activeDocumentLoader()->updateLoading();
-    checkLoadComplete();
-}
-
-NSData *FrameLoader::mainResourceData() const
-{
-    if (!m_mainResourceLoader)
-        return nil;
-    return m_mainResourceLoader->resourceData();
-}
-
-void FrameLoader::releaseMainResourceLoader()
-{
-    m_mainResourceLoader = 0;
-}
-
-void FrameLoader::setDocumentLoader(DocumentLoader* loader)
-{
-    if (!loader && !m_documentLoader)
-        return;
-    
-    ASSERT(loader != m_documentLoader);
-    ASSERT(!loader || loader->frameLoader() == this);
-
-    m_client->prepareForDataSourceReplacement();
-    if (m_documentLoader)
-        m_documentLoader->detachFromFrame();
-
-    m_documentLoader = loader;
-}
-
-DocumentLoader* FrameLoader::documentLoader() const
-{
-    return m_documentLoader.get();
-}
-
-void FrameLoader::setPolicyDocumentLoader(DocumentLoader* loader)
-{
-    if (m_policyDocumentLoader == loader)
-        return;
-
-    ASSERT(m_frame);
-    if (loader)
-        loader->setFrame(m_frame);
-    if (m_policyDocumentLoader
-            && m_policyDocumentLoader != m_provisionalDocumentLoader
-            && m_policyDocumentLoader != m_documentLoader)
-        m_policyDocumentLoader->detachFromFrame();
-
-    m_policyDocumentLoader = loader;
-}
-   
-DocumentLoader* FrameLoader::provisionalDocumentLoader()
-{
-    return m_provisionalDocumentLoader.get();
-}
-
-void FrameLoader::setProvisionalDocumentLoader(DocumentLoader* loader)
-{
-    ASSERT(!loader || !m_provisionalDocumentLoader);
-    ASSERT(!loader || loader->frameLoader() == this);
-
-    if (m_provisionalDocumentLoader && m_provisionalDocumentLoader != m_documentLoader)
-        m_provisionalDocumentLoader->detachFromFrame();
-
-    m_provisionalDocumentLoader = loader;
-}
-
-FrameState FrameLoader::state() const
-{
-    return m_state;
-}
-
-double FrameLoader::timeOfLastCompletedLoad()
-{
-    return storedTimeOfLastCompletedLoad;
-}
-
-void FrameLoader::provisionalLoadStarted()
-{
-    m_firstLayoutDone = false;
-    m_frame->provisionalLoadStarted();
-    m_client->provisionalLoadStarted();
-}
-
-void FrameLoader::setState(FrameState newState)
-{    
-    m_state = newState;
-    
-    if (newState == FrameStateProvisional)
-        provisionalLoadStarted();
-    else if (newState == FrameStateComplete) {
-        frameLoadCompleted();
-        storedTimeOfLastCompletedLoad = CFAbsoluteTimeGetCurrent();
-        if (m_documentLoader)
-            m_documentLoader->stopRecordingResponses();
-    }
-}
-
-void FrameLoader::clearProvisionalLoad()
-{
-    setProvisionalDocumentLoader(0);
-    m_client->progressCompleted();
-    setState(FrameStateComplete);
-}
-
-void FrameLoader::markLoadComplete()
-{
-    setState(FrameStateComplete);
-}
-
-void FrameLoader::commitProvisionalLoad()
-{
-    stopLoadingSubresources();
-    stopLoadingPlugIns();
-
-    setDocumentLoader(m_provisionalDocumentLoader.get());
-    setProvisionalDocumentLoader(0);
-    setState(FrameStateCommittedPage);
-}
-
 id FrameLoader::identifierForInitialRequest(NSURLRequest *clientRequest)
 {
     return m_client->dispatchIdentifierForInitialRequest(activeDocumentLoader(), clientRequest);
@@ -679,12 +370,6 @@ void FrameLoader::didReceiveData(ResourceLoader* loader, NSData *data, int lengt
     m_client->dispatchDidReceiveContentLength(activeDocumentLoader(), loader->identifier(), lengthReceived);
 }
 
-void FrameLoader::didFinishLoad(ResourceLoader* loader)
-{    
-    m_client->completeProgress(loader->identifier());
-    m_client->dispatchDidFinishLoading(activeDocumentLoader(), loader->identifier());
-}
-
 void FrameLoader::didFailToLoad(ResourceLoader* loader, NSError *error)
 {
     m_client->completeProgress(loader->identifier());
@@ -692,11 +377,6 @@ void FrameLoader::didFailToLoad(ResourceLoader* loader, NSError *error)
         m_client->dispatchDidFailLoading(activeDocumentLoader(), loader->identifier(), error);
 }
 
-bool FrameLoader::privateBrowsingEnabled() const
-{
-    return m_client->privateBrowsingEnabled();
-}
-
 NSURLRequest *FrameLoader::originalRequest() const
 {
     return activeDocumentLoader()->originalRequestCopy();
@@ -712,14 +392,14 @@ void FrameLoader::receivedMainResourceError(NSError *error, bool isComplete)
     if (isComplete) {
         // FIXME: Don't want to do this if an entirely new load is going, so should check
         // that both data sources on the frame are either this or nil.
-        m_frame->stop();
+        stop();
         if (m_client->shouldFallBack(error))
-            m_frame->handleFallbackContent();
+            handleFallbackContent();
     }
     
     if (m_state == FrameStateProvisional) {
         NSURL *failedURL = [m_provisionalDocumentLoader->originalRequestCopy() URL];
-        m_frame->didNotOpenURL(failedURL);
+        didNotOpenURL(failedURL);
 
         // We might have made a page cache item, but now we're bailing out due to an error before we ever
         // transitioned to the new page (before WebFrameState == commit).  The goal here is to restore any state
@@ -742,43 +422,6 @@ void FrameLoader::receivedMainResourceError(NSError *error, bool isComplete)
     loader->mainReceivedError(error, isComplete);
 }
 
-void FrameLoader::clientRedirectCancelledOrFinished(bool cancelWithLoadInProgress)
-{
-    // Note that -webView:didCancelClientRedirectForFrame: is called on the frame load delegate even if
-    // the redirect succeeded.  We should either rename this API, or add a new method, like
-    // -webView:didFinishClientRedirectForFrame:
-    m_client->dispatchDidCancelClientRedirect();
-
-    if (!cancelWithLoadInProgress)
-        m_quickRedirectComing = false;
-
-    m_sentRedirectNotification = false;
-}
-
-void FrameLoader::clientRedirected(const KURL& URL, double seconds, double fireDate, bool lockHistory, bool isJavaScriptFormAction)
-{
-    m_client->dispatchWillPerformClientRedirect(URL, seconds, fireDate);
-    
-    // Remember that we sent a redirect notification to the frame load delegate so that when we commit
-    // the next provisional load, we can send a corresponding -webView:didCancelClientRedirectForFrame:
-    m_sentRedirectNotification = true;
-    
-    // If a "quick" redirect comes in an, we set a special mode so we treat the next
-    // load as part of the same navigation. If we don't have a document loader, we have
-    // no "original" load on which to base a redirect, so we treat the redirect as a normal load.
-    m_quickRedirectComing = lockHistory && m_documentLoader && !isJavaScriptFormAction;
-}
-
-bool FrameLoader::shouldReload(const KURL& currentURL, const KURL& destinationURL)
-{
-    // This function implements the rule: "Don't reload if navigating by fragment within
-    // the same URL, but do reload if going to a new URL or to the same URL with no
-    // fragment identifier at all."
-    if (!currentURL.hasRef() && !destinationURL.hasRef())
-        return true;
-    return !equalIgnoringRef(currentURL, destinationURL);
-}
-
 void FrameLoader::callContinueFragmentScrollAfterNavigationPolicy(void* argument,
     NSURLRequest *request, PassRefPtr<FormState>)
 {
@@ -812,7 +455,7 @@ void FrameLoader::continueFragmentScrollAfterNavigationPolicy(NSURLRequest *requ
         m_client->addHistoryItemForFragmentScroll();
     }
     
-    m_frame->scrollToAnchor(URL);
+    scrollToAnchor(URL);
     
     if (!isRedirect)
         // This will clear previousItem from the rest of the frame tree that didn't
@@ -824,75 +467,6 @@ void FrameLoader::continueFragmentScrollAfterNavigationPolicy(NSURLRequest *requ
     m_client->didFinishLoad();
 }
 
-void FrameLoader::closeOldDataSources()
-{
-    // FIXME: Is it important for this traversal to be postorder instead of preorder?
-    // If so, add helpers for postorder traversal, and use them. If not, then lets not
-    // use a recursive algorithm here.
-    for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
-        child->loader()->closeOldDataSources();
-    
-    if (m_documentLoader)
-        m_client->dispatchWillClose();
-
-    m_client->setMainFrameDocumentReady(false); // stop giving out the actual DOMDocument to observers
-}
-
-void FrameLoader::open(PageState& state)
-{
-    ASSERT(m_frame->page()->mainFrame() == m_frame);
-
-    FramePrivate* d = m_frame->d;
-
-    m_frame->cancelRedirection();
-
-    // We still have to close the previous part page.
-    m_frame->closeURL();
-
-    d->m_bComplete = false;
-    
-    // Don't re-emit the load event.
-    d->m_bLoadEventEmitted = true;
-    
-    // Delete old status bar messages (if it _was_ activated on last URL).
-    if (m_frame->javaScriptEnabled()) {
-        d->m_kjsStatusBarText = String();
-        d->m_kjsDefaultStatusBarText = String();
-    }
-
-    KURL URL = state.URL();
-
-    if (URL.protocol().startsWith("http") && !URL.host().isEmpty() && URL.path().isEmpty())
-        URL.setPath("/");
-    
-    d->m_url = URL;
-    d->m_workingURL = URL;
-
-    m_frame->started();
-
-    m_frame->clear();
-
-    Document* document = state.document();
-    document->setInPageCache(false);
-
-    d->m_bCleared = false;
-    d->m_bComplete = false;
-    d->m_bLoadEventEmitted = false;
-    d->m_referrer = URL.url();
-    
-    m_frame->setView(document->view());
-    
-    d->m_doc = document;
-    d->m_mousePressNode = state.mousePressNode();
-    d->m_decoder = document->decoder();
-
-    m_frame->updatePolicyBaseURL();
-
-    state.restoreJavaScriptState(m_frame->page());
-
-    m_frame->checkCompleted();
-}
-
 void FrameLoader::opened()
 {
     if (m_loadType == FrameLoadTypeStandard && m_documentLoader->isClientRedirect())
@@ -956,13 +530,13 @@ void FrameLoader::commitProvisionalLoad(NSDictionary *pageCache)
         if (!URL || urlIsEmpty(URL))
             URL = [NSURL URLWithString:@"about:blank"];    
 
-        m_frame->setResponseMIMEType([response MIMEType]);
-        if (m_frame->didOpenURL(URL)) {
+        m_responseMIMEType = [response MIMEType];
+        if (didOpenURL(URL)) {
             if ([response isKindOfClass:[NSHTTPURLResponse class]])
                 if (NSString *refresh = [[(NSHTTPURLResponse *)response allHeaderFields] objectForKey:@"Refresh"])
-                    m_frame->addMetaData("http-refresh", refresh);
-            m_frame->addMetaData("modified", [wkGetNSURLResponseLastModifiedDate(response)
-                descriptionWithCalendarFormat:@"%a %b %d %Y %H:%M:%S" timeZone:nil locale:nil]);
+                    m_responseRefreshHeader = refresh;
+            m_responseModifiedHeader = [wkGetNSURLResponseLastModifiedDate(response)
+                descriptionWithCalendarFormat:@"%a %b %d %Y %H:%M:%S" timeZone:nil locale:nil];
         }
     }
     opened();
@@ -983,16 +557,6 @@ void FrameLoader::setRequest(NSURLRequest *request)
     activeDocumentLoader()->setRequest(request);
 }
 
-void FrameLoader::handleFallbackContent()
-{
-    m_frame->handleFallbackContent();
-}
-
-bool FrameLoader::isStopping() const
-{
-    return activeDocumentLoader()->isStopping();
-}
-
 void FrameLoader::setResponse(NSURLResponse *response)
 {
     activeDocumentLoader()->setResponse(response);
@@ -1003,20 +567,6 @@ void FrameLoader::mainReceivedError(NSError *error, bool isComplete)
     activeDocumentLoader()->mainReceivedError(error, isComplete);
 }
 
-void FrameLoader::finishedLoading()
-{
-    // Retain because the stop may release the last reference to it.
-    RefPtr<Frame> protect(m_frame);
-
-    RefPtr<DocumentLoader> dl = activeDocumentLoader();
-    dl->finishedLoading();
-    if (dl->mainDocumentError() || !dl->frameLoader())
-        return;
-    dl->setPrimaryLoadComplete(true);
-    m_client->dispatchDidLoadMainResource(dl.get());
-    checkLoadComplete();
-}
-
 void FrameLoader::notifyIconChanged()
 {
     ASSERT([[WebCoreIconDatabaseBridge sharedInstance] _isEnabled]);
@@ -1026,11 +576,6 @@ void FrameLoader::notifyIconChanged()
     m_client->dispatchDidReceiveIcon(icon);
 }
 
-KURL FrameLoader::URL() const
-{
-    return activeDocumentLoader()->URL();
-}
-
 NSError *FrameLoader::cancelledError(NSURLRequest *request) const
 {
     return m_client->cancelledError(request);
@@ -1046,11 +591,6 @@ bool FrameLoader::willUseArchive(ResourceLoader* loader, NSURLRequest *request,
     return m_client->willUseArchive(loader, request, originalURL);
 }
 
-bool FrameLoader::isArchiveLoadPending(ResourceLoader* loader) const
-{
-    return m_client->isArchiveLoadPending(loader);
-}
-
 void FrameLoader::handleUnimplementablePolicy(NSError *error)
 {
     m_delegateIsHandlingUnimplementablePolicy = true;
@@ -1068,33 +608,6 @@ NSError *FrameLoader::interruptionForPolicyChangeError(NSURLRequest *request)
     return m_client->interruptForPolicyChangeError(request);
 }
 
-bool FrameLoader::isHostedByObjectElement() const
-{
-    Element* owner = m_frame->ownerElement();
-    return owner && owner->hasTagName(objectTag);
-}
-
-bool FrameLoader::isLoadingMainFrame() const
-{
-    Page* page = m_frame->page();
-    return page && m_frame == page->mainFrame();
-}
-
-bool FrameLoader::canShowMIMEType(const String& MIMEType) const
-{
-    return m_client->canShowMIMEType(MIMEType);
-}
-
-bool FrameLoader::representationExistsForURLScheme(const String& URLScheme)
-{
-    return m_client->representationExistsForURLScheme(URLScheme);
-}
-
-String FrameLoader::generatedMIMETypeForURLScheme(const String& URLScheme)
-{
-    return m_client->generatedMIMETypeForURLScheme(URLScheme);
-}
-
 void FrameLoader::checkNavigationPolicy(NSURLRequest *newRequest,
     NavigationPolicyDecisionFunction function, void* argument)
 {
@@ -1108,12 +621,6 @@ void FrameLoader::checkContentPolicy(const String& MIMEType, ContentPolicyDecisi
         MIMEType, activeDocumentLoader()->request());
 }
 
-void FrameLoader::cancelContentPolicyCheck()
-{
-    m_client->cancelPolicyCheck();
-    m_policyCheck.clear();
-}
-
 bool FrameLoader::shouldReloadToHandleUnreachableURL(NSURLRequest *request)
 {
     NSURL *unreachableURL = [request _webDataRequestUnreachableURL];
@@ -1192,36 +699,11 @@ void FrameLoader::reload()
     load(loader.get(), FrameLoadTypeReload, 0);
 }
 
-void FrameLoader::didReceiveServerRedirectForProvisionalLoadForFrame()
-{
-    m_client->dispatchDidReceiveServerRedirectForProvisionalLoad();
-}
-
-void FrameLoader::finishedLoadingDocument(DocumentLoader* loader)
-{
-    m_client->finishedLoading(loader);
-}
-
 void FrameLoader::committedLoad(DocumentLoader* loader, NSData *data)
 {
     m_client->committedLoad(loader, data);
 }
 
-bool FrameLoader::isReplacing() const
-{
-    return m_loadType == FrameLoadTypeReplace;
-}
-
-void FrameLoader::setReplacing()
-{
-    m_loadType = FrameLoadTypeReplace;
-}
-
-void FrameLoader::revertToProvisional(DocumentLoader* loader)
-{
-    m_client->revertToProvisionalState(loader);
-}
-
 void FrameLoader::setMainDocumentError(DocumentLoader* loader, NSError *error)
 {
     m_client->setMainDocumentError(loader, error);
@@ -1234,26 +716,6 @@ void FrameLoader::mainReceivedCompleteError(DocumentLoader* loader, NSError *err
     checkLoadComplete();
 }
 
-bool FrameLoader::subframeIsLoading() const
-{
-    // It's most likely that the last added frame is the last to load so we walk backwards.
-    for (Frame* child = m_frame->tree()->lastChild(); child; child = child->tree()->previousSibling()) {
-        FrameLoader* childLoader = child->loader();
-        DocumentLoader* documentLoader = childLoader->documentLoader();
-        if (documentLoader && documentLoader->isLoadingInAPISense())
-            return true;
-        documentLoader = childLoader->provisionalDocumentLoader();
-        if (documentLoader && documentLoader->isLoadingInAPISense())
-            return true;
-    }
-    return false;
-}
-
-void FrameLoader::willChangeTitle(DocumentLoader* loader)
-{
-    m_client->willChangeTitle(loader);
-}
-
 void FrameLoader::didChangeTitle(DocumentLoader* loader)
 {
     m_client->didChangeTitle(loader);
@@ -1269,20 +731,6 @@ void FrameLoader::didChangeTitle(DocumentLoader* loader)
         }
 }
 
-FrameLoadType FrameLoader::loadType() const
-{
-    return m_loadType;
-}
-
-void FrameLoader::stopPolicyCheck()
-{
-    m_client->cancelPolicyCheck();
-    PolicyCheck check = m_policyCheck;
-    m_policyCheck.clear();
-    check.clearRequest();
-    check.call();
-}
-
 void FrameLoader::checkNewWindowPolicy(const NavigationAction& action, NSURLRequest *request,
     PassRefPtr<FormState> formState, const String& frameName)
 {
@@ -1371,18 +819,6 @@ void FrameLoader::continueAfterNavigationPolicy(PolicyAction policy)
     check.call();
 }
 
-void FrameLoader::continueAfterContentPolicy(PolicyAction policy)
-{
-    PolicyCheck check = m_policyCheck;
-    m_policyCheck.clear();
-    check.call(policy);
-}
-
-void FrameLoader::continueAfterWillSubmitForm(PolicyAction)
-{
-    startLoading();
-}
-
 void FrameLoader::callContinueLoadAfterNavigationPolicy(void* argument,
     NSURLRequest *request, PassRefPtr<FormState> formState)
 {
@@ -1425,7 +861,7 @@ void FrameLoader::continueLoadAfterNavigationPolicy(NSURLRequest *request,
     }
 
     FrameLoadType type = m_policyLoadType;
-    stopLoading();
+    stopAllLoaders();
     setProvisionalDocumentLoader(m_policyDocumentLoader.get());
     m_loadType = type;
     setState(FrameStateProvisional);
@@ -1441,41 +877,6 @@ void FrameLoader::continueLoadAfterNavigationPolicy(NSURLRequest *request,
         continueAfterWillSubmitForm();
 }
 
-void FrameLoader::didFirstLayout()
-{
-    if (isBackForwardLoadType(m_loadType) && m_client->hasBackForwardList())
-        m_client->restoreScrollPositionAndViewState();
-
-    m_firstLayoutDone = true;
-    m_client->dispatchDidFirstLayout();
-}
-
-void FrameLoader::frameLoadCompleted()
-{
-    m_client->frameLoadCompleted();
-
-    // After a canceled provisional load, firstLayoutDone is false.
-    // Reset it to true if we're displaying a page.
-    if (m_documentLoader)
-        m_firstLayoutDone = true;
-}
-
-bool FrameLoader::firstLayoutDone() const
-{
-    return m_firstLayoutDone;
-}
-
-bool FrameLoader::isQuickRedirectComing() const
-{
-    return m_quickRedirectComing;
-}
-
-void FrameLoader::closeDocument()
-{
-    m_client->willCloseDocument();
-    m_frame->closeURL();
-}
-
 void FrameLoader::transitionToCommitted(NSDictionary *pageCache)
 {
     ASSERT(m_client->hasWebView());
@@ -1579,7 +980,7 @@ void FrameLoader::checkLoadCompleteForThisFrame()
 
                 // FIXME: can stopping loading here possibly have any effect, if isLoading is false,
                 // which it must be to be in this branch of the if? And is it OK to just do a full-on
-                // stopLoading instead of stopLoadingSubframes?
+                // stopAllLoaders instead of stopLoadingSubframes?
                 stopLoadingSubframes();
                 pdl->stopLoading();
 
@@ -1657,8 +1058,8 @@ void FrameLoader::continueLoadAfterNewWindowPolicy(NSURLRequest *request,
         return;
 
     mainFrame->tree()->setName(frameName);
-    mainFrame->loader()->client()->dispatchShow();
-    mainFrame->setOpener(frame.get());
+    mainFrame->loader()->m_client->dispatchShow();
+    mainFrame->loader()->setOpener(frame.get());
     mainFrame->loader()->load(request, NavigationAction(), FrameLoadTypeStandard, formState);
 }
 
@@ -1736,22 +1137,12 @@ void FrameLoader::post(const KURL& URL, const String& referrer, const String& fr
     [request release];
 }
 
-void FrameLoader::detachChildren()
-{
-    // FIXME: Is it really necessary to do this in reverse order?
-    Frame* previous;
-    for (Frame* child = m_frame->tree()->lastChild(); child; child = previous) {
-        previous = child->tree()->previousSibling();
-        child->loader()->detachFromParent();
-    }
-}
-
 void FrameLoader::detachFromParent()
 {
     RefPtr<Frame> protect(m_frame);
 
     closeDocument();
-    stopLoading();
+    stopAllLoaders();
     m_client->detachedFromParent1();
     detachChildren();
     m_client->detachedFromParent2();
@@ -1759,6 +1150,7 @@ void FrameLoader::detachFromParent()
     m_client->detachedFromParent3();
     if (Frame* parent = m_frame->tree()->parent())
         parent->tree()->removeChild(m_frame);
+    m_frame->setView(0);
     [Mac(m_frame)->bridge() close];
     m_client->detachedFromParent4();
 }
@@ -1775,36 +1167,13 @@ void FrameLoader::addExtraFieldsToRequest(NSMutableURLRequest *request, bool mai
         if (mainResource && (isLoadingMainFrame() || alwaysFromRequest))
             [request setMainDocumentURL:[request URL]];
         else
-            [request setMainDocumentURL:m_frame->page()->mainFrame()->url().getNSURL()];
+            [request setMainDocumentURL:m_frame->page()->mainFrame()->loader()->url().getNSURL()];
     }
     
     if (mainResource)
         [request setValue:@"text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" forHTTPHeaderField:@"Accept"];
 }
 
-// Called every time a resource is completely loaded, or an error is received.
-void FrameLoader::checkLoadComplete()
-{
-    ASSERT(m_client->hasWebView());
-
-    for (RefPtr<Frame> frame = m_frame; frame; frame = frame->tree()->parent())
-        frame->loader()->checkLoadCompleteForThisFrame();
-}
-
-int FrameLoader::numPendingOrLoadingRequests(bool recurse) const
-{
-    int count = 0;
-    const Frame* frame = m_frame;
-
-    count += numRequests(frame->document());
-
-    if (recurse)
-        while ((frame = frame->tree()->traverseNext(frame)))
-            count += numRequests(frame->document());
-
-    return count;
-}
-
 bool FrameLoader::isReloading() const
 {
     return [documentLoader()->request() cachePolicy] == NSURLRequestReloadIgnoringCacheData;
@@ -1826,26 +1195,11 @@ void FrameLoader::loadEmptyDocumentSynchronously()
 
 void FrameLoader::loadResourceSynchronously(const ResourceRequest& request, Vector<char>& data, ResourceResponse& r)
 {
-#if 0
-    NSDictionary *headerDict = nil;
-    const HTTPHeaderMap& requestHeaders = request.httpHeaderFields();
-
-    if (!requestHeaders.isEmpty())
-        headerDict = [NSDictionary _webcore_dictionaryWithHeaderMap:requestHeaders];
-    
-    FormData postData;
-    if (!request.httpBody().elements().isEmpty())
-        postData = request.httpBody();
-    Vector<char> results([resultData length]);
-
-    memcpy(results.data(), [resultData bytes], [resultData length]);
-#endif
-
     NSURL *URL = request.url().getNSURL();
 
     // Since this is a subresource, we can load any URL (we ignore the return value).
     // But we still want to know whether we should hide the referrer or not, so we call the canLoadURL method.
-    String referrer = m_frame->referrer();
+    String referrer = outgoingReferrer();
     bool hideReferrer;
     canLoad(URL, referrer, hideReferrer);
     if (hideReferrer)
@@ -1903,16 +1257,179 @@ void FrameLoader::loadResourceSynchronously(const ResourceRequest& request, Vect
     memcpy(data.data(), [result bytes], [result length]);
 }
 
-void FrameLoader::setClient(FrameLoaderClient* client)
+Frame* FrameLoader::createFrame(const KURL& url, const String& name, Element* ownerElement, const String& referrer)
+{
+    BOOL allowsScrolling = YES;
+    int marginWidth = -1;
+    int marginHeight = -1;
+    if (ownerElement->hasTagName(frameTag) || ownerElement->hasTagName(iframeTag)) {
+        HTMLFrameElement* o = static_cast<HTMLFrameElement*>(ownerElement);
+        allowsScrolling = o->scrollingMode() != ScrollbarAlwaysOff;
+        marginWidth = o->getMarginWidth();
+        marginHeight = o->getMarginHeight();
+    }
+
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+    
+    return [[Mac(m_frame)->bridge() createChildFrameNamed:name
+                                                             withURL:url.getNSURL()
+                                                            referrer:referrer 
+                                                          ownerElement:ownerElement
+                                                     allowsScrolling:allowsScrolling
+                                                         marginWidth:marginWidth
+                                                        marginHeight:marginHeight] _frame];
+
+    END_BLOCK_OBJC_EXCEPTIONS;
+    return 0;
+}
+
+ObjectContentType FrameLoader::objectContentType(const KURL& url, const String& mimeType)
+{
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+    return (ObjectContentType)[Mac(m_frame)->bridge() determineObjectFromMIMEType:mimeType URL:url.getNSURL()];
+    END_BLOCK_OBJC_EXCEPTIONS;
+    return ObjectContentNone;
+}
+
+static NSArray* nsArray(const Vector<String>& vector)
+{
+    unsigned len = vector.size();
+    NSMutableArray* array = [NSMutableArray arrayWithCapacity:len];
+    for (unsigned x = 0; x < len; x++)
+        [array addObject:vector[x]];
+    return array;
+}
+
+Widget* FrameLoader::createPlugin(Element* element, const KURL& url,
+    const Vector<String>& paramNames, const Vector<String>& paramValues,
+    const String& mimeType)
+{
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+    return new Widget([Mac(m_frame)->bridge() viewForPluginWithURL:url.getNSURL()
+                                  attributeNames:nsArray(paramNames)
+                                  attributeValues:nsArray(paramValues)
+                                  MIMEType:mimeType
+                                  DOMElement:[DOMElement _elementWith:element]
+                                loadManually:m_frame->document()->isPluginDocument()]);
+    END_BLOCK_OBJC_EXCEPTIONS;
+    return 0;
+}
+
+void FrameLoader::redirectDataToPlugin(Widget* pluginWidget)
+{
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+    [Mac(m_frame)->bridge() redirectDataToPlugin:pluginWidget->getView()];
+    END_BLOCK_OBJC_EXCEPTIONS;
+}
+
+Widget* FrameLoader::createJavaAppletWidget(const IntSize& size, Element* element, const HashMap<String, String>& args)
 {
-    ASSERT(client);
-    ASSERT(!m_client);
-    m_client = client;
+    Widget* result = new Widget;
+    
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+    
+    NSMutableArray *attributeNames = [[NSMutableArray alloc] init];
+    NSMutableArray *attributeValues = [[NSMutableArray alloc] init];
+    
+    DeprecatedString baseURLString;
+    HashMap<String, String>::const_iterator end = args.end();
+    for (HashMap<String, String>::const_iterator it = args.begin(); it != end; ++it) {
+        if (it->first.lower() == "baseurl")
+            baseURLString = it->second.deprecatedString();
+        [attributeNames addObject:it->first];
+        [attributeValues addObject:it->second];
+    }
+    
+    if (baseURLString.isEmpty())
+        baseURLString = m_frame->document()->baseURL();
+
+    result->setView([Mac(m_frame)->bridge() viewForJavaAppletWithFrame:NSMakeRect(0, 0, size.width(), size.height())
+                                         attributeNames:attributeNames
+                                        attributeValues:attributeValues
+                                                baseURL:completeURL(baseURLString).getNSURL()
+                                             DOMElement:[DOMElement _elementWith:element]]);
+    [attributeNames release];
+    [attributeValues release];
+    m_frame->view()->addChild(result);
+    
+    END_BLOCK_OBJC_EXCEPTIONS;
+    
+    return result;
+}
+
+void FrameLoader::partClearedInBegin()
+{
+    if (m_frame->javaScriptEnabled())
+        [Mac(m_frame)->bridge() windowObjectCleared];
+}
+
+void FrameLoader::saveDocumentState()
+{
+    // Do not save doc state if the page has a password field and a form that would be submitted via https.
+    Document* document = m_frame->document();
+    if (!(document && document->hasPasswordField() && document->hasSecureForm())) {
+        BEGIN_BLOCK_OBJC_EXCEPTIONS;
+        [Mac(m_frame)->bridge() saveDocumentState];
+        END_BLOCK_OBJC_EXCEPTIONS;
+    }
+}
+
+void FrameLoader::restoreDocumentState()
+{
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+    [Mac(m_frame)->bridge() restoreDocumentState];
+    END_BLOCK_OBJC_EXCEPTIONS;
+}
+
+String FrameLoader::overrideMediaType() const
+{
+    NSString *overrideType = [Mac(m_frame)->bridge() overrideMediaType];
+    if (overrideType)
+        return overrideType;
+    return String();
+}
+
+NSData *FrameLoader::mainResourceData() const
+{
+    if (!m_mainResourceLoader)
+        return nil;
+    return m_mainResourceLoader->resourceData();
+}
+
+bool FrameLoader::canGoBackOrForward(int distance) const
+{
+    return [Mac(m_frame)->bridge() canGoBackOrForward:distance];
+}
+
+KURL FrameLoader::originalRequestURL() const
+{
+    return [activeDocumentLoader()->initialRequest() URL];
+}
+
+int FrameLoader::getHistoryLength()
+{
+    return [Mac(m_frame)->bridge() historyLength];
 }
 
-FrameLoaderClient* FrameLoader::client() const
+void FrameLoader::goBackOrForward(int distance)
 {
-    return m_client;
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+    [Mac(m_frame)->bridge() goBackOrForward:distance];
+    END_BLOCK_OBJC_EXCEPTIONS;
+}
+
+KURL FrameLoader::historyURL(int distance)
+{
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+    return [Mac(m_frame)->bridge() historyURL:distance];
+    END_BLOCK_OBJC_EXCEPTIONS;
+    return KURL();
+}
+
+void FrameLoader::didFinishLoad(ResourceLoader* loader)
+{    
+    m_client->completeProgress(loader->identifier());
+    m_client->dispatchDidFinishLoading(activeDocumentLoader(), loader->identifier());
 }
 
 PolicyCheck::PolicyCheck()
@@ -1992,8 +1509,4 @@ void PolicyCheck::clearRequest()
     m_frameName = String();
 }
 
-FrameLoaderClient::~FrameLoaderClient()
-{
-}
-
 }
index 939bc21ea53c699be48ddf9b6b5552cc36ac08e6..9a6b2648b6ee547829a3bfdb9fbc3b1df60fd591 100644 (file)
@@ -93,7 +93,7 @@ Vector<char> ServeSynchronousRequest(Loader *loader, DocLoader *docLoader, const
     if (!frame)
         return Vector<char>();
     
-    frame->didTellBridgeAboutLoad(request.url().url());
+    frame->loader()->didTellBridgeAboutLoad(request.url().url());
 
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
 
@@ -134,7 +134,7 @@ void CheckCacheObjectStatus(DocLoader *loader, CachedResource *cachedResource)
     // Notify the caller that we "loaded".
     FrameMac *frame = static_cast<FrameMac *>(loader->frame());
 
-    if (!frame || frame->haveToldBridgeAboutLoad(cachedResource->url()))
+    if (!frame || frame->loader()->haveToldBridgeAboutLoad(cachedResource->url()))
         return;
         
     NSURLRequest *request = cachedResource->getNSURLRequest();
@@ -144,7 +144,7 @@ void CheckCacheObjectStatus(DocLoader *loader, CachedResource *cachedResource)
     // FIXME: If the WebKit client changes or cancels the request, WebCore does not respect this and continues the load.
     frame->loader()->loadedResourceFromMemoryCache(request, response, [data length]);
     
-    frame->didTellBridgeAboutLoad(cachedResource->url());
+    frame->loader()->didTellBridgeAboutLoad(cachedResource->url());
 }
 
 bool IsResponseURLEqualToURL(PlatformResponse response, const String& m_url)
index 8cbe7cf74b0c1a694c91ac03fc88e65da7dfb84f..a510f475cab44b5aa20dab805807d56a2cadb452 100644 (file)
@@ -403,6 +403,11 @@ void ResourceLoader::didCancel(NSError *error)
     releaseResources();
 }
 
+void ResourceLoader::cancel()
+{
+    cancel(nil);
+}
+
 void ResourceLoader::cancel(NSError *error)
 {
     if (m_reachedTerminalState)
index 8ba7f3c18bccb523db63543f8b8e20264c7c194d..c758fcd3ae009621cdd2962e173dcd44a375ffab 100644 (file)
@@ -65,9 +65,9 @@ PassRefPtr<SubresourceLoader> SubresourceLoader::create(Frame* frame, ResourceHa
     // But we still want to know whether we should hide the referrer or not, so we call the canLoadURL method.
     // FIXME: is that really the rule we want for subresources?
     bool hideReferrer;
-    fl->canLoad(request.url().getNSURL(), frame->loader()->referrer(), hideReferrer);
+    fl->canLoad(request.url().getNSURL(), fl->outgoingReferrer(), hideReferrer);
     if (!hideReferrer && !request.httpReferrer())
-        request.setHTTPReferrer(fl->referrer());
+        request.setHTTPReferrer(fl->outgoingReferrer());
 
     NSMutableURLRequest *newRequest = [[NSMutableURLRequest alloc] initWithURL:request.url().getNSURL()];    
 
diff --git a/WebCore/loader/qt/FrameLoaderQt.cpp b/WebCore/loader/qt/FrameLoaderQt.cpp
new file mode 100644 (file)
index 0000000..646e173
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
+ * Copyright (C) 2006 Zack Rusin <zack@kde.org>
+ * Copyright (C) 2006 George Staikos <staikos@kde.org>
+ * Copyright (C) 2006 Simon Hausmann <hausmann@kde.org>
+ * Copyright (C) 2006 Rob Buis <buis@kde.org>
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "FrameQt.h"
+
+#include "Element.h"
+#include "RenderObject.h"
+#include "RenderWidget.h"
+#include "RenderLayer.h"
+#include "Page.h"
+#include "Document.h"
+#include "HTMLElement.h"
+#include "DOMWindow.h"
+#include "EditorClientQt.h"
+#include "FrameLoadRequest.h"
+#include "DOMImplementation.h"
+#include "ResourceHandleInternal.h"
+#include "Document.h"
+#include "Settings.h"
+#include "Plugin.h"
+#include "FramePrivate.h"
+#include "GraphicsContext.h"
+#include "HTMLDocument.h"
+#include "ResourceHandle.h"
+#include "PlatformMouseEvent.h"
+#include "PlatformKeyboardEvent.h"
+#include "PlatformWheelEvent.h"
+#include "MouseEventWithHitTestResults.h"
+#include "SelectionController.h"
+#include "TypingCommand.h"
+#include "JSLock.h"
+#include "kjs_window.h"
+#include "runtime_root.h"
+
+#include <QScrollArea>
+
+#define notImplemented() do { fprintf(stderr, "FIXME: UNIMPLEMENTED: %s:%d\n", __FILE__, __LINE__); } while(0)
+
+namespace WebCore {
+
+void FrameLoader::submitForm(const FrameLoadRequest& frameLoadRequest, Event*)
+{
+    // FIXME: We'd like to remove this altogether and fix the multiple form submission issue another way.
+    // We do not want to submit more than one form from the same page,
+    // nor do we want to submit a single form more than once.
+    // This flag prevents these from happening; not sure how other browsers prevent this.
+    // The flag is reset in each time we start handle a new mouse or key down event, and
+    // also in setView since this part may get reused for a page from the back/forward cache.
+    // The form multi-submit logic here is only needed when we are submitting a form that affects this frame.
+    // FIXME: Frame targeting is only one of the ways the submission could end up doing something other
+    // than replacing this frame's content, so this check is flawed. On the other hand, the check is hardly
+    // needed any more now that we reset m_submittedFormURL on each mouse or key down event.
+    Frame* target = m_frame->tree()->find(request.frameName());
+    if (m_frame->tree()->isDescendantOf(target)) {
+        if (m_submittedFormURL == request.resourceRequest().url())
+            return;
+        m_submittedFormURL = request.resourceRequest().url();
+    }
+
+    if (QtFrame(m_frame)->client())
+        QtFrame(m_frame)->client()->submitForm(request.resourceRequest().httpMethod(),
+            request.resourceRequest().url(), &request.resourceRequest().httpBody());
+
+    clearRecordedFormValues();
+}
+
+void FrameLoader::urlSelected(const FrameLoadRequest& frameLoadRequest, Event*)
+{
+    const ResourceRequest& request = frameLoadRequest.resourceRequest();
+
+    if (!QtFrame(m_frame)->client())
+        return;
+
+    QtFrame(m_frame)->client()->openURL(request.url());
+}
+
+void FrameLoader::setTitle(const String& title)
+{
+    if (m_frame->view() && m_frame->view()->parentWidget())
+        m_frame->view()->parentWidget()->setWindowTitle(title);
+}
+
+Frame* FrameLoader::createFrame(const KURL& url, const String& name, Element* ownerElement, const String& referrer)
+{
+    notImplemented();
+    return 0;
+}
+
+ObjectContentType FrameLoader::objectContentType(const KURL&, const String& mimeType)
+{
+    notImplemented();
+    return ObjectContentType();
+}
+
+Widget* FrameLoader::createPlugin(Element*, const KURL&, const Vector<String>&, const Vector<String>&, const String&)
+{
+    notImplemented();
+    return 0;
+}
+
+Widget* FrameLoader::createJavaAppletWidget(const IntSize&, Element*, const HashMap<String, String>&)
+{
+    notImplemented();
+    return 0;
+}
+
+KURL FrameLoader::originalRequestURL() const
+{
+    notImplemented();
+    return KURL();
+}
+
+}
+
+// vim: ts=4 sw=4 et
index c84c782468f071c7893223f713dae3b30c1c5396..0582abe3d7204b972a41a3d6260e237672ac708e 100644 (file)
@@ -33,6 +33,7 @@
 #include "Document.h"
 #include "Element.h"
 #include "Frame.h"
+#include "FrameLoader.h"
 #include "Page.h"
 #include "Screen.h"
 
@@ -59,10 +60,10 @@ Document* DOMWindow::document() const
         return 0;
     
     if (!m_frame->document()) {
-        m_frame->createEmptyDocument();
-        m_frame->begin();
-        m_frame->write("<HTML><BODY>");
-        m_frame->end();
+        m_frame->loader()->createEmptyDocument();
+        m_frame->loader()->begin();
+        m_frame->loader()->write("<HTML><BODY>");
+        m_frame->loader()->end();
     }
     return m_frame->document();
 }
index f31720f5545c56578a8e28a1c7016797527b2699..5cc31019cb38162e70f02f72054142f2414770cf 100644 (file)
@@ -35,7 +35,6 @@
 #include "CSSPropertyNames.h"
 #include "Cache.h"
 #include "CachedCSSStyleSheet.h"
-#include "DOMImplementation.h"
 #include "DOMWindow.h"
 #include "DocLoader.h"
 #include "DocumentType.h"
@@ -165,18 +164,6 @@ static inline Frame* parentFromOwnerElement(Element* ownerElement)
     return ownerElement->document()->frame();
 }
 
-static bool getString(JSValue* result, String& string)
-{
-    if (!result)
-        return false;
-    JSLock lock;
-    UString ustring;
-    if (!result->getString(ustring))
-        return false;
-    string = ustring;
-    return true;
-}
-
 Frame::Frame(Page* page, Element* ownerElement, PassRefPtr<EditorClient> client) 
     : d(new FramePrivate(page, parentFromOwnerElement(ownerElement), this, ownerElement, client))
 {
@@ -230,12 +217,6 @@ Frame::~Frame()
     if (d->m_domWindow)
         d->m_domWindow->disconnectFrame();
             
-    setOpener(0);
-    HashSet<Frame*> openedBy = d->m_openedFrames;
-    HashSet<Frame*>::iterator end = openedBy.end();
-    for (HashSet<Frame*>::iterator it = openedBy.begin(); it != end; ++it)
-        (*it)->setOpener(0);
-    
     if (d->m_view) {
         d->m_view->hide();
         d->m_view->m_frame = 0;
@@ -248,369 +229,11 @@ Frame::~Frame()
     d = 0;
 }
 
-#pragma mark BEGIN LOADING FUNCTIONS
-
-void Frame::changeLocation(const DeprecatedString& URL, const String& referrer, bool lockHistory, bool userGesture)
-{
-    if (URL.find("javascript:", 0, false) == 0) {
-        String script = KURL::decode_string(URL.mid(11));
-        JSValue* result = executeScript(0, script, userGesture);
-        String scriptResult;
-        if (getString(result, scriptResult)) {
-            begin(url());
-            write(scriptResult);
-            end();
-        }
-        return;
-    }
-
-    ResourceRequestCachePolicy policy = (d->m_cachePolicy == CachePolicyReload) || (d->m_cachePolicy == CachePolicyRefresh) ? ReloadIgnoringCacheData : UseProtocolCachePolicy;
-    ResourceRequest request(completeURL(URL), referrer, policy);
-    
-    urlSelected(request, "_self", 0, lockHistory);
-}
-
-void Frame::urlSelected(const ResourceRequest& request, const String& _target, Event* triggeringEvent, bool lockHistory)
-{
-  String target = _target;
-  if (target.isEmpty() && d->m_doc)
-    target = d->m_doc->baseTarget();
-
-  const KURL& url = request.url();
-
-  if (url.url().startsWith("javascript:", false)) {
-    executeScript(0, KURL::decode_string(url.url().mid(11)), true);
-    return;
-  }
-
-  if (!url.isValid())
-    // ### ERROR HANDLING
-    return;
-
-  FrameLoadRequest frameRequest(request, target);
-
-  if (d->m_bHTTPRefresh)
-    d->m_bHTTPRefresh = false;
-
-  if (frameRequest.resourceRequest().httpReferrer().isEmpty())
-      frameRequest.resourceRequest().setHTTPReferrer(d->m_referrer);
-
-  urlSelected(frameRequest, triggeringEvent);
-}
-
-bool Frame::requestFrame(Element* ownerElement, const String& urlParam, const AtomicString& frameName)
-{
-    DeprecatedString _url = urlParam.deprecatedString();
-    // Support for <frame src="javascript:string">
-    KURL scriptURL;
-    KURL url;
-    if (_url.startsWith("javascript:", false)) {
-        scriptURL = _url;
-        url = "about:blank";
-    } else
-        url = completeURL(_url);
-
-    Frame* frame = tree()->child(frameName);
-    if (frame) {
-        ResourceRequestCachePolicy policy = (d->m_cachePolicy == CachePolicyReload) || (d->m_cachePolicy == CachePolicyRefresh)
-            ? ReloadIgnoringCacheData : UseProtocolCachePolicy;
-        frame->urlSelected(ResourceRequest(url, d->m_referrer, policy), 0);
-    } else
-        frame = loadSubframe(ownerElement, url, frameName, d->m_referrer);
-    
-    if (!frame)
-        return false;
-
-    if (!scriptURL.isEmpty())
-        frame->replaceContentsWithScriptResult(scriptURL);
-
-    return true;
-}
-
-Frame* Frame::loadSubframe(Element* ownerElement, const KURL& url, const String& name, const String& referrer)
-{
-    Frame* frame = createFrame(url, name, ownerElement, referrer);
-    if (!frame)  {
-        checkEmitLoadEvent();
-        return 0;
-    }
-    
-    frame->childBegin();
-    
-    if (ownerElement->renderer() && frame->view())
-        static_cast<RenderWidget*>(ownerElement->renderer())->setWidget(frame->view());
-    
-    checkEmitLoadEvent();
-    
-    // In these cases, the synchronous load would have finished
-    // before we could connect the signals, so make sure to send the 
-    // completed() signal for the child by hand
-    // FIXME: In this case the Frame will have finished loading before 
-    // it's being added to the child list. It would be a good idea to
-    // create the child first, then invoke the loader separately.
-    if (url.isEmpty() || url == "about:blank") {
-        frame->completed(false);
-        frame->checkCompleted();
-    }
-
-    return frame;
-}
-
-void Frame::submitFormAgain()
-{
-    FramePrivate::SubmitForm* form = d->m_submitForm;
-    d->m_submitForm = 0;
-    if (d->m_doc && !d->m_doc->parsing() && form)
-        submitForm(form->submitAction, form->submitUrl, form->submitFormData,
-            form->target, form->submitContentType, form->submitBoundary, form->event.get());
-    delete form;
-}
-
-void Frame::submitForm(const char *action, const String& url, const FormData& formData, const String& _target, const String& contentType, const String& boundary, Event* event)
-{
-  KURL u = completeURL(url.deprecatedString());
-
-  if (!u.isValid())
-    // ### ERROR HANDLING!
-    return;
-
-  DeprecatedString urlstring = u.url();
-  if (urlstring.startsWith("javascript:", false)) {
-    urlstring = KURL::decode_string(urlstring);
-    d->m_executingJavaScriptFormAction = true;
-    executeScript(0, urlstring.mid(11));
-    d->m_executingJavaScriptFormAction = false;
-    return;
-  }
-
-  FrameLoadRequest frameRequest;
-
-  if (!d->m_referrer.isEmpty())
-      frameRequest.resourceRequest().setHTTPReferrer(d->m_referrer);
-
-  frameRequest.setFrameName(_target.isEmpty() ? d->m_doc->baseTarget() : _target);
-
-  // Handle mailto: forms
-  if (u.protocol() == "mailto") {
-      // 2)  Append body=
-      DeprecatedString bodyEnc;
-      if (contentType.lower() == "multipart/form-data")
-         // FIXME: is this correct?  I suspect not
-         bodyEnc = KURL::encode_string(formData.flattenToString().deprecatedString());
-      else if (contentType.lower() == "text/plain") {
-         // Convention seems to be to decode, and s/&/\n/
-         DeprecatedString tmpbody = formData.flattenToString().deprecatedString();
-         tmpbody.replace('&', '\n');
-         tmpbody.replace('+', ' ');
-         tmpbody = KURL::decode_string(tmpbody);  // Decode the rest of it
-         bodyEnc = KURL::encode_string(tmpbody);  // Recode for the URL
-      } else
-         bodyEnc = KURL::encode_string(formData.flattenToString().deprecatedString());
-
-      DeprecatedString query = u.query();
-      if (!query.isEmpty())
-          query += '&';
-      query += "body=" + bodyEnc;
-      
-      u.setQuery(query);
-  } 
-
-  if (strcmp(action, "GET") == 0) {
-    if (u.protocol() != "mailto")
-       u.setQuery(formData.flattenToString().deprecatedString());
-  } else {
-      frameRequest.resourceRequest().setHTTPBody(formData);
-      frameRequest.resourceRequest().setHTTPMethod("POST");
-
-    // construct some user headers if necessary
-    if (contentType.isNull() || contentType == "application/x-www-form-urlencoded")
-      frameRequest.resourceRequest().setHTTPContentType(contentType);
-    else // contentType must be "multipart/form-data"
-      frameRequest.resourceRequest().setHTTPContentType(contentType + "; boundary=" + boundary);
-  }
-
-  if (d->m_runningScripts > 0) {
-    if (d->m_submitForm)
-        return;
-    d->m_submitForm = new FramePrivate::SubmitForm;
-    d->m_submitForm->submitAction = action;
-    d->m_submitForm->submitUrl = url;
-    d->m_submitForm->submitFormData = formData;
-    d->m_submitForm->target = _target;
-    d->m_submitForm->submitContentType = contentType;
-    d->m_submitForm->submitBoundary = boundary;
-    d->m_submitForm->event = event;
-  } else {
-      frameRequest.resourceRequest().setURL(u);
-      submitForm(frameRequest, event);
-  }
-}
-
-void Frame::stopLoading(bool sendUnload)
-{
-  if (d->m_doc && d->m_doc->tokenizer())
-    d->m_doc->tokenizer()->stopParsing();
-  
-  d->m_metaData.clear();
-
-  if (sendUnload) {
-    if (d->m_doc) {
-      if (d->m_bLoadEventEmitted && !d->m_bUnloadEventEmitted) {
-        Node* currentFocusNode = d->m_doc->focusNode();
-        if (currentFocusNode)
-            currentFocusNode->aboutToUnload();
-        d->m_doc->dispatchWindowEvent(unloadEvent, false, false);
-        if (d->m_doc)
-          d->m_doc->updateRendering();
-        d->m_bUnloadEventEmitted = true;
-      }
-    }
-    
-    if (d->m_doc && !d->m_doc->inPageCache())
-      d->m_doc->removeAllEventListenersFromAllNodes();
-  }
-
-  d->m_bComplete = true; // to avoid calling completed() in finishedParsing() (David)
-  d->m_bLoadingMainResource = false;
-  d->m_bLoadEventEmitted = true; // don't want that one either
-  d->m_cachePolicy = CachePolicyVerify; // Why here?
-
-  if (d->m_doc && d->m_doc->parsing()) {
-    finishedParsing();
-    d->m_doc->setParsing(false);
-  }
-  
-  d->m_workingURL = KURL();
-
-  if (Document *doc = d->m_doc.get()) {
-    if (DocLoader *docLoader = doc->docLoader())
-      cache()->loader()->cancelRequests(docLoader);
-      XMLHttpRequest::cancelRequests(doc);
-  }
-
-  // tell all subframes to stop as well
-  for (Frame* child = tree()->firstChild(); child; child = child->tree()->nextSibling())
-      child->stopLoading(sendUnload);
-
-  d->m_bPendingChildRedirection = false;
-
-  cancelRedirection();
-}
-
-void Frame::stop()
-{
-    // http://bugzilla.opendarwin.org/show_bug.cgi?id=10854
-    // The frame's last ref may be remove and it be deleted by checkCompleted(), 
-    // so we'll add a protective refcount
-    RefPtr<Frame> protector(this);
-    
-    if (d->m_doc) {
-        if (d->m_doc->tokenizer())
-            d->m_doc->tokenizer()->stopParsing();
-        d->m_doc->finishParsing();
-    } else
-        // WebKit partially uses WebCore when loading non-HTML docs.  In these cases doc==nil, but
-        // WebCore is enough involved that we need to checkCompleted() in order for m_bComplete to
-        // become true.  An example is when a subframe is a pure text doc, and that subframe is the
-        // last one to complete.
-        checkCompleted();
-    if (d->m_iconLoader)
-        d->m_iconLoader->stopLoading();
-}
-
-bool Frame::closeURL()
-{
-    saveDocumentState();
-    stopLoading(true);
-    clearUndoRedoOperations();
-    return true;
-}
-
-void Frame::cancelRedirection(bool cancelWithLoadInProgress)
-{
-    if (d) {
-        d->m_cancelWithLoadInProgress = cancelWithLoadInProgress;
-        d->m_scheduledRedirection = noRedirectionScheduled;
-        stopRedirectionTimer();
-    }
-}
-
-#pragma mark END LOADING FUNCTIONS
-
 FrameLoader* Frame::loader() const
 {
     return d->m_loader;
 }
 
-KURL Frame::iconURL()
-{
-    // If this isn't a top level frame, return nothing
-    if (tree() && tree()->parent())
-        return "";
-        
-    // If we have an iconURL from a Link element, return that
-    if (document() && !document()->iconURL().isEmpty())
-        return KURL(document()->iconURL().deprecatedString());
-        
-    // Don't return a favicon iconURL unless we're http or https
-    if (d->m_url.protocol() != "http" && d->m_url.protocol() != "https")
-        return "";
-        
-    KURL url;
-    url.setProtocol(d->m_url.protocol());
-    url.setHost(d->m_url.host());
-    url.setPath("/favicon.ico");
-    return url;
-}
-
-bool Frame::didOpenURL(const KURL& url)
-{
-  if (d->m_scheduledRedirection == locationChangeScheduledDuringLoad) {
-    // A redirect was shceduled before the document was created. This can happen
-    // when one frame changes another frame's location.
-    return false;
-  }
-  
-  cancelRedirection();
-  editor()->setLastEditCommand(0);
-  closeURL();
-
-  d->m_bComplete = false;
-  d->m_bLoadingMainResource = true;
-  d->m_bLoadEventEmitted = false;
-
-  d->m_kjsStatusBarText = String();
-  d->m_kjsDefaultStatusBarText = String();
-
-  d->m_bJScriptEnabled = d->m_settings->isJavaScriptEnabled();
-  d->m_bJavaEnabled = d->m_settings->isJavaEnabled();
-  d->m_bPluginsEnabled = d->m_settings->isPluginsEnabled();
-
-  // initializing d->m_url to the new url breaks relative links when opening such a link after this call and _before_ begin() is called (when the first
-  // data arrives) (Simon)
-  d->m_url = url;
-  if (d->m_url.protocol().startsWith("http") && !d->m_url.host().isEmpty() && d->m_url.path().isEmpty())
-    d->m_url.setPath("/");
-  d->m_workingURL = d->m_url;
-
-  started();
-
-  return true;
-}
-
-void Frame::didExplicitOpen()
-{
-  d->m_bComplete = false;
-  d->m_bLoadEventEmitted = false;
-    
-  // Prevent window.open(url) -- eg window.open("about:blank") -- from blowing away results
-  // from a subsequent window.document.open / window.document.write call. 
-  // Cancelling redirection here works for all cases because document.open 
-  // implicitly precedes document.write.
-  cancelRedirection(); 
-  d->m_url = d->m_doc->URL();
-}
-
 FrameView* Frame::view() const
 {
     return d->m_view.get();
@@ -643,39 +266,6 @@ KJSProxy *Frame::scriptProxy()
     return d->m_jscript;
 }
 
-void Frame::replaceContentsWithScriptResult(const KURL& url)
-{
-    JSValue* ret = executeScript(0, KURL::decode_string(url.url().mid(strlen("javascript:"))));
-    String scriptResult;
-    if (getString(ret, scriptResult)) {
-        begin();
-        write(scriptResult);
-        end();
-    }
-}
-
-JSValue* Frame::executeScript(Node* n, const String& script, bool forceUserGesture)
-{
-  KJSProxy *proxy = scriptProxy();
-
-  if (!proxy)
-    return 0;
-
-  d->m_runningScripts++;
-  // If forceUserGesture is true, then make the script interpreter
-  // treat it as if triggered by a user gesture even if there is no
-  // current DOM event being processed.
-  JSValue* ret = proxy->evaluate(forceUserGesture ? DeprecatedString::null : d->m_url.url(), 0, script, n);
-  d->m_runningScripts--;
-
-  if (!d->m_runningScripts)
-      submitFormAgain();
-
-  Document::updateDocumentsRendering();
-
-  return ret;
-}
-
 bool Frame::javaEnabled() const
 {
     return d->m_settings->isJavaEnabled();
@@ -686,82 +276,6 @@ bool Frame::pluginsEnabled() const
     return d->m_bPluginsEnabled;
 }
 
-void Frame::setAutoLoadImages(bool enable)
-{
-  if (d->m_doc && d->m_doc->docLoader()->autoLoadImages() == enable)
-    return;
-
-  if (d->m_doc)
-    d->m_doc->docLoader()->setAutoLoadImages(enable);
-}
-
-bool Frame::autoLoadImages() const
-{
-  if (d->m_doc)
-    return d->m_doc->docLoader()->autoLoadImages();
-
-  return true;
-}
-
-void Frame::cancelAndClear()
-{
-    cancelRedirection();
-
-    if (!d->m_bComplete)
-        closeURL();
-
-    clear(false);
-}
-
-void Frame::clear(bool clearWindowProperties)
-{
-  if (d->m_bCleared)
-    return;
-  d->m_bCleared = true;
-  d->m_mousePressNode = 0;
-
-#if !PLATFORM(MAC)
-  // FIXME: This is a temporary hack to work around a mismatch between WebCore and WebKit
-  // regarding frame lifetime. The proper solution is to move all frame management
-  // into WebCore, so frames can work the same way on all platforms.
-  detachChildren();
-#endif
-
-  if (d->m_doc) {
-    d->m_doc->cancelParsing();
-    d->m_doc->detach();
-  }
-
-  // Moving past doc so that onUnload works.
-  if (clearWindowProperties && d->m_jscript)
-    d->m_jscript->clear();
-
-  if (d->m_view)
-    d->m_view->clear();
-
-  // do not drop the document before the jscript and view are cleared, as some destructors
-  // might still try to access the document.
-  d->m_doc = 0;
-  d->m_decoder = 0;
-
-  d->m_plugins.clear();
-  cleanupPluginObjects();
-  
-  d->m_scheduledRedirection = noRedirectionScheduled;
-  d->m_delayRedirect = 0;
-  d->m_redirectURL = DeprecatedString::null;
-  d->m_redirectReferrer = String();
-  d->m_redirectLockHistory = true;
-  d->m_redirectUserGesture = false;
-  d->m_bHTTPRefresh = false;
-  d->m_bFirstData = true;
-
-  d->m_bMousePressed = false;
-
-  if (!d->m_haveEncoding)
-    d->m_encoding = String();
-}
-
 Document *Frame::document() const
 {
     if (d)
@@ -780,567 +294,11 @@ void Frame::setDocument(Document* newDoc)
     }
 }
 
-void Frame::receivedFirstData()
-{
-    begin(d->m_workingURL);
-
-    d->m_doc->docLoader()->setCachePolicy(d->m_cachePolicy);
-    d->m_workingURL = KURL();
-
-    // When the first data arrives, the metadata has just been made available
-    DeprecatedString qData;
-
-    // Support for http-refresh
-    qData = d->m_metaData.get("http-refresh").deprecatedString();
-    if (!qData.isEmpty()) {
-      double delay;
-      int pos = qData.find(';');
-      if (pos == -1)
-        pos = qData.find(',');
-
-      if (pos == -1) {
-        delay = qData.stripWhiteSpace().toDouble();
-        // We want a new history item if the refresh timeout > 1 second
-        scheduleRedirection(delay, d->m_url.url(), delay <= 1);
-      } else {
-        int end_pos = qData.length();
-        delay = qData.left(pos).stripWhiteSpace().toDouble();
-        while (qData[++pos] == ' ');
-        if (qData.find("url", pos, false) == pos) {
-          pos += 3;
-          while (qData[pos] == ' ' || qData[pos] == '=')
-              pos++;
-          if (qData[pos] == '"') {
-              pos++;
-              int index = end_pos-1;
-              while (index > pos) {
-                if (qData[index] == '"')
-                    break;
-                index--;
-              }
-              if (index > pos)
-                end_pos = index;
-          }
-        }
-        // We want a new history item if the refresh timeout > 1 second
-        scheduleRedirection(delay, d->m_doc->completeURL(qData.mid(pos, end_pos)), delay <= 1);
-      }
-      d->m_bHTTPRefresh = true;
-    }
-
-    // Support for http last-modified
-    d->m_lastModified = d->m_metaData.get("modified");
-}
-
-void Frame::childBegin()
-{
-    // We need to do this when the child is created so as to avoid the parent thining the child
-    // is complete before it has even started loading.
-    // FIXME: do we really still need this?
-    d->m_bComplete = false;
-}
-
-void Frame::setResponseMIMEType(const String& contentType)
-{
-    d->m_responseMIMEType = contentType;
-}
-
-const String& Frame::responseMIMEType() const
-{
-    return d->m_responseMIMEType;
-}
-
-void Frame::begin()
-{
-    begin(KURL());
-}
-
-void Frame::begin(const KURL& url)
-{
-  if (d->m_workingURL.isEmpty())
-    createEmptyDocument(); // Creates an empty document if we don't have one already
-
-  clear();
-  partClearedInBegin();
-
-  d->m_bCleared = false;
-  d->m_bComplete = false;
-  d->m_bLoadEventEmitted = false;
-  d->m_bLoadingMainResource = true;
-
-  KURL ref(url);
-  ref.setUser(DeprecatedString());
-  ref.setPass(DeprecatedString());
-  ref.setRef(DeprecatedString());
-  d->m_referrer = ref.url();
-  d->m_url = url;
-  KURL baseurl;
-
-  if (!d->m_url.isEmpty())
-    baseurl = d->m_url;
-
-#ifdef SVG_SUPPORT
-  if (d->m_responseMIMEType == "image/svg+xml")
-    d->m_doc = DOMImplementation::instance()->createSVGDocument(d->m_view.get());
-  else
-#endif
-  if (DOMImplementation::isXMLMIMEType(d->m_responseMIMEType))
-    d->m_doc = DOMImplementation::instance()->createDocument(d->m_view.get());
-  else if (DOMImplementation::isTextMIMEType(d->m_responseMIMEType))
-    d->m_doc = new TextDocument(DOMImplementation::instance(), d->m_view.get());
-  else if ((d->m_responseMIMEType == "application/pdf" || d->m_responseMIMEType == "text/pdf") && PlugInInfoStore::supportsMIMEType(d->m_responseMIMEType))
-    d->m_doc = new PluginDocument(DOMImplementation::instance(), d->m_view.get());
-  else if (Image::supportsType(d->m_responseMIMEType))
-    d->m_doc = new ImageDocument(DOMImplementation::instance(), d->m_view.get());
-  else if (PlugInInfoStore::supportsMIMEType(d->m_responseMIMEType))
-    d->m_doc = new PluginDocument(DOMImplementation::instance(), d->m_view.get());
-  else if (inViewSourceMode())
-    d->m_doc = new HTMLViewSourceDocument(DOMImplementation::instance(), d->m_view.get());
-  else
-    d->m_doc = DOMImplementation::instance()->createHTMLDocument(d->m_view.get());
-
-  if (!d->m_doc->attached())
-    d->m_doc->attach();
-  d->m_doc->setURL(d->m_url.url());
-  // We prefer m_baseURL over d->m_url because d->m_url changes when we are
-  // about to load a new page.
-  d->m_doc->setBaseURL(baseurl.url());
-  if (d->m_decoder)
-    d->m_doc->setDecoder(d->m_decoder.get());
-
-  updatePolicyBaseURL();
-
-  setAutoLoadImages(d->m_settings->autoLoadImages());
-  const KURL& userStyleSheet = d->m_settings->userStyleSheetLocation();
-
-  if (!userStyleSheet.isEmpty())
-    setUserStyleSheetLocation(KURL(userStyleSheet));
-
-  restoreDocumentState();
-
-  d->m_doc->implicitOpen();
-
-  if (d->m_view)
-    d->m_view->resizeContents(0, 0);
-}
-
-void Frame::write(const char* str, int len)
-{
-    if (len == 0)
-        return;
-    
-    if (len == -1)
-        len = strlen(str);
-
-    if (Tokenizer* t = d->m_doc->tokenizer()) {
-        if (t->wantsRawData()) {
-            t->writeRawData(str, len);
-            return;
-        }
-    }
-    
-    if (!d->m_decoder) {
-        d->m_decoder = new TextResourceDecoder(d->m_responseMIMEType, settings()->encoding());
-        if (!d->m_encoding.isNull())
-            d->m_decoder->setEncoding(d->m_encoding,
-                d->m_haveEncoding ? TextResourceDecoder::UserChosenEncoding : TextResourceDecoder::EncodingFromHTTPHeader);
-        if (d->m_doc)
-            d->m_doc->setDecoder(d->m_decoder.get());
-    }
-
-    String decoded = d->m_decoder->decode(str, len);
-
-    if (decoded.isEmpty())
-        return;
-
-    if (d->m_bFirstData) {
-        d->m_bFirstData = false;
-        d->m_doc->determineParseMode(decoded);
-        if (d->m_decoder->encoding().usesVisualOrdering())
-            d->m_doc->setVisuallyOrdered();
-        d->m_doc->recalcStyle(Node::Force);
-    }
-
-    if (Tokenizer* t = d->m_doc->tokenizer()) {
-        ASSERT(!t->wantsRawData());
-        t->write(decoded, true);
-    }
-}
-
-void Frame::write(const String& str)
-{
-    if (str.isNull())
-        return;
-
-    if (d->m_bFirstData) {
-        // determine the parse mode
-        d->m_doc->setParseMode(Document::Strict);
-        d->m_bFirstData = false;
-    }
-    Tokenizer* t = d->m_doc->tokenizer();
-    if (t)
-        t->write(str, true);
-}
-
-void Frame::end()
-{
-    d->m_bLoadingMainResource = false;
-    endIfNotLoading();
-}
-
-void Frame::endIfNotLoading()
-{
-    // http://bugzilla.opendarwin.org/show_bug.cgi?id=10854
-    // The frame's last ref may be remove and it be deleted by checkCompleted(), 
-    // so we'll add a protective refcount
-    RefPtr<Frame> protector(this);
-    
-    if (d->m_bLoadingMainResource)
-        return;
-
-    // make sure nothing's left in there...
-    if (d->m_doc) {
-        if (d->m_decoder) {
-            String decoded = d->m_decoder->flush();
-            if (d->m_bFirstData) {
-                d->m_bFirstData = false;
-                d->m_doc->determineParseMode(decoded);
-            }
-            write(decoded);
-        }
-        d->m_doc->finishParsing();
-    } else
-        // WebKit partially uses WebCore when loading non-HTML docs.  In these cases doc==nil, but
-        // WebCore is enough involved that we need to checkCompleted() in order for m_bComplete to
-        // become true.  An example is when a subframe is a pure text doc, and that subframe is the
-        // last one to complete.
-        checkCompleted();
-    
-    // FIXME - Right now, we kick off the icon loader when the frame is done receiving all its main resource.
-    // We could kick off the icon loader after we're done parsing the HEAD element, if that becomes convinient to find
-    // at a future date
-    
-    // Don't load an icon if -
-    // 1) This is not the main frame 
-    // 2) The database is disabled
-    // 3) We have no valid icon URL
-    // 4) We already have an unexpired icon
-    
-    if (page()->mainFrame() != this)
-        return;
-        
-    if (IconDatabase* sharedIconDatabase = IconDatabase::sharedIconDatabase()) {
-        if (!sharedIconDatabase->enabled())
-            return;
-        
-        String url(iconURL().url());
-        if (url.isEmpty())
-            return;
-        
-        // If we already have an unexpired icon, we won't kick off a load but we *will* map the appropriate URLs to it
-        if (sharedIconDatabase->hasEntryForIconURL(url) && !isLoadTypeReload() && !sharedIconDatabase->isIconExpiredForIconURL(url)) {
-            commitIconURLToIconDatabase(iconURL());
-            return;
-        }
-        
-        if (!d->m_iconLoader)
-            d->m_iconLoader = IconLoader::create(this).release();
-        d->m_iconLoader->startLoading();
-    }
-}
-
-void Frame::commitIconURLToIconDatabase(const KURL& icon)
-{
-    IconDatabase* iconDatabase = IconDatabase::sharedIconDatabase();
-    ASSERT(iconDatabase);
-    iconDatabase->setIconURLForPageURL(icon.url(), this->url().url());
-    iconDatabase->setIconURLForPageURL(icon.url(), originalRequestURL().url());
-}
-
-void Frame::gotoAnchor()
-{
-    // If our URL has no ref, then we have no place we need to jump to.
-    if (!d->m_url.hasRef())
-        return;
-
-    DeprecatedString ref = d->m_url.encodedHtmlRef();
-    if (!gotoAnchor(ref)) {
-        // Can't use htmlRef() here because it doesn't know which encoding to use to decode.
-        // Decoding here has to match encoding in completeURL, which means it has to use the
-        // page's encoding rather than UTF-8.
-        if (d->m_decoder)
-            gotoAnchor(KURL::decode_string(ref, d->m_decoder->encoding()));
-    }
-}
-
-void Frame::finishedParsing()
-{
-  // This method can be called from our destructor, in which case we shouldn't protect ourselves
-  // because doing so will cause us to re-enter our destructor when protector goes out of scope.
-  RefPtr<Frame> protector = refCount() > 0 ? this : 0;
-  checkCompleted();
-
-  if (!d->m_view)
-    return; // We are being destroyed by something checkCompleted called.
-
-  // check if the scrollbars are really needed for the content
-  // if not, remove them, relayout, and repaint
-
-  d->m_view->restoreScrollbar();
-  gotoAnchor();
-}
-
-void Frame::loadDone()
-{
-    if (d->m_doc)
-        checkCompleted();
-}
-
-void Frame::checkCompleted()
-{
-  // Any frame that hasn't completed yet ?
-  for (Frame* child = tree()->firstChild(); child; child = child->tree()->nextSibling())
-      if (!child->d->m_bComplete)
-          return;
-
-  // Have we completed before?
-  if (d->m_bComplete)
-      return;
-
-  // Are we still parsing?
-  if (d->m_doc && d->m_doc->parsing())
-      return;
-
-  // Still waiting for images/scripts from the loader ?
-  int requests = 0;
-  if (d->m_doc && d->m_doc->docLoader())
-      requests = cache()->loader()->numRequests(d->m_doc->docLoader());
-
-  if (requests > 0)
-      return;
-
-  // OK, completed.
-  // Now do what should be done when we are really completed.
-  d->m_bComplete = true;
-
-  checkEmitLoadEvent(); // if we didn't do it before
-
-  if (d->m_scheduledRedirection != noRedirectionScheduled) {
-      // Do not start redirection for frames here! That action is
-      // deferred until the parent emits a completed signal.
-      if (!tree()->parent())
-          startRedirectionTimer();
-
-      completed(true);
-  } else {
-      completed(d->m_bPendingChildRedirection);
-  }
-}
-
-void Frame::checkEmitLoadEvent()
-{
-    if (d->m_bLoadEventEmitted || !d->m_doc || d->m_doc->parsing())
-        return;
-
-    for (Frame* child = tree()->firstChild(); child; child = child->tree()->nextSibling())
-        if (!child->d->m_bComplete) // still got a frame running -> too early
-            return;
-
-    // All frames completed -> set their domain to the frameset's domain
-    // This must only be done when loading the frameset initially (#22039),
-    // not when following a link in a frame (#44162).
-    if (d->m_doc) {
-        String domain = d->m_doc->domain();
-        for (Frame* child = tree()->firstChild(); child; child = child->tree()->nextSibling())
-            if (child->d->m_doc)
-                child->d->m_doc->setDomain(domain);
-    }
-
-    d->m_bLoadEventEmitted = true;
-    d->m_bUnloadEventEmitted = false;
-    if (d->m_doc)
-        d->m_doc->implicitClose();
-}
-
 const Settings *Frame::settings() const
 {
   return d->m_settings;
 }
 
-KURL Frame::baseURL() const
-{
-    if (!d->m_doc)
-        return KURL();
-    return d->m_doc->baseURL();
-}
-
-String Frame::baseTarget() const
-{
-    if (!d->m_doc)
-        return String();
-    return d->m_doc->baseTarget();
-}
-
-KURL Frame::completeURL(const DeprecatedString& url)
-{
-    if (!d->m_doc)
-        return url;
-
-    return KURL(d->m_doc->completeURL(url));
-}
-
-void Frame::scheduleRedirection(double delay, const DeprecatedString& url, bool doLockHistory)
-{
-    if (delay < 0 || delay > INT_MAX / 1000)
-      return;
-    if (d->m_scheduledRedirection == noRedirectionScheduled || delay <= d->m_delayRedirect)
-    {
-       d->m_scheduledRedirection = redirectionScheduled;
-       d->m_delayRedirect = delay;
-       d->m_redirectURL = url;
-       d->m_redirectReferrer = String();
-       d->m_redirectLockHistory = doLockHistory;
-       d->m_redirectUserGesture = false;
-
-       stopRedirectionTimer();
-       if (d->m_bComplete)
-         startRedirectionTimer();
-    }
-}
-
-void Frame::scheduleLocationChange(const DeprecatedString& url, const String& referrer, bool lockHistory, bool userGesture)
-{
-    KURL u(url);
-    
-    // If the URL we're going to navigate to is the same as the current one, except for the
-    // fragment part, we don't need to schedule the location change.
-    if (u.hasRef() && equalIgnoringRef(d->m_url, u)) {
-        changeLocation(url, referrer, lockHistory, userGesture);
-        return;
-    }
-        
-    // Handle a location change of a page with no document as a special case.
-    // This may happen when a frame changes the location of another frame.
-    d->m_scheduledRedirection = d->m_doc ? locationChangeScheduled : locationChangeScheduledDuringLoad;
-    
-    // If a redirect was scheduled during a load, then stop the current load.
-    // Otherwise when the current load transitions from a provisional to a 
-    // committed state, pending redirects may be cancelled. 
-    if (d->m_scheduledRedirection == locationChangeScheduledDuringLoad) {
-        stopLoading(true);   
-    }
-
-    d->m_delayRedirect = 0;
-    d->m_redirectURL = url;
-    d->m_redirectReferrer = referrer;
-    d->m_redirectLockHistory = lockHistory;
-    d->m_redirectUserGesture = userGesture;
-    stopRedirectionTimer();
-    if (d->m_bComplete)
-        startRedirectionTimer();
-}
-
-void Frame::scheduleRefresh(bool userGesture)
-{
-    // Handle a location change of a page with no document as a special case.
-    // This may happen when a frame requests a refresh of another frame.
-    d->m_scheduledRedirection = d->m_doc ? locationChangeScheduled : locationChangeScheduledDuringLoad;
-    
-    // If a refresh was scheduled during a load, then stop the current load.
-    // Otherwise when the current load transitions from a provisional to a 
-    // committed state, pending redirects may be cancelled. 
-    if (d->m_scheduledRedirection == locationChangeScheduledDuringLoad)
-        stopLoading(true);   
-
-    d->m_delayRedirect = 0;
-    d->m_redirectURL = url().url();
-    d->m_redirectReferrer = referrer();
-    d->m_redirectLockHistory = true;
-    d->m_redirectUserGesture = userGesture;
-    d->m_cachePolicy = CachePolicyRefresh;
-    stopRedirectionTimer();
-    if (d->m_bComplete)
-        startRedirectionTimer();
-}
-
-bool Frame::isScheduledLocationChangePending() const
-{
-    switch (d->m_scheduledRedirection) {
-        case noRedirectionScheduled:
-        case redirectionScheduled:
-            return false;
-        case historyNavigationScheduled:
-        case locationChangeScheduled:
-        case locationChangeScheduledDuringLoad:
-            return true;
-    }
-    return false;
-}
-
-void Frame::scheduleHistoryNavigation(int steps)
-{
-    // navigation will always be allowed in the 0 steps case, which is OK because
-    // that's supposed to force a reload.
-    if (!canGoBackOrForward(steps)) {
-        cancelRedirection();
-        return;
-    }
-
-    // If the URL we're going to navigate to is the same as the current one, except for the
-    // fragment part, we don't need to schedule the navigation.
-    if (equalIgnoringRef(d->m_url, historyURL(steps))) {
-        goBackOrForward(steps);
-        return;
-    }
-    
-    d->m_scheduledRedirection = historyNavigationScheduled;
-    d->m_delayRedirect = 0;
-    d->m_redirectURL = DeprecatedString::null;
-    d->m_redirectReferrer = String();
-    d->m_scheduledHistoryNavigationSteps = steps;
-    stopRedirectionTimer();
-    if (d->m_bComplete)
-        startRedirectionTimer();
-}
-
-void Frame::redirectionTimerFired(Timer<Frame>*)
-{
-    if (d->m_scheduledRedirection == historyNavigationScheduled) {
-        d->m_scheduledRedirection = noRedirectionScheduled;
-
-        // Special case for go(0) from a frame -> reload only the frame
-        // go(i!=0) from a frame navigates into the history of the frame only,
-        // in both IE and NS (but not in Mozilla).... we can't easily do that
-        // in Konqueror...
-        if (d->m_scheduledHistoryNavigationSteps == 0)
-            urlSelected(url(), "", 0);
-        else
-            goBackOrForward(d->m_scheduledHistoryNavigationSteps);
-        return;
-    }
-
-    DeprecatedString URL = d->m_redirectURL;
-    String referrer = d->m_redirectReferrer;
-    bool lockHistory = d->m_redirectLockHistory;
-    bool userGesture = d->m_redirectUserGesture;
-
-    d->m_scheduledRedirection = noRedirectionScheduled;
-    d->m_delayRedirect = 0;
-    d->m_redirectURL = DeprecatedString::null;
-    d->m_redirectReferrer = String();
-
-    changeLocation(URL, referrer, lockHistory, userGesture);
-}
-
-String Frame::encoding() const
-{
-    if (d->m_haveEncoding && !d->m_encoding.isEmpty())
-        return d->m_encoding;
-    if (d->m_decoder && d->m_decoder->encoding().isValid())
-        return d->m_decoder->encoding().name();
-    return settings()->encoding();
-}
-
 void Frame::setUserStyleSheetLocation(const KURL& url)
 {
     delete d->m_userStyleSheetLoader;
@@ -1357,51 +315,6 @@ void Frame::setUserStyleSheet(const String& styleSheet)
         d->m_doc->setUserStyleSheet(styleSheet);
 }
 
-bool Frame::gotoAnchor(const String& name)
-{
-  if (!d->m_doc)
-    return false;
-
-  Node *n = d->m_doc->getElementById(AtomicString(name));
-  if (!n)
-      n = d->m_doc->anchors()->namedItem(name, !d->m_doc->inCompatMode());
-
-  d->m_doc->setCSSTarget(n); // Setting to null will clear the current target.
-  
-  // Implement the rule that "" and "top" both mean top of page as in other browsers.
-  if (!n && !(name.isEmpty() || name.lower() == "top"))
-      return false;
-
-  // We need to update the layout before scrolling, otherwise we could
-  // really mess things up if an anchor scroll comes at a bad moment.
-  if (d->m_doc) {
-    d->m_doc->updateRendering();
-    // Only do a layout if changes have occurred that make it necessary.      
-    if (d->m_view && d->m_doc->renderer() && d->m_doc->renderer()->needsLayout()) {
-      d->m_view->layout();
-    }
-  }
-  
-  // Scroll nested layers and frames to reveal the anchor.
-  RenderObject *renderer;
-  IntRect rect;
-  if (n) {
-      renderer = n->renderer();
-      rect = n->getRect();
-  } else {
-    // If there's no node, we should scroll to the top of the document.
-      renderer = d->m_doc->renderer();
-      rect = IntRect();
-  }
-
-  if (renderer) {
-    // Align to the top and to the closest side (this matches other browsers).
-    renderer->enclosingLayer()->scrollRectToVisible(rect, RenderLayer::gAlignToEdgeIfNeeded, RenderLayer::gAlignTopAlways);
-  }
-  
-  return true;
-}
-
 void Frame::setStandardFont(const String& name)
 {
     d->m_settings->setStdFontName(AtomicString(name));
@@ -1597,96 +510,6 @@ void Frame::paintDragCaret(GraphicsContext* p, const IntRect& rect) const
         dragCaretController->paintCaret(p, rect);
 }
 
-bool Frame::requestObject(RenderPart* renderer, const String& url, const AtomicString& frameName,
-                          const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues)
-{
-    KURL completedURL;
-    if (!url.isEmpty())
-        completedURL = completeURL(url.deprecatedString());
-    
-    if (url.isEmpty() && mimeType.isEmpty())
-        return true;
-    
-    bool useFallback;
-    if (shouldUsePlugin(renderer->element(), completedURL, mimeType, renderer->hasFallbackContent(), useFallback))
-        return loadPlugin(renderer, completedURL, mimeType, paramNames, paramValues, useFallback);
-
-    ASSERT(renderer->node()->hasTagName(objectTag) || renderer->node()->hasTagName(embedTag));
-    AtomicString uniqueFrameName = tree()->uniqueChildName(frameName);
-    static_cast<HTMLPlugInElement*>(renderer->node())->setFrameName(uniqueFrameName);
-    
-    // FIXME: ok to always make a new one? when does the old frame get removed?
-    return loadSubframe(static_cast<Element*>(renderer->node()), completedURL, uniqueFrameName, d->m_referrer);
-}
-
-bool Frame::shouldUsePlugin(Node* element, const KURL& url, const String& mimeType, bool hasFallback, bool& useFallback)
-{
-    useFallback = false;
-    ObjectContentType objectType = objectContentType(url, mimeType);
-
-    // if an object's content can't be handled and it has no fallback, let
-    // it be handled as a plugin to show the broken plugin icon
-    if (objectType == ObjectContentNone && hasFallback)
-        useFallback = true;
-
-    return objectType == ObjectContentNone || objectType == ObjectContentPlugin;
-}
-
-
-bool Frame::loadPlugin(RenderPart *renderer, const KURL& url, const String& mimeType, 
-                       const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback)
-{
-    if (useFallback) {
-        checkEmitLoadEvent();
-        return false;
-    }
-
-    Element *pluginElement;
-    if (renderer && renderer->node() && renderer->node()->isElementNode())
-        pluginElement = static_cast<Element*>(renderer->node());
-    else
-        pluginElement = 0;
-        
-    Plugin* plugin = createPlugin(pluginElement, url, paramNames, paramValues, mimeType);
-    if (!plugin) {
-        checkEmitLoadEvent();
-        return false;
-    }
-    d->m_plugins.append(plugin);
-    
-    if (renderer && plugin->view())
-        renderer->setWidget(plugin->view());
-    
-    checkEmitLoadEvent();
-    
-    return true;
-}
-
-void Frame::clearRecordedFormValues()
-{
-    d->m_formAboutToBeSubmitted = 0;
-    d->m_formValuesAboutToBeSubmitted.clear();
-}
-
-void Frame::recordFormValue(const String& name, const String& value, PassRefPtr<HTMLFormElement> element)
-{
-    d->m_formAboutToBeSubmitted = element;
-    d->m_formValuesAboutToBeSubmitted.set(name, value);
-}
-
-void Frame::parentCompleted()
-{
-    if (d->m_scheduledRedirection != noRedirectionScheduled && !d->m_redirectionTimer.isActive())
-        startRedirectionTimer();
-}
-
-void Frame::childCompleted(bool complete)
-{
-    if (complete && !tree()->parent())
-        d->m_bPendingChildRedirection = true;
-    checkCompleted();
-}
-
 int Frame::zoomFactor() const
 {
   return d->m_zoomFactor;
@@ -1731,19 +554,10 @@ String Frame::jsDefaultStatusBarText() const
    return d->m_kjsDefaultStatusBarText;
 }
 
-String Frame::referrer() const
-{
-    return d->m_referrer;
-}
-
-String Frame::lastModified() const
-{
-    return d->m_lastModified;
-}
-
 void Frame::reparseConfiguration()
 {
-    setAutoLoadImages(d->m_settings->autoLoadImages());
+    if (d->m_doc)
+        d->m_doc->docLoader()->setAutoLoadImages(d->m_settings->autoLoadImages());
         
     d->m_bJScriptEnabled = d->m_settings->isJavaScriptEnabled();
     d->m_bJavaEnabled = d->m_settings->isJavaEnabled();
@@ -1758,14 +572,13 @@ void Frame::reparseConfiguration()
     // FIXME: It's not entirely clear why the following is needed.
     // The document automatically does this as required when you set the style sheet.
     // But we had problems when this code was removed. Details are in
-    // <http://bugzilla.opendarwin.org/show_bug.cgi?id=8079>.
+    // <http://bugs.webkit.org/show_bug.cgi?id=8079>.
     if (d->m_doc)
         d->m_doc->updateStyleSelector();
 }
 
 bool Frame::shouldDragAutoNode(Node *node, const IntPoint& point) const
 {
-    // No KDE impl yet
     return false;
 }
 
@@ -2133,43 +946,6 @@ void Frame::clearTypingStyle()
     d->m_typingStyle = 0;
 }
 
-JSValue* Frame::executeScript(const String& filename, int baseLine, Node* n, const String& script)
-{
-    // FIXME: This is missing stuff that the other executeScript has.
-    // --> d->m_runningScripts and submitFormAgain.
-    // Why is that OK?
-    KJSProxy* proxy = scriptProxy();
-    if (!proxy)
-        return 0;
-    JSValue* ret = proxy->evaluate(filename, baseLine, script, n);
-    Document::updateDocumentsRendering();
-    return ret;
-}
-
-Frame *Frame::opener()
-{
-    return d->m_opener;
-}
-
-void Frame::setOpener(Frame* opener)
-{
-    if (d->m_opener)
-        d->m_opener->d->m_openedFrames.remove(this);
-    if (opener)
-        opener->d->m_openedFrames.add(this);
-    d->m_opener = opener;
-}
-
-bool Frame::openedByJS()
-{
-    return d->m_openedByJS;
-}
-
-void Frame::setOpenedByJS(bool _openedByJS)
-{
-    d->m_openedByJS = _openedByJS;
-}
-
 bool Frame::tabsToLinks() const
 {
     return true;
@@ -2548,39 +1324,11 @@ void Frame::setMouseDownMayStartDrag(bool b)
     d->m_mouseDownMayStartDrag = b;
 }
 
-void Frame::handleFallbackContent()
-{
-    Element* owner = ownerElement();
-    if (!owner || !owner->hasTagName(objectTag))
-        return;
-    static_cast<HTMLObjectElement*>(owner)->renderFallbackContent();
-}
-
 void Frame::setSettings(Settings *settings)
 {
     d->m_settings = settings;
 }
 
-void Frame::provisionalLoadStarted()
-{
-    // we don't want to wait until we get an actual http response back
-    // to cancel pending redirects, otherwise they might fire before
-    // that happens.
-    cancelRedirection(true);
-}
-
-bool Frame::userGestureHint()
-{
-    Frame *rootFrame = this;
-    while (rootFrame->tree()->parent())
-        rootFrame = rootFrame->tree()->parent();
-
-    if (rootFrame->scriptProxy())
-        return rootFrame->scriptProxy()->interpreter()->wasRunByUserGesture();
-
-    return true; // If JavaScript is disabled, a user gesture must have initiated the navigation
-}
-
 RenderObject *Frame::renderer() const
 {
     Document *doc = document();
@@ -2627,12 +1375,6 @@ bool Frame::isFrameSet() const
     return body && body->renderer() && body->hasTagName(framesetTag);
 }
 
-void Frame::didNotOpenURL(const KURL& URL)
-{
-    if (d->m_submittedFormURL == URL)
-        d->m_submittedFormURL = KURL();
-}
-
 // Scans logically forward from "start", including any child frames
 static HTMLFormElement *scanForForm(Node *start)
 {
@@ -2673,22 +1415,6 @@ HTMLFormElement *Frame::currentForm() const
     return start ? scanForForm(start) : 0;
 }
 
-void Frame::setEncoding(const String& name, bool userChosen)
-{
-    if (!d->m_workingURL.isEmpty())
-        receivedFirstData();
-    d->m_encoding = name;
-    d->m_haveEncoding = userChosen;
-}
-
-void Frame::addData(const char *bytes, int length)
-{
-    ASSERT(d->m_workingURL.isEmpty());
-    ASSERT(d->m_doc);
-    ASSERT(d->m_doc->parsing());
-    write(bytes, length);
-}
-
 // FIXME: should this go in SelectionController?
 void Frame::revealSelection(const RenderLayer::ScrollAlignment& alignment) const
 {
@@ -2898,98 +1624,6 @@ void Frame::adjustPageHeight(float *newBottom, float oldTop, float oldBottom, fl
 
 #endif
 
-PausedTimeouts *Frame::pauseTimeouts()
-{
-#ifdef SVG_SUPPORT
-    if (d->m_doc && d->m_doc->svgExtensions())
-        d->m_doc->accessSVGExtensions()->pauseAnimations();
-#endif
-
-    if (d->m_doc && d->m_jscript) {
-        if (Window* w = Window::retrieveWindow(this))
-            return w->pauseTimeouts();
-    }
-    return 0;
-}
-
-void Frame::resumeTimeouts(PausedTimeouts* t)
-{
-#ifdef SVG_SUPPORT
-    if (d->m_doc && d->m_doc->svgExtensions())
-        d->m_doc->accessSVGExtensions()->unpauseAnimations();
-#endif
-
-    if (d->m_doc && d->m_jscript && d->m_bJScriptEnabled) {
-        if (Window* w = Window::retrieveWindow(this))
-            w->resumeTimeouts(t);
-    }
-}
-
-bool Frame::canCachePage()
-{
-    // Only save page state if:
-    // 1.  We're not a frame or frameset.
-    // 2.  The page has no unload handler.
-    // 3.  The page has no password fields.
-    // 4.  The URL for the page is not https.
-    // 5.  The page has no applets.
-    if (tree()->childCount() || d->m_plugins.size() ||
-        tree()->parent() ||
-        d->m_url.protocol().startsWith("https") || 
-        (d->m_doc && (d->m_doc->applets()->length() != 0 ||
-                      d->m_doc->hasWindowEventListener(unloadEvent) ||
-                      d->m_doc->hasPasswordField()))) {
-        return false;
-    }
-    return true;
-}
-
-void Frame::saveWindowProperties(KJS::SavedProperties *windowProperties)
-{
-    Window *window = Window::retrieveWindow(this);
-    if (window)
-        window->saveProperties(*windowProperties);
-}
-
-void Frame::saveLocationProperties(SavedProperties *locationProperties)
-{
-    Window *window = Window::retrieveWindow(this);
-    if (window) {
-        JSLock lock;
-        Location *location = window->location();
-        location->saveProperties(*locationProperties);
-    }
-}
-
-void Frame::restoreWindowProperties(SavedProperties *windowProperties)
-{
-    Window *window = Window::retrieveWindow(this);
-    if (window)
-        window->restoreProperties(*windowProperties);
-}
-
-void Frame::restoreLocationProperties(SavedProperties *locationProperties)
-{
-    Window *window = Window::retrieveWindow(this);
-    if (window) {
-        JSLock lock;
-        Location *location = window->location();
-        location->restoreProperties(*locationProperties);
-    }
-}
-
-void Frame::saveInterpreterBuiltins(SavedBuiltins& interpreterBuiltins)
-{
-    if (scriptProxy())
-        scriptProxy()->interpreter()->saveBuiltins(interpreterBuiltins);
-}
-
-void Frame::restoreInterpreterBuiltins(const SavedBuiltins& interpreterBuiltins)
-{
-    if (scriptProxy())
-        scriptProxy()->interpreter()->restoreBuiltins(interpreterBuiltins);
-}
-
 Frame *Frame::frameForWidget(const Widget *widget)
 {
     ASSERT_ARG(widget, widget);
@@ -3025,22 +1659,6 @@ void Frame::clearDocumentFocus(Widget *widget)
     node->document()->setFocusNode(0);
 }
 
-void Frame::updatePolicyBaseURL()
-{
-    if (tree()->parent() && tree()->parent()->document())
-        setPolicyBaseURL(tree()->parent()->document()->policyBaseURL());
-    else
-        setPolicyBaseURL(d->m_url.url());
-}
-
-void Frame::setPolicyBaseURL(const String& s)
-{
-    if (document())
-        document()->setPolicyBaseURL(s);
-    for (Frame* child = tree()->firstChild(); child; child = child->tree()->nextSibling())
-        child->setPolicyBaseURL(s);
-}
-
 void Frame::forceLayout()
 {
     FrameView *v = d->m_view.get();
@@ -3098,26 +1716,6 @@ void Frame::sendScrollEvent()
     }
 }
 
-void Frame::addMetaData(const String& key, const String& value)
-{
-    d->m_metaData.set(key, value);
-}
-
-// This does the same kind of work that Frame::openURL does, except it relies on the fact
-// that a higher level already checked that the URLs match and the scrolling is the right thing to do.
-void Frame::scrollToAnchor(const KURL& URL)
-{
-    d->m_url = URL;
-    started();
-    
-    gotoAnchor();
-    
-    // It's important to model this as a load that starts and immediately finishes.
-    // Otherwise, the parent frame may think we never finished loading.
-    d->m_bComplete = false;
-    checkCompleted();
-}
-
 bool Frame::canMouseDownStartSelect(Node* node)
 {
     if (!node || !node->renderer())
@@ -3189,12 +1787,6 @@ RenderStyle *Frame::styleForSelectionStart(Node *&nodeToRemove) const
     return styleElement->renderer()->style();
 }
 
-void Frame::setMediaType(const String& type)
-{
-    if (d->m_view)
-        d->m_view->setMediaType(type);
-}
-
 void Frame::setSelectionFromNone()
 {
     // Put a caret inside the body if the entire frame is editable (either the 
@@ -3416,7 +2008,7 @@ void Frame::prepareForUserAction()
 {
     // Reset the multiple form submission protection code.
     // We'll let you submit the same form twice if you do two separate user actions.
-    d->m_submittedFormURL = KURL();
+    loader()->resetMultipleFormSubmissionProtection();
 }
 
 Node *Frame::mousePressNode()
@@ -3424,16 +2016,6 @@ Node *Frame::mousePressNode()
     return d->m_mousePressNode.get();
 }
 
-bool Frame::isComplete() const
-{
-    return d->m_bComplete;
-}
-
-bool Frame::isLoadingMainResource() const
-{
-    return d->m_bLoadingMainResource;
-}
-
 FrameTree* Frame::tree() const
 {
     return &d->m_treeNode;
@@ -3447,40 +2029,6 @@ DOMWindow* Frame::domWindow() const
     return d->m_domWindow.get();
 }
 
-KURL Frame::url() const
-{
-    return d->m_url;
-}
-
-void Frame::startRedirectionTimer()
-{
-    d->m_redirectionTimer.startOneShot(d->m_delayRedirect);
-}
-
-void Frame::stopRedirectionTimer()
-{
-    d->m_redirectionTimer.stop();
-}
-
-void Frame::frameDetached()
-{
-}
-
-void Frame::detachChildren()
-{
-    // FIXME: is it really necessary to do this in reverse order any more?
-    while (Frame* child = tree()->lastChild())
-        tree()->removeChild(child);
-}
-
-void Frame::updateBaseURLForEmptyDocument()
-{
-    Element* owner = ownerElement();
-    // FIXME: Should embed be included?
-    if (owner && (owner->hasTagName(iframeTag) || owner->hasTagName(objectTag) || owner->hasTagName(embedTag)))
-        d->m_doc->setBaseURL(tree()->parent()->d->m_doc->baseURL());
-}
-
 Page* Frame::page() const
 {
     return d->m_page;
@@ -3496,27 +2044,10 @@ void Frame::pageDestroyed()
             w->disconnectFrame();
 }
 
-void Frame::completed(bool complete)
-{
-    ref();
-    for (Frame* child = tree()->firstChild(); child; child = child->tree()->nextSibling())
-        child->parentCompleted();
-    if (Frame* parent = tree()->parent())
-        parent->childCompleted(complete);
-    submitFormAgain();
-    deref();
-}
-
 void Frame::setStatusBarText(const String&)
 {
 }
 
-void Frame::started()
-{
-    for (Frame* frame = this; frame; frame = frame->tree()->parent())
-        frame->d->m_bComplete = false;
-}
-
 void Frame::disconnectOwnerElement()
 {
     if (d->m_ownerElement && d->m_page)
@@ -3534,11 +2065,6 @@ String Frame::documentTypeString() const
     return String();
 }
 
-bool Frame::containsPlugins() const 
-{ 
-    return d->m_plugins.size() != 0;
-}
-
 bool Frame::prohibitsScrolling() const
 {
     return d->m_prohibitsScrolling;
@@ -3554,25 +2080,11 @@ FramePrivate::FramePrivate(Page* page, Frame* parent, Frame* thisFrame, Element*
     , m_treeNode(thisFrame, parent)
     , m_ownerElement(ownerElement)
     , m_jscript(0)
-    , m_runningScripts(0)
     , m_bJScriptEnabled(true)
     , m_bJavaEnabled(true)
     , m_bPluginsEnabled(true)
     , m_settings(0)
-    , m_bComplete(true)
-    , m_bLoadingMainResource(false)
-    , m_bLoadEventEmitted(true)
-    , m_bUnloadEventEmitted(true)
-    , m_haveEncoding(false)
-    , m_bHTTPRefresh(false)
-    , m_redirectLockHistory(false)
-    , m_redirectUserGesture(false)
-    , m_cachePolicy(CachePolicyVerify)
-    , m_redirectionTimer(thisFrame, &Frame::redirectionTimerFired)
-    , m_scheduledRedirection(noRedirectionScheduled)
-    , m_delayRedirect(0)
     , m_zoomFactor(parent ? parent->d->m_zoomFactor : 100)
-    , m_submitForm(0)
     , m_bMousePressed(false)
     , m_beganSelectingText(false)
     , m_selectionController(thisFrame)
@@ -3581,18 +2093,10 @@ FramePrivate::FramePrivate(Page* page, Frame* parent, Frame* thisFrame, Element*
     , m_command(thisFrame)
     , m_caretVisible(false)
     , m_caretPaint(true)
-    , m_bFirstData(true)
-    , m_bCleared(true)
     , m_isActive(false)
-    , m_opener(0)
-    , m_openedByJS(false)
-    , m_bPendingChildRedirection(false)
-    , m_executingJavaScriptFormAction(false)
-    , m_cancelWithLoadInProgress(false)
     , m_lifeSupportTimer(thisFrame, &Frame::lifeSupportTimerFired)
     , m_loader(new FrameLoader(thisFrame))
     , m_userStyleSheetLoader(0)
-    , m_iconLoader(0)
     , m_autoscrollTimer(thisFrame, &Frame::autoscrollTimerFired)
     , m_autoscrollRenderer(0)
     , m_mouseDownMayStartAutoscroll(false)
@@ -3611,7 +2115,6 @@ FramePrivate::~FramePrivate()
 {
     delete m_jscript;
     delete m_loader;
-    delete m_iconLoader;
 }
 
 } // namespace WebCore