JavaScriptCore:
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 29 Oct 2006 06:48:02 +0000 (06:48 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 29 Oct 2006 06:48:02 +0000 (06:48 +0000)
        Reviewed by Maciej.

        - renamed PassRefPtr::release to releaseRef to make it clearer that
          it's the counterpart of adoptRef, and to make it harder to confuse
          it with the safer-to-use RefPtr::release

        * kjs/identifier.cpp:
        (KJS::CStringTranslator::translate):
        (KJS::UCharBufferTranslator::translate):
        * kjs/ustring.cpp:
        (KJS::UString::Rep::create):
        * wtf/PassRefPtr.h:
        (WTF::PassRefPtr::PassRefPtr):
        (WTF::PassRefPtr::~PassRefPtr):
        (WTF::PassRefPtr::get):
        (WTF::PassRefPtr::releaseRef):
        (WTF::PassRefPtr::operator->):
        (WTF::PassRefPtr::operator=):
        (WTF::adoptRef):
        (WTF::static_pointer_cast):
        (WTF::const_pointer_cast):
        * wtf/RefPtr.h:
        (WTF::RefPtr::RefPtr):
        (WTF::RefPtr::operator=):

WebCore:

        Reviewed by Maciej.

        - eliminated the use of Objective-C for the policy decider
          machinery, obviating the need for WebPolicyDecider,
          WebCoreFrameLoaderAsDelegate, and
          WebCoreMainResourceLoaderAsPolicyDelegate

        - grouped the state related to policy decisions into a PolicyCheck
          class to simplify the FrameLoader logic

        - removed six methods from the bridge, reducing FrameLoader's use of
          the bridge to a single method

        - changed form state to always use HashMap instead of NSDictionary

        - moved the defersLoading flag from WebView to WebCore::Page
          and changed code to consistently call it defersLoading rather
          than defersCallbacks

        - updated for rename of PassRefPtr::release to releaseRef
        - replaced all uses of __APPLE__ with appropriate PLATFORM defines
        - cleaned up kjs_binding.h a bit
        - cleaned up FrameMac.h a bit

        * loader/mac/WebPolicyDecider.h: Removed.
        * loader/mac/WebPolicyDecider.mm: Removed.
        * WebCore.xcodeproj/project.pbxproj: Updated for removal.

        * WebCore.exp:
        * bindings/js/kjs_binding.cpp:
        (KJS::ScriptInterpreter::ScriptInterpreter):
        (KJS::ScriptInterpreter::wasRunByUserGesture):
        * bindings/js/kjs_binding.h:
        (KJS::ScriptInterpreter::setCurrentEvent):
        (KJS::ScriptInterpreter::setInlineCode):
        (KJS::ScriptInterpreter::setProcessingTimerCallback):
        (KJS::ScriptInterpreter::getCurrentEvent):
        (KJS::cacheDOMObject):
        (KJS::DOMExceptionTranslator::DOMExceptionTranslator):
        * bridge/AXObjectCache.h:
        * bridge/mac/BrowserExtensionMac.mm:
        (WebCore::BrowserExtensionMac::createNewWindow):
        * bridge/mac/FrameMac.h:
        * bridge/mac/FrameMac.mm:
        (WebCore::FrameMac::loadRequest):
        (WebCore::FrameMac::submitForm):
        (WebCore::FrameMac::urlSelected):
        (WebCore::FrameMac::userAgent):
        (WebCore::FrameMac::passMouseDownEventToWidget):
        (WebCore::FrameMac::handleMouseMoveEvent):
        * bridge/mac/PageMac.mm:
        (WebCore::Page::Page):
        * bridge/mac/WebCoreEditCommand.mm:
        * bridge/mac/WebCoreFrameBridge.h:
        * bridge/mac/WebCoreFrameBridge.mm:
        (-[WebCoreFrameBridge dragOperationForDraggingInfo:]):
        (-[WebCoreFrameBridge syncLoadResourceWithMethod:URL:customHeaders:postData:finalURL:responseHeaders:statusCode:]):
        * css/CSSComputedStyleDeclaration.cpp:
        (WebCore::):
        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
        * css/CSSPrimitiveValue.cpp:
        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
        (WebCore::CSSPrimitiveValue::cleanup):
        (WebCore::CSSPrimitiveValue::cssText):
        * css/CSSPrimitiveValue.h:
        (WebCore::CSSPrimitiveValue::):
        * css/CSSValueList.cpp:
        (WebCore::CSSValueList::append):
        * css/cssparser.cpp:
        (WebCore::CSSParser::parseValue):
        * css/cssparser.h:
        * css/cssstyleselector.cpp:
        (WebCore::CSSStyleSelector::applyProperty):
        * dom/Document.cpp:
        (WebCore::Document::Document):
        (WebCore::Document::updateSelection):
        (WebCore::Document::implicitClose):
        (WebCore::Document::setFocusNode):
        * dom/Document.h:
        * editing/ReplaceSelectionCommand.h:
        * html/HTMLParser.cpp:
        (WebCore::HTMLParser::handleResidualStyleCloseTagAcrossBlocks):
        * loader/mac/FrameLoader.h:
        (WebCore::PolicyCheck::request):
        * loader/mac/FrameLoader.mm:
        (WebCore::FrameLoader::~FrameLoader):
        (WebCore::FrameLoader::safeLoad):
        (WebCore::FrameLoader::load):
        (WebCore::FrameLoader::open):
        (WebCore::FrameLoader::stopLoading):
        (WebCore::setAllDefersLoading):
        (WebCore::FrameLoader::setDefersLoading):
        (WebCore::FrameLoader::willSendRequest):
        (WebCore::FrameLoader::receivedMainResourceError):
        (WebCore::FrameLoader::callContinueFragmentScrollAfterNavigationPolicy):
        (WebCore::FrameLoader::commitProvisionalLoad):
        (WebCore::FrameLoader::checkNavigationPolicy):
        (WebCore::FrameLoader::checkContentPolicy):
        (WebCore::FrameLoader::cancelContentPolicyCheck):
        (WebCore::FrameLoader::stopPolicyCheck):
        (WebCore::FrameLoader::checkNewWindowPolicy):
        (WebCore::FrameLoader::continueAfterNewWindowPolicy):
        (WebCore::FrameLoader::continueAfterNavigationPolicy):
        (WebCore::FrameLoader::continueAfterContentPolicy):
        (WebCore::FrameLoader::continueAfterWillSubmitForm):
        (WebCore::FrameLoader::callContinueLoadAfterNavigationPolicy):
        (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
        (WebCore::FrameLoader::closeDocument):
        (WebCore::FrameLoader::transitionToCommitted):
        (WebCore::FrameLoader::callContinueLoadAfterNewWindowPolicy):
        (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
        (WebCore::FrameLoader::post):
        (WebCore::FrameLoader::detachFromParent):
        (WebCore::FrameLoader::addExtraFieldsToRequest):
        (WebCore::PolicyCheck::PolicyCheck):
        (WebCore::PolicyCheck::clear):
        (WebCore::PolicyCheck::set):
        (WebCore::PolicyCheck::call):
        (WebCore::PolicyCheck::dropRequest):
        (WebCore::FrameLoaderClient::~FrameLoaderClient):
        * loader/mac/WebFormState.h:
        * loader/mac/WebFormState.mm:
        * loader/mac/WebFrameLoaderClient.h:
        * loader/mac/WebLoader.h:
        (WebCore::WebResourceLoader::defersLoading):
        * loader/mac/WebLoader.mm:
        (WebCore::WebResourceLoader::WebResourceLoader):
        (WebCore::WebResourceLoader::load):
        (WebCore::WebResourceLoader::setDefersLoading):
        * loader/mac/WebMainResourceLoader.h:
        * loader/mac/WebMainResourceLoader.mm:
        (WebCore::MainResourceLoader::MainResourceLoader):
        (WebCore::MainResourceLoader::releaseDelegate):
        (WebCore::MainResourceLoader::didCancel):
        (WebCore::MainResourceLoader::callContinueAfterNavigationPolicy):
        (WebCore::MainResourceLoader::continueAfterNavigationPolicy):
        (WebCore::MainResourceLoader::willSendRequest):
        (WebCore::MainResourceLoader::callContinueAfterContentPolicy):
        (WebCore::MainResourceLoader::continueAfterContentPolicy):
        (WebCore::MainResourceLoader::didReceiveResponse):
        (WebCore::MainResourceLoader::didReceiveData):
        (WebCore::MainResourceLoader::didFinishLoading):
        (WebCore::MainResourceLoader::didFail):
        (WebCore::MainResourceLoader::loadNow):
        (WebCore::MainResourceLoader::load):
        (WebCore::MainResourceLoader::setDefersLoading):
        * page/Frame.cpp:
        (WebCore::Frame::paint):
        * page/FrameView.cpp:
        (WebCore::FrameView::layout):
        * page/FrameView.h:
        * page/Page.cpp:
        (WebCore::Page::setDefersLoading):
        * page/Page.h:
        (WebCore::Page::defersLoading):
        * platform/DeprecatedString.h:
        * platform/DeprecatedStringList.h:
        * platform/FontFallbackList.h:
        * platform/PlatformKeyboardEvent.h:
        * platform/PlatformMouseEvent.h:
        * platform/PlatformWheelEvent.h:
        * platform/mac/ClipboardMac.h:
        * platform/mac/ClipboardMac.mm:
        (WebCore::ClipboardMac::setDragImage):
        (WebCore::ClipboardMac::dragNSImage):
        (WebCore::ClipboardMac::sourceOperation):
        (WebCore::ClipboardMac::destinationOperation):
        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::setStyle):
        * rendering/break_lines.cpp:
        (WebCore::nextBreakablePosition):

WebKit:

        Reviewed by Maciej.

        - eliminated the use of Objective-C for the policy decider
          machinery, obviating the need for WebPolicyDeciderMac

        - moved the defersLoading flag from WebView to WebCore::Page

        - removed unused copies of four methods that in the frame bridge;
          the actually-used copies are in the page bridge

        - updated for rename of PassRefPtr::release to releaseRef

        * WebView/WebPolicyDeciderMac.h: Removed.
        * WebView/WebPolicyDeciderMac.m: Removed.
        * WebKit.xcodeproj/project.pbxproj: Updated for removal.

        * Plugins/WebBaseNetscapePluginView.mm:
        (-[WebBaseNetscapePluginView sendEvent:]):
        * Plugins/WebNetscapePluginStream.mm:
        * WebCoreSupport/WebFrameBridge.mm:
        * WebCoreSupport/WebFrameLoaderClient.h:
        * WebCoreSupport/WebFrameLoaderClient.mm:
        (getWebView):
        (WebFrameLoaderClient::WebFrameLoaderClient):
        (WebFrameLoaderClient::willCloseDocument):
        (WebFrameLoaderClient::dispatchDecidePolicyForMIMEType):
        (WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
        (WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
        (WebFrameLoaderClient::cancelPolicyCheck):
        (WebFrameLoaderClient::dispatchWillSubmitForm):
        (WebFrameLoaderClient::setDefersLoading):
        (WebFrameLoaderClient::setTitle):
        (WebFrameLoaderClient::deliverArchivedResourcesAfterDelay):
        (WebFrameLoaderClient::deliverArchivedResources):
        (WebFrameLoaderClient::setUpPolicyListener):
        (WebFrameLoaderClient::receivedPolicyDecison):
        (WebFrameLoaderClient::userAgent):
        (-[WebFramePolicyListener initWithWebCoreFrame:]):
        (-[WebFramePolicyListener invalidate]):
        (-[WebFramePolicyListener dealloc]):
        (-[WebFramePolicyListener finalize]):
        (-[WebFramePolicyListener receivedPolicyDecision:]):
        (-[WebFramePolicyListener ignore]):
        (-[WebFramePolicyListener download]):
        (-[WebFramePolicyListener use]):
        (-[WebFramePolicyListener continue]):
        * WebCoreSupport/WebPageBridge.mm:
        (-[WebPageBridge runModal]):
        * WebView/WebArchiver.m:
        (+[WebArchiver archiveSelectionInFrame:]):
        * WebView/WebFormDelegate.h:
        * WebView/WebFormDelegate.m:
        (+[WebFormDelegate _sharedWebFormDelegate]):
        (-[WebFormDelegate textFieldDidBeginEditing:inFrame:]):
        (-[WebFormDelegate textFieldDidEndEditing:inFrame:]):
        (-[WebFormDelegate textDidChangeInTextField:inFrame:]):
        (-[WebFormDelegate textDidChangeInTextArea:inFrame:]):
        (-[WebFormDelegate frame:sourceFrame:willSubmitForm:withValues:submissionListener:]):
        * WebView/WebFrame.mm:
        (-[WebFrame _loadURL:referrer:intoChild:]):
        (-[WebFrame _isFrameSet]):
        * WebView/WebFrameInternal.h:
        * WebView/WebFrameView.mm:
        (-[WebFrameView _shouldDrawBorder]):
        * WebView/WebHTMLView.m:
        (-[NSArray knowsPageRange:]):
        * WebView/WebView.mm:
        (-[WebView _formDelegate]):
        * WebView/WebViewInternal.h:
        * WebView/WebViewPrivate.h:

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

79 files changed:
JavaScriptCore/ChangeLog
JavaScriptCore/kjs/identifier.cpp
JavaScriptCore/kjs/ustring.cpp
JavaScriptCore/wtf/PassRefPtr.h
JavaScriptCore/wtf/RefPtr.h
WebCore/ChangeLog
WebCore/WebCore.exp
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/js/kjs_binding.cpp
WebCore/bindings/js/kjs_binding.h
WebCore/bridge/AXObjectCache.h
WebCore/bridge/mac/BrowserExtensionMac.mm
WebCore/bridge/mac/FrameMac.h
WebCore/bridge/mac/FrameMac.mm
WebCore/bridge/mac/PageMac.mm
WebCore/bridge/mac/WebCoreEditCommand.mm
WebCore/bridge/mac/WebCoreFrameBridge.h
WebCore/bridge/mac/WebCoreFrameBridge.mm
WebCore/css/CSSComputedStyleDeclaration.cpp
WebCore/css/CSSPrimitiveValue.cpp
WebCore/css/CSSPrimitiveValue.h
WebCore/css/CSSValueList.cpp
WebCore/css/cssparser.cpp
WebCore/css/cssparser.h
WebCore/css/cssstyleselector.cpp
WebCore/dom/Document.cpp
WebCore/dom/Document.h
WebCore/editing/ReplaceSelectionCommand.h
WebCore/html/HTMLParser.cpp
WebCore/loader/mac/FrameLoader.h
WebCore/loader/mac/FrameLoader.mm
WebCore/loader/mac/WebFormState.h
WebCore/loader/mac/WebFormState.mm
WebCore/loader/mac/WebFrameLoaderClient.h
WebCore/loader/mac/WebLoader.h
WebCore/loader/mac/WebLoader.mm
WebCore/loader/mac/WebMainResourceLoader.h
WebCore/loader/mac/WebMainResourceLoader.mm
WebCore/loader/mac/WebPolicyDecider.h [deleted file]
WebCore/loader/mac/WebPolicyDecider.mm [deleted file]
WebCore/page/Frame.cpp
WebCore/page/Frame.h
WebCore/page/FrameView.cpp
WebCore/page/FrameView.h
WebCore/page/Page.cpp
WebCore/page/Page.h
WebCore/platform/DeprecatedString.h
WebCore/platform/DeprecatedStringList.h
WebCore/platform/FontFallbackList.h
WebCore/platform/PlatformKeyboardEvent.h
WebCore/platform/PlatformMouseEvent.h
WebCore/platform/PlatformWheelEvent.h
WebCore/platform/mac/ClipboardMac.h
WebCore/platform/mac/ClipboardMac.mm
WebCore/rendering/RenderObject.cpp
WebCore/rendering/break_lines.cpp
WebKit/ChangeLog
WebKit/DefaultDelegates/WebDefaultPolicyDelegate.m
WebKit/Plugins/WebBaseNetscapePluginView.mm
WebKit/Plugins/WebNetscapePluginStream.mm
WebKit/WebCoreSupport/WebFrameBridge.mm
WebKit/WebCoreSupport/WebFrameLoaderClient.h
WebKit/WebCoreSupport/WebFrameLoaderClient.mm
WebKit/WebCoreSupport/WebPageBridge.mm
WebKit/WebKit.xcodeproj/project.pbxproj
WebKit/WebView/WebArchiver.m
WebKit/WebView/WebFormDelegate.h
WebKit/WebView/WebFormDelegate.m
WebKit/WebView/WebFrame.mm
WebKit/WebView/WebFrameInternal.h
WebKit/WebView/WebFrameView.mm
WebKit/WebView/WebHTMLView.m
WebKit/WebView/WebPolicyDeciderMac.h [deleted file]
WebKit/WebView/WebPolicyDeciderMac.m [deleted file]
WebKit/WebView/WebPolicyDelegate.mm
WebKit/WebView/WebPolicyDelegatePrivate.h
WebKit/WebView/WebView.mm
WebKit/WebView/WebViewInternal.h
WebKit/WebView/WebViewPrivate.h

index 116f78e..3ce8731 100644 (file)
@@ -1,5 +1,32 @@
 2006-10-28  Darin Adler  <darin@apple.com>
 
+        Reviewed by Maciej.
+
+        - renamed PassRefPtr::release to releaseRef to make it clearer that
+          it's the counterpart of adoptRef, and to make it harder to confuse
+          it with the safer-to-use RefPtr::release
+
+        * kjs/identifier.cpp:
+        (KJS::CStringTranslator::translate):
+        (KJS::UCharBufferTranslator::translate):
+        * kjs/ustring.cpp:
+        (KJS::UString::Rep::create):
+        * wtf/PassRefPtr.h:
+        (WTF::PassRefPtr::PassRefPtr):
+        (WTF::PassRefPtr::~PassRefPtr):
+        (WTF::PassRefPtr::get):
+        (WTF::PassRefPtr::releaseRef):
+        (WTF::PassRefPtr::operator->):
+        (WTF::PassRefPtr::operator=):
+        (WTF::adoptRef):
+        (WTF::static_pointer_cast):
+        (WTF::const_pointer_cast):
+        * wtf/RefPtr.h:
+        (WTF::RefPtr::RefPtr):
+        (WTF::RefPtr::operator=):
+
+2006-10-28  Darin Adler  <darin@apple.com>
+
         Reviewed by Steve.
 
         * kjs/grammar.y: Add definitions of YYMALLOC and YYFREE to fix
index b825115..01a0bdc 100644 (file)
@@ -125,7 +125,7 @@ struct CStringTranslator
         for (size_t i = 0; i != length; i++)
             d[i] = c[i];
         
-        UString::Rep *r = UString::Rep::create(d, static_cast<int>(length)).release();
+        UString::Rep *r = UString::Rep::create(d, static_cast<int>(length)).releaseRef();
         r->isIdentifier = 1;
         r->rc = 0;
         r->_hash = hash;
@@ -168,7 +168,7 @@ struct UCharBufferTranslator
         for (unsigned i = 0; i != buf.length; i++)
             d[i] = buf.s[i];
         
-        UString::Rep *r = UString::Rep::create(d, buf.length).release();
+        UString::Rep *r = UString::Rep::create(d, buf.length).releaseRef();
         r->isIdentifier = 1;
         r->rc = 0;
         r->_hash = hash;
index 78b0593..af626ee 100644 (file)
@@ -206,7 +206,7 @@ PassRefPtr<UString::Rep> UString::Rep::create(PassRefPtr<Rep> base, int offset,
   r->rc = 1;
   r->_hash = 0;
   r->isIdentifier = 0;
-  r->baseString = base.release();
+  r->baseString = base.releaseRef();
   r->buf = 0;
   r->usedCapacity = 0;
   r->capacity = 0;
index f9e0ccf..1a5639f 100644 (file)
@@ -27,32 +27,32 @@ namespace WTF {
 
     template<typename T> class RefPtr;
     template<typename T> class PassRefPtr;
-    template <typename T> PassRefPtr<T> adoptRef(T *p);
+    template <typename T> PassRefPtr<T> adoptRef(T*);
 
     template<typename T> 
     class PassRefPtr
     {
     public:
         PassRefPtr() : m_ptr(0) {}
-        PassRefPtr(T *ptr) : m_ptr(ptr) { if (ptr) ptr->ref(); }
+        PassRefPtr(Tptr) : m_ptr(ptr) { if (ptr) ptr->ref(); }
         // It somewhat breaks the type system to allow transfer of ownership out of
         // a const PassRefPtr. However, it makes it much easier to work with PassRefPtr
         // temporaries, and we don't really have a need to use real const PassRefPtrs 
         // anyway.
-        PassRefPtr(const PassRefPtr& o) : m_ptr(o.release()) {}
-        template <typename U> PassRefPtr(const PassRefPtr<U>& o) : m_ptr(o.release()) { }
+        PassRefPtr(const PassRefPtr& o) : m_ptr(o.releaseRef()) {}
+        template <typename U> PassRefPtr(const PassRefPtr<U>& o) : m_ptr(o.releaseRef()) { }
 
-        ~PassRefPtr() { if (T *ptr = m_ptr) ptr->deref(); }
+        ~PassRefPtr() { if (Tptr = m_ptr) ptr->deref(); }
         
         template <class U> 
-        PassRefPtr(const RefPtr<U>& o) : m_ptr(o.get()) { if (T *ptr = m_ptr) ptr->ref(); }
+        PassRefPtr(const RefPtr<U>& o) : m_ptr(o.get()) { if (Tptr = m_ptr) ptr->ref(); }
         
-        T *get() const { return m_ptr; }
+        Tget() const { return m_ptr; }
 
-        T *release() const { T *tmp = m_ptr; m_ptr = 0; return tmp; }
+        T* releaseRef() const { T* tmp = m_ptr; m_ptr = 0; return tmp; }
 
         T& operator*() const { return *m_ptr; }
-        T *operator->() const { return m_ptr; }
+        Toperator->() const { return m_ptr; }
         
         bool operator!() const { return !m_ptr; }
 
@@ -60,16 +60,16 @@ namespace WTF {
         typedef T* (PassRefPtr::*UnspecifiedBoolType)() const;
         operator UnspecifiedBoolType() const { return m_ptr ? &PassRefPtr::get : 0; }
         
-        PassRefPtr& operator=(T *);
+        PassRefPtr& operator=(T*);
         PassRefPtr& operator=(const PassRefPtr&);
         template <typename U> PassRefPtr& operator=(const PassRefPtr<U>&);
         template <typename U> PassRefPtr& operator=(const RefPtr<U>&);
 
-        friend PassRefPtr adoptRef<T>(T *);
+        friend PassRefPtr adoptRef<T>(T*);
     private:
         // adopting constructor
-        PassRefPtr(T *ptr, bool) : m_ptr(ptr) {}
-        mutable T *m_ptr;
+        PassRefPtr(Tptr, bool) : m_ptr(ptr) {}
+        mutable Tm_ptr;
     };
     
     template <typename T> template <typename U> inline PassRefPtr<T>& PassRefPtr<T>::operator=(const RefPtr<U>& o) 
@@ -98,7 +98,7 @@ namespace WTF {
     template <typename T> inline PassRefPtr<T>& PassRefPtr<T>::operator=(const PassRefPtr<T>& ref)
     {
         T* ptr = m_ptr;
-        m_ptr = ref.release();
+        m_ptr = ref.releaseRef();
         if (ptr)
             ptr->deref();
         return *this;
@@ -107,7 +107,7 @@ namespace WTF {
     template <typename T> template <typename U> inline PassRefPtr<T>& PassRefPtr<T>::operator=(const PassRefPtr<U>& ref)
     {
         T* ptr = m_ptr;
-        m_ptr = ref.release();
+        m_ptr = ref.releaseRef();
         if (ptr)
             ptr->deref();
         return *this;
@@ -163,19 +163,19 @@ namespace WTF {
         return a != b.get(); 
     }
     
-    template <typename T> inline PassRefPtr<T> adoptRef(T *p)
+    template <typename T> inline PassRefPtr<T> adoptRef(Tp)
     {
         return PassRefPtr<T>(p, true);
     }
 
     template <typename T, typename U> inline PassRefPtr<T> static_pointer_cast(const PassRefPtr<U>& p) 
     { 
-        return adoptRef(static_cast<T *>(p.release())); 
+        return adoptRef(static_cast<T*>(p.releaseRef())); 
     }
 
     template <typename T, typename U> inline PassRefPtr<T> const_pointer_cast(const PassRefPtr<U>& p) 
     { 
-        return adoptRef(const_cast<T *>(p.release())); 
+        return adoptRef(const_cast<T*>(p.releaseRef())); 
     }
 
     template <typename T> inline T* getPtr(const PassRefPtr<T>& p)
index c9169f5..a3f0c12 100644 (file)
@@ -68,7 +68,7 @@ namespace WTF {
     };
     
     template <typename T> template <typename U> inline RefPtr<T>::RefPtr(const PassRefPtr<U>& o)
-        : m_ptr(o.release())
+        : m_ptr(o.releaseRef())
     {
     }
 
@@ -110,7 +110,7 @@ namespace WTF {
     template <typename T> inline RefPtr<T>& RefPtr<T>::operator=(const PassRefPtr<T>& o)
     {
         T* ptr = m_ptr;
-        m_ptr = o.release();
+        m_ptr = o.releaseRef();
         if (ptr)
             ptr->deref();
         return *this;
@@ -119,7 +119,7 @@ namespace WTF {
     template <typename T> template <typename U> inline RefPtr<T>& RefPtr<T>::operator=(const PassRefPtr<U>& o)
     {
         T* ptr = m_ptr;
-        m_ptr = o.release();
+        m_ptr = o.releaseRef();
         if (ptr)
             ptr->deref();
         return *this;
index d8f01a9..2aa56ff 100644 (file)
@@ -1,3 +1,177 @@
+2006-10-28  Darin Adler  <darin@apple.com>
+
+        Reviewed by Maciej.
+
+        - eliminated the use of Objective-C for the policy decider
+          machinery, obviating the need for WebPolicyDecider,
+          WebCoreFrameLoaderAsDelegate, and
+          WebCoreMainResourceLoaderAsPolicyDelegate
+
+        - grouped the state related to policy decisions into a PolicyCheck
+          class to simplify the FrameLoader logic
+
+        - removed six methods from the bridge, reducing FrameLoader's use of
+          the bridge to a single method
+
+        - changed form state to always use HashMap instead of NSDictionary
+
+        - moved the defersLoading flag from WebView to WebCore::Page
+          and changed code to consistently call it defersLoading rather
+          than defersCallbacks
+
+        - updated for rename of PassRefPtr::release to releaseRef
+        - replaced all uses of __APPLE__ with appropriate PLATFORM defines
+        - cleaned up kjs_binding.h a bit
+        - cleaned up FrameMac.h a bit
+
+        * loader/mac/WebPolicyDecider.h: Removed.
+        * loader/mac/WebPolicyDecider.mm: Removed.
+        * WebCore.xcodeproj/project.pbxproj: Updated for removal.
+
+        * WebCore.exp:
+        * bindings/js/kjs_binding.cpp:
+        (KJS::ScriptInterpreter::ScriptInterpreter):
+        (KJS::ScriptInterpreter::wasRunByUserGesture):
+        * bindings/js/kjs_binding.h:
+        (KJS::ScriptInterpreter::setCurrentEvent):
+        (KJS::ScriptInterpreter::setInlineCode):
+        (KJS::ScriptInterpreter::setProcessingTimerCallback):
+        (KJS::ScriptInterpreter::getCurrentEvent):
+        (KJS::cacheDOMObject):
+        (KJS::DOMExceptionTranslator::DOMExceptionTranslator):
+        * bridge/AXObjectCache.h:
+        * bridge/mac/BrowserExtensionMac.mm:
+        (WebCore::BrowserExtensionMac::createNewWindow):
+        * bridge/mac/FrameMac.h:
+        * bridge/mac/FrameMac.mm:
+        (WebCore::FrameMac::loadRequest):
+        (WebCore::FrameMac::submitForm):
+        (WebCore::FrameMac::urlSelected):
+        (WebCore::FrameMac::userAgent):
+        (WebCore::FrameMac::passMouseDownEventToWidget):
+        (WebCore::FrameMac::handleMouseMoveEvent):
+        * bridge/mac/PageMac.mm:
+        (WebCore::Page::Page):
+        * bridge/mac/WebCoreEditCommand.mm:
+        * bridge/mac/WebCoreFrameBridge.h:
+        * bridge/mac/WebCoreFrameBridge.mm:
+        (-[WebCoreFrameBridge dragOperationForDraggingInfo:]):
+        (-[WebCoreFrameBridge syncLoadResourceWithMethod:URL:customHeaders:postData:finalURL:responseHeaders:statusCode:]):
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::):
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+        * css/CSSPrimitiveValue.cpp:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        (WebCore::CSSPrimitiveValue::cleanup):
+        (WebCore::CSSPrimitiveValue::cssText):
+        * css/CSSPrimitiveValue.h:
+        (WebCore::CSSPrimitiveValue::):
+        * css/CSSValueList.cpp:
+        (WebCore::CSSValueList::append):
+        * css/cssparser.cpp:
+        (WebCore::CSSParser::parseValue):
+        * css/cssparser.h:
+        * css/cssstyleselector.cpp:
+        (WebCore::CSSStyleSelector::applyProperty):
+        * dom/Document.cpp:
+        (WebCore::Document::Document):
+        (WebCore::Document::updateSelection):
+        (WebCore::Document::implicitClose):
+        (WebCore::Document::setFocusNode):
+        * dom/Document.h:
+        * editing/ReplaceSelectionCommand.h:
+        * html/HTMLParser.cpp:
+        (WebCore::HTMLParser::handleResidualStyleCloseTagAcrossBlocks):
+        * loader/mac/FrameLoader.h:
+        (WebCore::PolicyCheck::request):
+        * loader/mac/FrameLoader.mm:
+        (WebCore::FrameLoader::~FrameLoader):
+        (WebCore::FrameLoader::safeLoad):
+        (WebCore::FrameLoader::load):
+        (WebCore::FrameLoader::open):
+        (WebCore::FrameLoader::stopLoading):
+        (WebCore::setAllDefersLoading):
+        (WebCore::FrameLoader::setDefersLoading):
+        (WebCore::FrameLoader::willSendRequest):
+        (WebCore::FrameLoader::receivedMainResourceError):
+        (WebCore::FrameLoader::callContinueFragmentScrollAfterNavigationPolicy):
+        (WebCore::FrameLoader::commitProvisionalLoad):
+        (WebCore::FrameLoader::checkNavigationPolicy):
+        (WebCore::FrameLoader::checkContentPolicy):
+        (WebCore::FrameLoader::cancelContentPolicyCheck):
+        (WebCore::FrameLoader::stopPolicyCheck):
+        (WebCore::FrameLoader::checkNewWindowPolicy):
+        (WebCore::FrameLoader::continueAfterNewWindowPolicy):
+        (WebCore::FrameLoader::continueAfterNavigationPolicy):
+        (WebCore::FrameLoader::continueAfterContentPolicy):
+        (WebCore::FrameLoader::continueAfterWillSubmitForm):
+        (WebCore::FrameLoader::callContinueLoadAfterNavigationPolicy):
+        (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
+        (WebCore::FrameLoader::closeDocument):
+        (WebCore::FrameLoader::transitionToCommitted):
+        (WebCore::FrameLoader::callContinueLoadAfterNewWindowPolicy):
+        (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
+        (WebCore::FrameLoader::post):
+        (WebCore::FrameLoader::detachFromParent):
+        (WebCore::FrameLoader::addExtraFieldsToRequest):
+        (WebCore::PolicyCheck::PolicyCheck):
+        (WebCore::PolicyCheck::clear):
+        (WebCore::PolicyCheck::set):
+        (WebCore::PolicyCheck::call):
+        (WebCore::PolicyCheck::dropRequest):
+        (WebCore::FrameLoaderClient::~FrameLoaderClient):
+        * loader/mac/WebFormState.h:
+        * loader/mac/WebFormState.mm:
+        * loader/mac/WebFrameLoaderClient.h:
+        * loader/mac/WebLoader.h:
+        (WebCore::WebResourceLoader::defersLoading):
+        * loader/mac/WebLoader.mm:
+        (WebCore::WebResourceLoader::WebResourceLoader):
+        (WebCore::WebResourceLoader::load):
+        (WebCore::WebResourceLoader::setDefersLoading):
+        * loader/mac/WebMainResourceLoader.h:
+        * loader/mac/WebMainResourceLoader.mm:
+        (WebCore::MainResourceLoader::MainResourceLoader):
+        (WebCore::MainResourceLoader::releaseDelegate):
+        (WebCore::MainResourceLoader::didCancel):
+        (WebCore::MainResourceLoader::callContinueAfterNavigationPolicy):
+        (WebCore::MainResourceLoader::continueAfterNavigationPolicy):
+        (WebCore::MainResourceLoader::willSendRequest):
+        (WebCore::MainResourceLoader::callContinueAfterContentPolicy):
+        (WebCore::MainResourceLoader::continueAfterContentPolicy):
+        (WebCore::MainResourceLoader::didReceiveResponse):
+        (WebCore::MainResourceLoader::didReceiveData):
+        (WebCore::MainResourceLoader::didFinishLoading):
+        (WebCore::MainResourceLoader::didFail):
+        (WebCore::MainResourceLoader::loadNow):
+        (WebCore::MainResourceLoader::load):
+        (WebCore::MainResourceLoader::setDefersLoading):
+        * page/Frame.cpp:
+        (WebCore::Frame::paint):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::layout):
+        * page/FrameView.h:
+        * page/Page.cpp:
+        (WebCore::Page::setDefersLoading):
+        * page/Page.h:
+        (WebCore::Page::defersLoading):
+        * platform/DeprecatedString.h:
+        * platform/DeprecatedStringList.h:
+        * platform/FontFallbackList.h:
+        * platform/PlatformKeyboardEvent.h:
+        * platform/PlatformMouseEvent.h:
+        * platform/PlatformWheelEvent.h:
+        * platform/mac/ClipboardMac.h:
+        * platform/mac/ClipboardMac.mm:
+        (WebCore::ClipboardMac::setDragImage):
+        (WebCore::ClipboardMac::dragNSImage):
+        (WebCore::ClipboardMac::sourceOperation):
+        (WebCore::ClipboardMac::destinationOperation):
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::setStyle):
+        * rendering/break_lines.cpp:
+        (WebCore::nextBreakablePosition):
+
 2006-10-28  Adam Roben  <aroben@apple.com>
 
         Reviewed by Maciej.
index 5d65f76..56762d6 100644 (file)
 .objc_class_name_WebCoreStringTruncator
 .objc_class_name_WebCoreViewFactory
 .objc_class_name_WebDashboardRegion
-.objc_class_name_WebPolicyDecider
 .objc_class_name_WebScriptObject
 .objc_class_name_WebScriptObjectPrivate
 .objc_class_name_WebUndefined
@@ -140,7 +139,6 @@ __ZN7WebCore11FrameLoader17actionInformationENS_14NavigationTypeEP7NSEventP5NSUR
 __ZN7WebCore11FrameLoader19requestFromDelegateEP12NSURLRequestRP11objc_objectRP7NSError
 __ZN7WebCore11FrameLoader21addPlugInStreamLoaderEPNS_17WebResourceLoaderE
 __ZN7WebCore11FrameLoader21commitProvisionalLoadEP12NSDictionary
-__ZN7WebCore11FrameLoader22defersCallbacksChangedEv
 __ZN7WebCore11FrameLoader23addExtraFieldsToRequestEP19NSMutableURLRequestbb
 __ZN7WebCore11FrameLoader23reloadAllowingStaleDataERKNS_6StringE
 __ZN7WebCore11FrameLoader23timeOfLastCompletedLoadEv
@@ -150,7 +148,7 @@ __ZN7WebCore11FrameLoader29sendRemainingDelegateMessagesEP11objc_objectP13NSURLR
 __ZN7WebCore11FrameLoader4loadEP12NSURLRequest
 __ZN7WebCore11FrameLoader4loadEP12NSURLRequestP12NSDictionaryNS_13FrameLoadTypeEN3WTF10PassRefPtrINS_9FormStateEEE
 __ZN7WebCore11FrameLoader4loadEP12NSURLRequestRKNS_6StringE
-__ZN7WebCore11FrameLoader4loadEP5NSURLRKNS_6StringENS_13FrameLoadTypeES5_P7NSEventPNS_7ElementEP12NSDictionary
+__ZN7WebCore11FrameLoader4loadEP5NSURLRKNS_6StringENS_13FrameLoadTypeES5_P7NSEventPNS_7ElementERKN3WTF7HashMapIS3_S3_NSB_7StrHashIS3_EENSB_10HashTraitsIS3_EESG_EE
 __ZN7WebCore11FrameLoader4loadEPNS_14DocumentLoaderE
 __ZN7WebCore11FrameLoader4loadEPNS_14DocumentLoaderENS_13FrameLoadTypeEN3WTF10PassRefPtrINS_9FormStateEEE
 __ZN7WebCore11FrameLoader6reloadEv
@@ -180,6 +178,7 @@ __ZN7WebCore19SelectionController5clearEv
 __ZN7WebCore21isBackForwardLoadTypeENS_13FrameLoadTypeE
 __ZN7WebCore26NetscapePlugInStreamLoader6createEPNS_5FrameEP11objc_object
 __ZN7WebCore4KURLC1EP5NSURL
+__ZN7WebCore4Page16setDefersLoadingEb
 __ZN7WebCore5Frame11setSettingsEPNS_8SettingsE
 __ZN7WebCore5Frame12canCachePageEv
 __ZN7WebCore5Frame12ownerElementEv
@@ -225,7 +224,6 @@ __ZNK7WebCore10StringImplcvP8NSStringEv
 __ZNK7WebCore10StringImplcvP8NSStringEv
 __ZNK7WebCore10StringImplcvP8NSStringEv
 __ZNK7WebCore11FrameLoader14documentLoaderEv
-__ZNK7WebCore11FrameLoader15defersCallbacksEv
 __ZNK7WebCore11FrameLoader15firstLayoutDoneEv
 __ZNK7WebCore11FrameLoader20activeDocumentLoaderEv
 __ZNK7WebCore11FrameLoader21isQuickRedirectComingEv
@@ -254,7 +252,9 @@ __ZNK7WebCore14DocumentLoader8responseEv
 __ZNK7WebCore14DocumentLoader9isLoadingEv
 __ZNK7WebCore17WebResourceLoader11frameLoaderEv
 __ZNK7WebCore26NetscapePlugInStreamLoader6isDoneEv
+__ZNK7WebCore4Page14frameNamespaceEv
 __ZNK7WebCore4Page19dragCaretControllerEv
+__ZNK7WebCore5Frame10isFrameSetEv
 __ZNK7WebCore5Frame13selectionRectEv
 __ZNK7WebCore5Frame15containsPluginsEv
 __ZNK7WebCore5Frame15revealSelectionERKNS_11RenderLayer15ScrollAlignmentE
@@ -340,4 +340,3 @@ _wkSignalCFReadStreamEnd
 _wkSignalCFReadStreamError
 _wkSignalCFReadStreamHasBytes
 _wkSupportsMultipartXMixedReplace
-
index a674338..942329f 100644 (file)
                656D37430ADBA5DE00A4554D /* WebNetscapePlugInStreamLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 656D372B0ADBA5DE00A4554D /* WebNetscapePlugInStreamLoader.h */; settings = {ATTRIBUTES = (Private, ); }; };
                656D37440ADBA5DE00A4554D /* WebNetscapePlugInStreamLoader.mm in Sources */ = {isa = PBXBuildFile; fileRef = 656D372C0ADBA5DE00A4554D /* WebNetscapePlugInStreamLoader.mm */; };
                656D37450ADBA5DE00A4554D /* WebPlugInStreamLoaderDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 656D372D0ADBA5DE00A4554D /* WebPlugInStreamLoaderDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               656D37460ADBA5DE00A4554D /* WebPolicyDecider.h in Headers */ = {isa = PBXBuildFile; fileRef = 656D372E0ADBA5DE00A4554D /* WebPolicyDecider.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               656D37470ADBA5DE00A4554D /* WebPolicyDecider.mm in Sources */ = {isa = PBXBuildFile; fileRef = 656D372F0ADBA5DE00A4554D /* WebPolicyDecider.mm */; };
                656D37480ADBA5DE00A4554D /* WebSubresourceLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 656D37300ADBA5DE00A4554D /* WebSubresourceLoader.h */; settings = {ATTRIBUTES = (Private, ); }; };
                656D37490ADBA5DE00A4554D /* WebSubresourceLoader.mm in Sources */ = {isa = PBXBuildFile; fileRef = 656D37310ADBA5DE00A4554D /* WebSubresourceLoader.mm */; };
                657429170A9C2D0B00C52C97 /* IconDataCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 657429140A9C2D0B00C52C97 /* IconDataCache.h */; };
                656D372B0ADBA5DE00A4554D /* WebNetscapePlugInStreamLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebNetscapePlugInStreamLoader.h; sourceTree = "<group>"; };
                656D372C0ADBA5DE00A4554D /* WebNetscapePlugInStreamLoader.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = WebNetscapePlugInStreamLoader.mm; sourceTree = "<group>"; };
                656D372D0ADBA5DE00A4554D /* WebPlugInStreamLoaderDelegate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebPlugInStreamLoaderDelegate.h; sourceTree = "<group>"; };
-               656D372E0ADBA5DE00A4554D /* WebPolicyDecider.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebPolicyDecider.h; sourceTree = "<group>"; };
-               656D372F0ADBA5DE00A4554D /* WebPolicyDecider.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = WebPolicyDecider.mm; sourceTree = "<group>"; };
                656D37300ADBA5DE00A4554D /* WebSubresourceLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebSubresourceLoader.h; sourceTree = "<group>"; };
                656D37310ADBA5DE00A4554D /* WebSubresourceLoader.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = WebSubresourceLoader.mm; sourceTree = "<group>"; };
                657429140A9C2D0B00C52C97 /* IconDataCache.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IconDataCache.h; sourceTree = "<group>"; };
                                656D372B0ADBA5DE00A4554D /* WebNetscapePlugInStreamLoader.h */,
                                656D372C0ADBA5DE00A4554D /* WebNetscapePlugInStreamLoader.mm */,
                                656D372D0ADBA5DE00A4554D /* WebPlugInStreamLoaderDelegate.h */,
-                               656D372E0ADBA5DE00A4554D /* WebPolicyDecider.h */,
-                               656D372F0ADBA5DE00A4554D /* WebPolicyDecider.mm */,
                                656D37300ADBA5DE00A4554D /* WebSubresourceLoader.h */,
                                656D37310ADBA5DE00A4554D /* WebSubresourceLoader.mm */,
                        );
                                656D37410ADBA5DE00A4554D /* WebMainResourceLoader.h in Headers */,
                                656D37430ADBA5DE00A4554D /* WebNetscapePlugInStreamLoader.h in Headers */,
                                656D37450ADBA5DE00A4554D /* WebPlugInStreamLoaderDelegate.h in Headers */,
-                               656D37460ADBA5DE00A4554D /* WebPolicyDecider.h in Headers */,
                                656D37480ADBA5DE00A4554D /* WebSubresourceLoader.h in Headers */,
                                93B77A380ADD792500EA4B81 /* FrameLoaderTypes.h in Headers */,
                                65BAAABE0ADCA015005BB5A4 /* RetainPtr.h in Headers */,
                                656D37400ADBA5DE00A4554D /* WebLoader.mm in Sources */,
                                656D37420ADBA5DE00A4554D /* WebMainResourceLoader.mm in Sources */,
                                656D37440ADBA5DE00A4554D /* WebNetscapePlugInStreamLoader.mm in Sources */,
-                               656D37470ADBA5DE00A4554D /* WebPolicyDecider.mm in Sources */,
                                656D37490ADBA5DE00A4554D /* WebSubresourceLoader.mm in Sources */,
                                0668E1900ADD9640004128E0 /* PopupMenuMac.mm in Sources */,
                                6563A9A80ADF4094000ED2CD /* LoaderNSURLRequestExtras.m in Sources */,
index bf207cf..b80f469 100644 (file)
@@ -75,7 +75,7 @@ static NodePerDocMap *domNodesPerDocument()
 
 ScriptInterpreter::ScriptInterpreter( JSObject *global, Frame *frame )
   : Interpreter( global ), m_frame(frame),
-    m_evt( 0L ), m_inlineCode(false), m_timerCallback(false)
+    m_currentEvent(0), m_inlineCode(false), m_timerCallback(false)
 {
     // Time in milliseconds before the script timeout handler kicks in
     const unsigned ScriptTimeoutTimeMS = 5000;
@@ -200,9 +200,9 @@ void ScriptInterpreter::updateDOMNodeDocument(Node *node, Document *oldDoc, Docu
 
 bool ScriptInterpreter::wasRunByUserGesture() const
 {
-  if ( m_evt )
+  if (m_currentEvent)
   {
-    const AtomicString &type = m_evt->type();
+    const AtomicString& type = m_currentEvent->type();
     bool eventOk = ( // mouse events
       type == clickEvent || type == mousedownEvent ||
       type == mouseupEvent || type == dblclickEvent ||
index 5c64365..4a39e94 100644 (file)
@@ -1,4 +1,4 @@
-// -*- c-basic-offset: 2 -*-
+// -*- c-basic-offset: 4 -*-
 /*
  *  This file is part of the KDE libraries
  *  Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
@@ -23,8 +23,9 @@
 #define KJS_BINDING_H_
 
 #include <kjs/lookup.h>
+#include <wtf/Noncopyable.h>
 
-#if __APPLE__
+#if PLATFORM(MAC)
 #include <JavaScriptCore/runtime.h>
 #endif
 
@@ -40,128 +41,114 @@ namespace WebCore {
 
 namespace KJS {
 
-  /**
-   * Base class for all objects in this binding.
-   */
-  class DOMObject : public JSObject {
-  protected:
-      // DOMObject Destruction is not thread-safe because JS DOM objects 
-      // wrap unsafe WebCore DOM data structures
-      DOMObject() : JSObject(false) {}
-  public:
-      virtual UString toString(ExecState *exec) const;
-  };
-
-  class DOMNode;
-
-  /**
-   * We inherit from Interpreter, to save a pointer to the HTML part
-   * that the interpreter runs for.
-   * The interpreter also stores the DOM object - >KJS::DOMObject cache.
-   */
-  class ScriptInterpreter : public Interpreter
-  {
-  public:
-    ScriptInterpreter(JSObject *global, WebCore::Frame *frame);
-
-    static DOMObject* getDOMObject(void* objectHandle);
-    static void putDOMObject(void* objectHandle, DOMObject* obj);
-    static void forgetDOMObject(void* objectHandle);
-
-    static DOMNode *getDOMNodeForDocument(WebCore::Document *document, WebCore::Node *node);
-    static void putDOMNodeForDocument(WebCore::Document *document, WebCore::Node *nodeHandle, DOMNode *nodeWrapper);
-    static void forgetDOMNodeForDocument(WebCore::Document *document, WebCore::Node *node);
-    static void forgetAllDOMNodesForDocument(WebCore::Document *document);
-    static void updateDOMNodeDocument(WebCore::Node *nodeHandle, WebCore::Document *oldDoc, WebCore::Document *newDoc);
-
-    WebCore::Frame* frame() const { return m_frame; }
-
-    virtual int rtti() { return 1; }
-
     /**
-     * Set the event that is triggering the execution of a script, if any
+     * Base class for all objects in this binding.
      */
-    void setCurrentEvent( WebCore::Event *evt ) { m_evt = evt; }
-    void setInlineCode( bool inlineCode ) { m_inlineCode = inlineCode; }
-    void setProcessingTimerCallback( bool timerCallback ) { m_timerCallback = timerCallback; }
+    class DOMObject : public JSObject {
+    protected:
+        // DOMObject Destruction is not thread-safe because JS DOM objects 
+        // wrap unsafe WebCore DOM data structures
+        DOMObject() : JSObject(false) {}
+    public:
+        virtual UString toString(ExecState *exec) const;
+    };
+
+    class DOMNode;
+
     /**
-     * "Smart" window.open policy
+     * We inherit from Interpreter, to save a pointer to the HTML part
+     * that the interpreter runs for.
+     * The interpreter also stores the DOM object -> KJS::DOMObject cache.
      */
-    bool wasRunByUserGesture() const;
+    class ScriptInterpreter : public Interpreter {
+    public:
+        ScriptInterpreter(JSObject* global, WebCore::Frame*);
 
-    virtual void mark(bool currentThreadIsMainThread);
-    virtual ExecState *globalExec();
-    
-    WebCore::Event *getCurrentEvent() const { return m_evt; }
+        static DOMObject* getDOMObject(void* objectHandle);
+        static void putDOMObject(void* objectHandle, DOMObject*);
+        static void forgetDOMObject(void* objectHandle);
+
+        static DOMNode *getDOMNodeForDocument(WebCore::Document*, WebCore::Node*);
+        static void putDOMNodeForDocument(WebCore::Document*, WebCore::Node*, DOMNode *nodeWrapper);
+        static void forgetDOMNodeForDocument(WebCore::Document*, WebCore::Node*);
+        static void forgetAllDOMNodesForDocument(WebCore::Document*);
+        static void updateDOMNodeDocument(WebCore::Node*, WebCore::Document* oldDoc, WebCore::Document* newDoc);
+
+        WebCore::Frame* frame() const { return m_frame; }
+
+        virtual int rtti() { return 1; }
 
-    virtual bool isGlobalObject(JSValue *v);
-    virtual Interpreter *interpreterForGlobalObject (const JSValue *imp);
-    virtual bool isSafeScript (const Interpreter *target);
-    virtual void *createLanguageInstanceForValue (ExecState *exec, int language, JSObject *value, const Bindings::RootObject *origin, const Bindings::RootObject *current);
-    void *createObjcInstanceForValue (ExecState *exec, JSObject *value, const Bindings::RootObject *origin, const Bindings::RootObject *current);
+        /**
+         * Set the event that is triggering the execution of a script, if any
+         */
+        void setCurrentEvent(WebCore::Event* event) { m_currentEvent = event; }
+        void setInlineCode(bool inlineCode) { m_inlineCode = inlineCode; }
+        void setProcessingTimerCallback(bool timerCallback) { m_timerCallback = timerCallback; }
 
-    virtual bool shouldInterruptScript() const;
+        /**
+         * "Smart" window.open policy
+         */
+        bool wasRunByUserGesture() const;
 
-  protected:
-    virtual ~ScriptInterpreter() { } // only deref on the base class should delete us
+        virtual void mark(bool currentThreadIsMainThread);
+        virtual ExecState* globalExec();
+
+        WebCore::Event* getCurrentEvent() const { return m_currentEvent; }
+
+        virtual bool isGlobalObject(JSValue*);
+        virtual Interpreter* interpreterForGlobalObject(const JSValue*);
+        virtual bool isSafeScript(const Interpreter* target);
+        virtual void* createLanguageInstanceForValue(ExecState*, int language, JSObject* value,
+            const Bindings::RootObject* origin, const Bindings::RootObject* current);
+        void* createObjcInstanceForValue(ExecState*, JSObject* value,
+            const Bindings::RootObject* origin, const Bindings::RootObject* current);
+
+        virtual bool shouldInterruptScript() const;
+
+    private:
+        virtual ~ScriptInterpreter() { } // only deref on the base class should delete us
     
-  private:
-    WebCore::Frame* m_frame;
-
-    WebCore::Event *m_evt;
-    bool m_inlineCode;
-    bool m_timerCallback;
-  };
-
-  /**
-   * Retrieve from cache, or create, a KJS object around a DOM object
-   */
-  template<class DOMObj, class KJSDOMObj>
-  inline JSValue *cacheDOMObject(ExecState *exec, DOMObj *domObj)
-  {
-    if (!domObj)
-      return jsNull();
-    ScriptInterpreter *interp = static_cast<ScriptInterpreter *>(exec->dynamicInterpreter());
-    if (DOMObject *ret = interp->getDOMObject(domObj))
-      return ret;
-    DOMObject *ret = new KJSDOMObj(exec, domObj);
-    interp->putDOMObject(domObj, ret);
-    return ret;
-  }
-
-  // Convert a DOM implementation exception code into a JavaScript exception in the execution state.
-  void setDOMException(ExecState*, WebCore::ExceptionCode);
-
-  // Helper class to call setDOMException on exit without adding lots of separate calls to that function.
-  class DOMExceptionTranslator {
-  public:
-    explicit DOMExceptionTranslator(ExecState *exec) : m_exec(exec), m_code(0) { }
-    ~DOMExceptionTranslator() { setDOMException(m_exec, m_code); }
-    operator WebCore::ExceptionCode&() { return m_code; }
-  private:
-    ExecState *m_exec;
-    WebCore::ExceptionCode m_code;
-  };
-
-  /**
-   *  Get a String object, or jsNull() if s is null
-   */
-  JSValue *jsStringOrNull(const WebCore::String&);
-
-  /**
-   *  Get a String object, or jsUndefined() if s is null
-   */
-  JSValue *jsStringOrUndefined(const WebCore::String&);
-
-  JSValue *jsStringOrFalse(const WebCore::String&);
-
-
-  /**
-   *  Get a String object or a null String if the value is null
-   */
-  WebCore::String valueToStringWithNullCheck(ExecState* exec, JSValue* val);
-
-  template <typename T> inline JSValue* toJS(ExecState* exec, PassRefPtr<T> ptr) { return toJS(exec, ptr.get()); }
+        WebCore::Frame* m_frame;
+        WebCore::Event* m_currentEvent;
+        bool m_inlineCode;
+        bool m_timerCallback;
+    };
+
+    /**
+     * Retrieve from cache, or create, a KJS object around a DOM object
+     */
+    template<class DOMObj, class KJSDOMObj> inline JSValue *cacheDOMObject(ExecState* exec, DOMObj* domObj)
+    {
+        if (!domObj)
+            return jsNull();
+        ScriptInterpreter* interp = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter());
+        if (DOMObject* ret = interp->getDOMObject(domObj))
+            return ret;
+        DOMObject* ret = new KJSDOMObj(exec, domObj);
+        interp->putDOMObject(domObj, ret);
+        return ret;
+    }
+
+    // Convert a DOM implementation exception code into a JavaScript exception in the execution state.
+    void setDOMException(ExecState*, WebCore::ExceptionCode);
+
+    // Helper class to call setDOMException on exit without adding lots of separate calls to that function.
+    class DOMExceptionTranslator : Noncopyable {
+    public:
+        explicit DOMExceptionTranslator(ExecState* exec) : m_exec(exec), m_code(0) { }
+        ~DOMExceptionTranslator() { setDOMException(m_exec, m_code); }
+        operator WebCore::ExceptionCode&() { return m_code; }
+    private:
+        ExecState* m_exec;
+        WebCore::ExceptionCode m_code;
+    };
+
+    JSValue* jsStringOrNull(const WebCore::String&); // null if the string is null
+    JSValue* jsStringOrUndefined(const WebCore::String&); // undefined if the string is null
+    JSValue* jsStringOrFalse(const WebCore::String&); // boolean false if the string is null
+    WebCore::String valueToStringWithNullCheck(ExecState*, JSValue*); // null String if the value is null
+
+    template <typename T> inline JSValue* toJS(ExecState* exec, PassRefPtr<T> ptr) { return toJS(exec, ptr.get()); }
   
 } // namespace
 
index 275bcd6..3a306e3 100644 (file)
@@ -78,7 +78,7 @@ namespace WebCore {
         HashSet<AXID, IntHash<AXID>, AXIDHashTraits> m_idsInUse;
     };
 
-#ifndef __APPLE__
+#if !PLATFORM(MAC)
     inline AXObjectCache::~AXObjectCache() { }
     inline WebCoreAXObject* AXObjectCache::get(RenderObject*) { return 0; }
     inline void AXObjectCache::remove(RenderObject*) { }
index e4842c9..5218630 100644 (file)
@@ -28,6 +28,7 @@
 
 #import "BlockExceptions.h"
 #import "FloatRect.h"
+#import "FrameLoader.h"
 #import "FrameLoadRequest.h"
 #import "FrameMac.h"
 #import "FrameTree.h"
@@ -60,7 +61,7 @@ void BrowserExtensionMac::createNewWindow(const FrameLoadRequest& request,
     if (!request.m_frameName.isEmpty()) {
         if (Frame* frame = m_frame->tree()->find(request.m_frameName)) {
             if (!url.isEmpty())
-                Mac(frame)->loadRequest(request, true, nil, nil, nil);
+                frame->loader()->load(request, true, nil, 0, HashMap<String, String>());
             [Mac(frame)->bridge() activateWindow];
             newFrame = frame;
             return;
index 2998be7..e7f1109 100644 (file)
@@ -114,14 +114,13 @@ public:
     ~FrameMac();
 
     // FIXME: Merge these and move them into FrameLoader.
-    void loadRequest(const FrameLoadRequest&, bool userGesture, NSEvent* triggeringEvent = 0, Element* submitForm = 0, NSMutableDictionary* formValues = 0);
     virtual void urlSelected(const FrameLoadRequest&, const Event* triggeringEvent);
     virtual Frame* createFrame(const KURL&, const String& name, Element* ownerElement, const String& referrer);
-    void openURLFromPageCache(WebCorePageState*);
     virtual void submitForm(const FrameLoadRequest&);
 
-    virtual Plugin* createPlugin(Element* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType);
-    
+    virtual Plugin* createPlugin(Element*, const KURL&,
+        const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType);
+
     void clear(bool clearWindowProperties = true);
 
     void setBridge(WebCoreFrameBridge* p);
index 1671e30..3019494 100644 (file)
@@ -43,7 +43,6 @@
 #import "EventNames.h"
 #import "FloatRect.h"
 #import "FontData.h"
-#import "FormDataMac.h"
 #import "FoundationExtras.h"
 #import "FrameLoadRequest.h"
 #import "FrameLoader.h"
@@ -60,6 +59,7 @@
 #import "Logging.h"
 #import "MouseEventWithHitTestResults.h"
 #import "HitTestResult.h"
+#import "Page.h"
 #import "PlatformKeyboardEvent.h"
 #import "PlatformScrollBar.h"
 #import "PlatformWheelEvent.h"
@@ -100,9 +100,6 @@ using namespace std;
 using namespace KJS::Bindings;
 
 using KJS::JSLock;
-using KJS::PausedTimeouts;
-using KJS::SavedBuiltins;
-using KJS::SavedProperties;
 
 namespace WebCore {
 
@@ -111,18 +108,6 @@ using namespace HTMLNames;
 
 NSEvent* FrameMac::_currentEvent = nil;
 
-static NSMutableDictionary* createNSDictionary(const HashMap<String, String>& map)
-{
-    NSMutableDictionary* dict = [[NSMutableDictionary alloc] initWithCapacity:map.size()];
-    HashMap<String, String>::const_iterator end = map.end();
-    for (HashMap<String, String>::const_iterator it = map.begin(); it != end; ++it) {
-        NSString* key = it->first;
-        NSString* object = it->second;
-        [dict setObject:object forKey:key];
-    }
-    return dict;
-}
-
 static const unsigned int escChar = 27;
 static SEL selectorForKeyEvent(const PlatformKeyboardEvent* event)
 {
@@ -186,50 +171,6 @@ FrameMac::~FrameMac()
 
 #pragma mark BEGIN LOADING FUNCTIONS
 
-void FrameMac::loadRequest(const FrameLoadRequest& request, bool userGesture, NSEvent* triggeringEvent, Element* submitForm, NSMutableDictionary* formValues)
-{
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    
-    String referrer;
-    String argsReferrer = request.m_request.httpReferrer();
-    if (!argsReferrer.isEmpty())
-        referrer = argsReferrer;
-    else
-        referrer = FrameMac::referrer();
-    bool hideReferrer;
-    if (!loader()->canLoad(request.m_request.url().getNSURL(), referrer, hideReferrer))
-        return;
-    if (hideReferrer)
-        referrer = String();
-    
-    FrameMac *target = Mac(tree()->find(request.m_frameName));
-    WebCoreFrameBridge *targetFrame = target ? target->bridge() : nil;
-    if (![_bridge canTargetLoadInFrame:targetFrame])
-        return;
-        
-    if (request.m_request.httpMethod() != "POST") {
-        FrameLoadType loadType;
-        if (request.m_request.cachePolicy() == ReloadIgnoringCacheData)
-            loadType = FrameLoadTypeReload;
-        else if (!userGesture)
-            loadType = FrameLoadTypeInternal;
-        else
-            loadType = FrameLoadTypeStandard;    
-    
-        d->m_frameLoader->load(request.m_request.url().getNSURL(), referrer, loadType, 
-            (request.m_frameName.length() ? (NSString *)request.m_frameName : nil), triggeringEvent, submitForm, formValues);
-    } else
-        d->m_frameLoader->post(request.m_request.url().getNSURL(), referrer, (request.m_frameName.length() ? (NSString *)request.m_frameName : nil), 
-            arrayFromFormData(request.m_request.httpBody()), request.m_request.httpContentType(), triggeringEvent, submitForm, formValues);
-
-    if (targetFrame != nil && _bridge != targetFrame) {
-        [targetFrame activateWindow];
-    }
-    
-    END_BLOCK_OBJC_EXCEPTIONS;
-}
-
 void FrameMac::submitForm(const FrameLoadRequest& request)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
@@ -258,11 +199,9 @@ void FrameMac::submitForm(const FrameLoadRequest& request)
         d->m_submittedFormURL = request.m_request.url();
     }
 
-    NSMutableDictionary* formValues = createNSDictionary(d->m_formValuesAboutToBeSubmitted);
-    
-    loadRequest(request, true, _currentEvent, d->m_formAboutToBeSubmitted.get(), formValues);
+    loader()->load(request, true, _currentEvent,
+        d->m_formAboutToBeSubmitted.get(), d->m_formValuesAboutToBeSubmitted);
 
-    [formValues release];
     clearRecordedFormValues();
 
     END_BLOCK_OBJC_EXCEPTIONS;
@@ -275,81 +214,7 @@ void FrameMac::urlSelected(const FrameLoadRequest& request, const Event* /*trigg
         copy.m_request.setHTTPReferrer(referrer());
 
     // FIXME: How do we know that userGesture is always true?
-    loadRequest(copy, true, _currentEvent);
-}
-
-void FrameMac::openURLFromPageCache(WebCorePageState *state)
-{
-    // It's safe to assume none of the WebCorePageState methods will raise
-    // exceptions, since WebCorePageState is implemented by WebCore and
-    // does not throw
-
-    Document *doc = [state document];
-    Node *mousePressNode = [state mousePressNode];
-    KURL *kurl = [state URL];
-    SavedProperties *windowProperties = [state windowProperties];
-    SavedProperties *locationProperties = [state locationProperties];
-    SavedBuiltins *interpreterBuiltins = [state interpreterBuiltins];
-    PausedTimeouts *timeouts = [state pausedTimeouts];
-    
-    cancelRedirection();
-
-    // We still have to close the previous part page.
-    closeURL();
-            
-    d->m_bComplete = false;
-    
-    // Don't re-emit the load event.
-    d->m_bLoadEventEmitted = true;
-    
-    // delete old status bar msg's from kjs (if it _was_ activated on last URL)
-    if (jScriptEnabled()) {
-        d->m_kjsStatusBarText = String();
-        d->m_kjsDefaultStatusBarText = String();
-    }
-
-    ASSERT(kurl);
-    
-    d->m_url = *kurl;
-    
-    // initializing 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)
-    if (url().protocol().startsWith("http") && !url().host().isEmpty() && url().path().isEmpty())
-        d->m_url.setPath("/");
-    
-    // copy to m_workingURL after fixing url() above
-    d->m_workingURL = url();
-        
-    started();
-    
-    // -----------begin-----------
-    clear();
-
-    doc->setInPageCache(NO);
-
-    d->m_bCleared = false;
-    d->m_bComplete = false;
-    d->m_bLoadEventEmitted = false;
-    d->m_referrer = url().url();
-    
-    setView(doc->view());
-    
-    d->m_doc = doc;
-    d->m_mousePressNode = mousePressNode;
-    d->m_decoder = doc->decoder();
-
-    updatePolicyBaseURL();
-
-    { // scope the lock
-        JSLock lock;
-        restoreWindowProperties(windowProperties);
-        restoreLocationProperties(locationProperties);
-        restoreInterpreterBuiltins(*interpreterBuiltins);
-    }
-
-    resumeTimeouts(timeouts);
-    
-    checkCompleted();
+    loader()->load(copy, true, _currentEvent, 0, HashMap<String, String>());
 }
 
 Frame* FrameMac::createFrame(const KURL& url, const String& name, Element* ownerElement, const String& referrer)
@@ -863,11 +728,7 @@ void FrameMac::stopRedirectionTimer()
 
 String FrameMac::userAgent() const
 {
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    return [_bridge userAgentForURL:url().getNSURL()];
-    END_BLOCK_OBJC_EXCEPTIONS;
-         
-    return String();
+    return loader()->client()->userAgent(url().getNSURL());
 }
 
 String FrameMac::mimeTypeForFileName(const String& fileName) const
@@ -1464,9 +1325,9 @@ bool FrameMac::passMouseDownEventToWidget(Widget* widget)
     // mouse. We should confirm that, and then remove the deferrsLoading
     // hack entirely.
     
-    BOOL wasDeferringLoading = [_bridge defersLoading];
+    bool wasDeferringLoading = page()->defersLoading();
     if (!wasDeferringLoading)
-        [_bridge setDefersLoading:YES];
+        page()->setDefersLoading(true);
 
     ASSERT(!_sendingEventToSubview);
     _sendingEventToSubview = true;
@@ -1474,7 +1335,7 @@ bool FrameMac::passMouseDownEventToWidget(Widget* widget)
     _sendingEventToSubview = false;
     
     if (!wasDeferringLoading)
-        [_bridge setDefersLoading:NO];
+        page()->setDefersLoading(false);
 
     // Remember which view we sent the event to, so we can direct the release event properly.
     _mouseDownView = view;
@@ -1686,14 +1547,13 @@ void FrameMac::handleMouseMoveEvent(const MouseEventWithHitTestResults& event)
                     
                     if (mouseDownMayStartDrag()) {
                         // gather values from DHTML element, if it set any
-                        _dragClipboard->sourceOperation(&srcOp);
+                        _dragClipboard->sourceOperation(srcOp);
 
                         NSArray *types = [pasteboard types];
                         wcWrotePasteboard = types && [types count] > 0;
 
-                        if (_dragSrcMayBeDHTML) {
-                            dragImage = _dragClipboard->dragNSImage(&dragLoc);
-                        }
+                        if (_dragSrcMayBeDHTML)
+                            dragImage = _dragClipboard->dragNSImage(dragLoc);
                         
                         // Yuck, dragSourceMovedTo() can be called as a result of kicking off the drag with
                         // dragImage!  Because of that dumb reentrancy, we may think we've not started the
index 044cb05..37106f5 100644 (file)
@@ -32,8 +32,8 @@ namespace WebCore {
 Page::Page(WebCorePageBridge* bridge)
     : m_frameCount(0)
     , m_dragCaretController(0, true)
+    , m_defersLoading(false)
     , m_bridge(bridge)
-
 {
     init();
 }
index f346871..f44f7f8 100644 (file)
@@ -37,7 +37,7 @@ using namespace WebCore;
 {
     ASSERT(command);
     [super init];
-    m_command = command.release();
+    m_command = command.releaseRef();
     return self;
 }
 
index 59bbb4c..5fb2d86 100644 (file)
@@ -204,16 +204,10 @@ typedef enum {
 + (NSArray *)supportedImageMIMETypes;
 + (NSArray *)supportedImageResourceMIMETypes; // includes types like PDF
 
-- (void)openURL:(NSURL *)URL reload:(BOOL)reload
-    contentType:(NSString *)contentType refresh:(NSString *)refresh lastModified:(NSDate *)lastModified
-    pageCache:(NSDictionary *)pageCache;
 - (void)addData:(NSData *)data;
-- (void)closeURL;
 
 - (void)invalidatePageCache:(NSDictionary *)pageCache;
 
-- (BOOL)canTargetLoadInFrame:(WebCoreFrameBridge *)targetFrame;
-
 - (void)saveDocumentState;
 - (void)restoreDocumentState;
 
@@ -230,8 +224,6 @@ typedef enum {
 
 - (void)createFrameViewWithNSView:(NSView *)view marginWidth:(int)mw marginHeight:(int)mh;
 
-- (BOOL)isFrameSet;
-
 - (void)reapplyStylesForDeviceType:(WebCoreDeviceType)deviceType;
 - (void)forceLayoutAdjustingViewSize:(BOOL)adjustSizeFlag;
 - (void)forceLayoutWithMinimumPageWidth:(float)minPageWidth maximumPageWidth:(float)maxPageWidth adjustingViewSize:(BOOL)adjustSizeFlag;
@@ -420,8 +412,6 @@ typedef enum {
 - (WebCorePageBridge *)createWindowWithURL:(NSURL *)URL;
 - (void)showWindow;
 
-- (NSString *)userAgentForURL:(NSURL *)URL;
-
 - (void)setStatusText:(NSString *)status;
 
 - (WebCoreFrameBridge *)createChildFrameNamed:(NSString *)frameName withURL:(NSURL *)URL referrer:(const WebCore::String&)referrer ownerElement:(WebCoreElement *)ownerElement allowsScrolling:(BOOL)allowsScrolling marginWidth:(int)width marginHeight:(int)height;
@@ -466,8 +456,6 @@ typedef enum {
 - (NSView *)nextValidKeyViewOutsideWebFrameViews;
 - (NSView *)previousKeyViewOutsideWebFrameViews;
 
-- (BOOL)defersLoading;
-- (void)setDefersLoading:(BOOL)loading;
 - (void)saveDocumentState:(NSArray *)documentState;
 - (NSArray *)documentState;
 
index eefaaef..7f1300d 100644 (file)
@@ -157,11 +157,6 @@ static void updateRenderingForBindings(ExecState* exec, JSObject* rootObject)
         doc->updateRendering();
 }
 
-static BOOL isCaseSensitiveEqual(NSString *a, NSString *b)
-{
-    return [a caseInsensitiveCompare:b] == NSOrderedSame;
-}
-
 static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue* jsValue)
 {
     NSAppleEventDescriptor* aeDesc = 0;
@@ -294,37 +289,6 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
 }
 #endif
 
-- (BOOL)canTargetLoadInFrame:(WebCoreFrameBridge *)targetFrame
-{
-    // This method prevents this exploit:
-    // <rdar://problem/3715785> multiple frame injection vulnerability reported by Secunia, affects almost all browsers
-    
-    Frame *target = [targetFrame _frame];
-
-    // don't mess with navigation within the same page/frameset
-    if (m_frame->page() == (target ? target->page() : nil))
-        return YES;
-
-    // Normally, domain should be called on the DOMDocument since it is a DOM method, but this fix is needed for
-    // Jaguar as well where the DOM API doesn't exist.
-    NSString *thisDomain = [self domain];
-    if ([thisDomain length] == 0)
-        // Allow if the request is made from a local file.
-        return YES;
-    
-    WebCoreFrameBridge *parentBridge = target ? Mac(target->tree()->parent())->bridge() : nil;
-    // Allow if target is an entire window.
-    if (!parentBridge)
-        return YES;
-    
-    NSString *parentDomain = [parentBridge domain];
-    // Allow if the domain of the parent of the targeted frame equals this domain.
-    if (parentDomain && isCaseSensitiveEqual(thisDomain, parentDomain))
-        return YES;
-
-    return NO;
-}
-
 + (NSArray *)supportedNonImageMIMETypes
 {
     return [NSArray arrayWithObjects:        
@@ -455,30 +419,6 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
     _closed = YES;
 }
 
-- (void)openURL:(NSURL *)URL reload:(BOOL)reload contentType:(NSString *)contentType refresh:(NSString *)refresh lastModified:(NSDate *)lastModified pageCache:(NSDictionary *)pageCache
-{
-    if (pageCache) {
-        WebCorePageState *state = [pageCache objectForKey:WebCorePageCacheStateKey];
-        m_frame->openURLFromPageCache(state);
-        [state invalidate];
-        return;
-    }
-        
-    m_frame->setResponseMIMEType(contentType);
-    
-    // opening the URL
-    if (m_frame->didOpenURL(URL)) {
-        // things we have to set up after calling didOpenURL
-        if (refresh) {
-            m_frame->addMetaData("http-refresh", refresh);
-        }
-        if (lastModified) {
-            NSString *modifiedString = [lastModified descriptionWithCalendarFormat:@"%a %b %d %Y %H:%M:%S" timeZone:nil locale:nil];
-            m_frame->addMetaData("modified", modifiedString);
-        }
-    }
-}
-
 - (void)addData:(NSData *)data
 {
     Document *doc = m_frame->document();
@@ -493,11 +433,6 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
     }
 }
 
-- (void)closeURL
-{
-    m_frame->closeURL();
-}
-
 - (void)invalidatePageCache:(NSDictionary *)pageCache
 {
     // We might have made a page cache item, but now we're bailing out due to an error before we ever
@@ -703,11 +638,6 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
     m_frame->selectionController()->clear();
 }
 
-- (BOOL)isFrameSet
-{
-    return m_frame->isFrameSet();
-}
-
 - (void)reapplyStylesForDeviceType:(WebCoreDeviceType)deviceType
 {
     m_frame->setMediaType(deviceType == WebCoreDeviceScreen ? "screen" : "print");
@@ -1907,7 +1837,7 @@ static PlatformMouseEvent createMouseEventFromDraggingInfo(NSWindow* window, id
             PlatformMouseEvent event = createMouseEventFromDraggingInfo([self window], info);
             if (v->updateDragAndDrop(event, clipboard.get())) {
                 // *op unchanged if no source op was set
-                if (!clipboard->destinationOperation(&op)) {
+                if (!clipboard->destinationOperation(op)) {
                     // The element accepted but they didn't pick an operation, so we pick one for them
                     // (as does WinIE).
                     if (srcOp & NSDragOperationCopy)
@@ -2174,7 +2104,7 @@ static NSCharacterSet *_getPostSmartSet(void)
         setHTTPReferrer(request, referrer);
     
     [request setMainDocumentURL:[m_frame->page()->mainFrame()->loader()->documentLoader()->request() URL]];
-    [request setValue:[self userAgentForURL:[request URL]] forHTTPHeaderField:@"User-Agent"];
+    [request setValue:m_frame->loader()->client()->userAgent([request URL]) forHTTPHeaderField:@"User-Agent"];
     
     NSError *error = nil;
     id identifier = nil;    
index 7c8710c..ee0668d 100644 (file)
@@ -80,7 +80,7 @@ static const int computedProperties[] = {
     CSS_PROP_CLEAR,
     CSS_PROP_COLOR,
     CSS_PROP_CURSOR,
-#if __APPLE__
+#if PLATFORM(MAC)
     CSS_PROP__WEBKIT_DASHBOARD_REGION,
 #endif
     CSS_PROP_DIRECTION,
@@ -1346,7 +1346,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
     case CSS_PROP_PADDING:
         // FIXME: unimplemented
         break;
-#if __APPLE__
+#if PLATFORM(MAC)
         case CSS_PROP__WEBKIT_DASHBOARD_REGION: {
             const Vector<StyleDashboardRegion>& regions = style->dashboardRegions();
             unsigned count = regions.size();
index 2096ec1..cb20a3d 100644 (file)
@@ -131,20 +131,20 @@ CSSPrimitiveValue::CSSPrimitiveValue(const String& str, UnitTypes type)
 
 CSSPrimitiveValue::CSSPrimitiveValue(PassRefPtr<Counter> c)
 {
-    m_value.counter = c.release();
+    m_value.counter = c.releaseRef();
     m_type = CSS_COUNTER;
 }
 
 CSSPrimitiveValue::CSSPrimitiveValue(PassRefPtr<RectImpl> r)
 {
-    m_value.rect = r.release();
+    m_value.rect = r.releaseRef();
     m_type = CSS_RECT;
 }
 
-#if __APPLE__
+#if PLATFORM(MAC)
 CSSPrimitiveValue::CSSPrimitiveValue(PassRefPtr<DashboardRegion> r)
 {
-    m_value.region = r.release();
+    m_value.region = r.releaseRef();
     m_type = CSS_DASHBOARD_REGION;
 }
 #endif
@@ -157,7 +157,7 @@ CSSPrimitiveValue::CSSPrimitiveValue(RGBA32 color)
 
 CSSPrimitiveValue::CSSPrimitiveValue(PassRefPtr<Pair> p)
 {
-    m_value.pair = p.release();
+    m_value.pair = p.releaseRef();
     m_type = CSS_PAIR;
 }
 
@@ -184,7 +184,7 @@ void CSSPrimitiveValue::cleanup()
     case CSS_PAIR:
         m_value.pair->deref();
         break;
-#if __APPLE__
+#if PLATFORM(MAC)
     case CSS_DASHBOARD_REGION:
         if (m_value.region)
             m_value.region->deref();
@@ -557,7 +557,7 @@ String CSSPrimitiveValue::cssText() const
             text += " ";
             text += m_value.pair->second()->cssText();
             break;
-#if __APPLE__
+#if PLATFORM(MAC)
         case CSS_DASHBOARD_REGION:
             for (DashboardRegion* region = getDashboardRegionValue(); region; region = region->m_next.get()) {
                 text = "dashboard-region(";
index 1341b86..331f2b6 100644 (file)
@@ -81,7 +81,7 @@ public:
     CSSPrimitiveValue(unsigned color); // RGB value
     CSSPrimitiveValue(PassRefPtr<Pair>);
 
-#if __APPLE__
+#if PLATFORM(MAC)
     CSSPrimitiveValue(PassRefPtr<DashboardRegion>); // FIXME: Why is dashboard region a primitive value? This makes no sense.
 #endif
 
@@ -134,7 +134,7 @@ public:
         return m_type != CSS_PAIR ? 0 : m_value.pair;
     }
 
-#if __APPLE__
+#if PLATFORM(MAC)
     DashboardRegion *getDashboardRegionValue () const {
         return m_type != CSS_DASHBOARD_REGION ? 0 : m_value.region;
     }
@@ -160,7 +160,7 @@ protected:
         RectImpl* rect;
         unsigned rgbcolor;
         Pair* pair;
-#if __APPLE__
+#if PLATFORM(MAC)
         DashboardRegion* region;
 #endif
     } m_value;
index 26b46f9..96aca50 100644 (file)
@@ -39,7 +39,7 @@ unsigned short CSSValueList::cssValueType() const
 
 void CSSValueList::append(PassRefPtr<CSSValue> val)
 {
-    m_values.append(val.release());
+    m_values.append(val.releaseRef());
 }
 
 String CSSValueList::cssText() const
index 7195f0a..67b8295 100644 (file)
@@ -1238,7 +1238,7 @@ bool CSSParser::parseValue(int propId, bool important)
             valid_primitive = true;
         break;
 
-#if __APPLE__
+#if PLATFORM(MAC)
     case CSS_PROP__WEBKIT_DASHBOARD_REGION:                 // <dashboard-region> | <dashboard-region> 
         if (value->unit == Value::Function || id == CSS_VAL_NONE)
             return parseDashboardRegions(propId, important);
@@ -1905,7 +1905,8 @@ failed:
     return false;
 }
 
-#if __APPLE__
+#if PLATFORM(MAC)
+
 #define DASHBOARD_REGION_NUM_PARAMETERS  6
 #define DASHBOARD_REGION_SHORT_NUM_PARAMETERS  2
 
index 7650329..99ebfb4 100644 (file)
@@ -140,7 +140,7 @@ namespace WebCore {
 
         void addBackgroundValue(CSSValue*& lval, CSSValue* rval);
       
-#if __APPLE__
+#if PLATFORM(MAC)
         bool parseDashboardRegions(int propId, bool important);
 #endif
 
index 0a9c2b5..9532ec6 100644 (file)
@@ -4109,7 +4109,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
         }
         style->setTextSecurity(textSecurity);
     }
-#if __APPLE__
+#if PLATFORM(MAC)
     case CSS_PROP__WEBKIT_DASHBOARD_REGION: {
         HANDLE_INHERIT_AND_INITIAL(dashboardRegions, DashboardRegions)
         if (!primitiveValue)
index 5d4b700..b56c74f 100644 (file)
@@ -229,7 +229,7 @@ Document::Document(DOMImplementation* impl, FrameView *v)
 #ifdef SVG_SUPPORT
     , m_svgExtensions(0)
 #endif
-#if __APPLE__
+#if PLATFORM(MAC)
     , m_hasDashboardRegions(false)
     , m_dashboardRegionsDirty(false)
 #endif
@@ -1103,14 +1103,13 @@ void Document::updateSelection()
         }
     }
     
-#if __APPLE__
-    // FIXME: We shouldn't post this AX notification here since updateSelection() is called far to often: every time Safari gains
+#if PLATFORM(MAC)
+    // FIXME: We shouldn't post this AX notification here since updateSelection() is called far too often: every time Safari gains
     // or loses focus, and once for every low level change to the selection during an editing operation.
     // FIXME: We no longer blow away the selection before starting an editing operation, so the isNotNull checks below are no 
     // longer a correct way to check for user-level selection changes.
-    if (AXObjectCache::accessibilityEnabled() && selection.start().isNotNull() && selection.end().isNotNull()) {
+    if (AXObjectCache::accessibilityEnabled() && selection.start().isNotNull() && selection.end().isNotNull())
         axObjectCache()->postNotification(selection.start().node()->renderer(), "AXSelectedTextChanged");
-    }
 #endif
 }
 
@@ -1259,7 +1258,7 @@ void Document::implicitClose()
             view()->layout();
     }
 
-#if __APPLE__
+#if PLATFORM(MAC)
     if (renderer() && AXObjectCache::accessibilityEnabled())
         axObjectCache()->postNotificationToElement(renderer(), "AXLoadComplete");
 #endif
@@ -2001,7 +2000,7 @@ void Document::didEndEditing()
     frame()->didEndEditing();
 }
 
-#if __APPLE__
+#if PLATFORM(MAC)
 const Vector<DashboardRegionValue>& Document::dashboardRegions() const
 {
     return m_dashboardRegions;
@@ -2126,7 +2125,7 @@ bool Document::setFocusNode(PassRefPtr<Node> newFocusNode)
         }
    }
 
-#if __APPLE__
+#if PLATFORM(MAC)
     if (!focusChangeBlocked && m_focusNode && AXObjectCache::accessibilityEnabled())
         axObjectCache()->handleFocusedUIElementChanged();
 #endif
index c1129ab..e67f6b7 100644 (file)
@@ -93,9 +93,7 @@ namespace WebCore {
     class XPathResult;
 #endif
     
-#if __APPLE__
     struct DashboardRegionValue;
-#endif
 
 #ifdef SVG_SUPPORT
     class SVGDocumentExtensions;
@@ -736,7 +734,7 @@ public:
 
     UChar backslashAsCurrencySymbol() const;
 
-#if __APPLE__
+#if PLATFORM(MAC)
     void setDashboardRegionsDirty(bool f) { m_dashboardRegionsDirty = f; }
     bool dashboardRegionsDirty() const { return m_dashboardRegionsDirty; }
     bool hasDashboardRegions () const { return m_hasDashboardRegions; }
@@ -802,7 +800,7 @@ private:
     SVGDocumentExtensions* m_svgExtensions;
 #endif
     
-#if __APPLE__
+#if PLATFORM(MAC)
     Vector<DashboardRegionValue> m_dashboardRegions;
     bool m_hasDashboardRegions;
     bool m_dashboardRegionsDirty;
index 2f9ef9f..b49ca07 100644 (file)
@@ -27,8 +27,6 @@
 #define replace_selection_command_h__
 
 #include "CompositeEditCommand.h"
-#include <wtf/HashMap.h>
-#include <wtf/Vector.h>
 
 namespace WebCore {
 
index d239301..e21ef5b 100644 (file)
@@ -1032,8 +1032,8 @@ void HTMLParser::handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem)
         while (currElem->node != residualElem) {
             if (isResidualStyleTag(currElem->node->localName())) {
                 // Create a clone of this element.
-                // We call release to get a raw pointer since we plan to hand over ownership to currElem.
-                Node* currNode = currElem->node->cloneNode(false).release();
+                // We call releaseRef to get a raw pointer since we plan to hand over ownership to currElem.
+                Node* currNode = currElem->node->cloneNode(false).releaseRef();
 
                 // Change the stack element's node to point to the clone.
                 // The stack element adopts the reference we obtained above by calling release().
index 51dbe03..b3bd27d 100644 (file)
@@ -30,6 +30,7 @@
 #import <WebCore/PlatformString.h>
 #import <wtf/Forward.h>
 #import <wtf/HashSet.h>
+#import <wtf/HashMap.h>
 #import <wtf/Noncopyable.h>
 #import <wtf/RefPtr.h>
 
@@ -39,9 +40,9 @@
 #import <objc/objc.h>
 
 #ifdef __OBJC__
+
 @class WebCoreFrameBridge;
-@class WebCoreFrameLoaderAsDelegate;
-@class WebPolicyDecider;
+@class WebCorePageState;
 
 @class NSArray;
 @class NSDate;
@@ -62,8 +63,7 @@
 #else
 
 class WebCoreFrameBridge;
-class WebCoreFrameLoaderAsDelegate;
-class WebPolicyDecider;
+class WebCorePageState;
 
 class NSArray;
 class NSDate;
@@ -77,6 +77,7 @@ class NSError;
 class NSData;
 class NSMutableURLRequest;
 class NSURLAuthenticationChallenge;
+
 #endif // __OBJC__
 
 #endif // PLATFORM(MAC)
@@ -87,6 +88,7 @@ namespace WebCore {
     class Element;
     class FormState;
     class Frame;
+    class FrameLoadRequest;
     class FrameLoaderClient;
     class MainResourceLoader;
     class String;
@@ -95,6 +97,40 @@ namespace WebCore {
 
     bool isBackForwardLoadType(FrameLoadType);
 
+    typedef void (*NavigationPolicyDecisionFunction)(void* argument,
+        NSURLRequest *, PassRefPtr<FormState>);
+    typedef void (*NewWindowPolicyDecisionFunction)(void* argument,
+        NSURLRequest *, PassRefPtr<FormState>, const String& frameName);
+    typedef void (*ContentPolicyDecisionFunction)(void* argument, PolicyAction);
+
+    class PolicyCheck {
+    public:
+        PolicyCheck();
+
+        void clear();
+        void set(NSURLRequest *, PassRefPtr<FormState>,
+            NavigationPolicyDecisionFunction, void* argument);
+        void set(NSURLRequest *, PassRefPtr<FormState>, const String& frameName,
+            NewWindowPolicyDecisionFunction, void* argument);
+        void set(ContentPolicyDecisionFunction, void* argument);
+
+        NSURLRequest *request() const { return m_request.get(); }
+        void clearRequest();
+
+        void call();
+        void call(PolicyAction);
+
+    private:
+        RetainPtr<NSURLRequest> m_request;
+        RefPtr<FormState> m_formState;
+        String m_frameName;
+
+        NavigationPolicyDecisionFunction m_navigationFunction;
+        NewWindowPolicyDecisionFunction m_newWindowFunction;
+        ContentPolicyDecisionFunction m_contentFunction;
+        void* m_argument;
+    };
+
     class FrameLoader : Noncopyable {
     public:
         FrameLoader(Frame*);
@@ -109,13 +145,17 @@ namespace WebCore {
         void setupForReplaceByMIMEType(const String& newMIMEType);
         void finalSetupForReplace(DocumentLoader*);
         void safeLoad(NSURL *);
+        void load(const FrameLoadRequest&, bool userGesture, NSEvent* triggeringEvent,
+            Element* submitForm, const HashMap<String, String>& formValues);
+        void load(NSURL *, const String& referrer, FrameLoadType, const String& target, NSEvent *event,
+            Element* form, const HashMap<String, String>& formValues);
+        void post(NSURL *, const String& referrer, const String& target, NSArray *postData, const String& contentType, NSEvent *,
+            Element* form, const HashMap<String, String>&);
         void load(NSURLRequest *);
         void load(NSURLRequest *, const String& frameName);
         void load(NSURLRequest *, NSDictionary *triggeringAaction, FrameLoadType, PassRefPtr<FormState>);
         void load(DocumentLoader*);
         void load(DocumentLoader*, FrameLoadType, PassRefPtr<FormState>);
-        void load(NSURL *, const String& referrer, FrameLoadType, const String& target, 
-                  NSEvent *event, Element* form, NSDictionary *formValues);
 
         bool canLoad(NSURL *, const String& referrer, bool& hideReferrer);
 
@@ -143,8 +183,8 @@ namespace WebCore {
         void loadEmptyDocumentSynchronously();
 
 #ifdef __OBJC__
-        id <WebCoreResourceHandle> startLoadingResource(id <WebCoreResourceLoader> resourceLoader, const String& method, NSURL *URL, NSDictionary *customHeaders);
-        id <WebCoreResourceHandle> startLoadingResource(id <WebCoreResourceLoader> resourceLoader, const String& method, NSURL *URL, NSDictionary *customHeaders, NSArray *postData);
+        id <WebCoreResourceHandle> startLoadingResource(id <WebCoreResourceLoader>, const String& method, NSURL *, NSDictionary *customHeaders);
+        id <WebCoreResourceHandle> startLoadingResource(id <WebCoreResourceLoader>, const String& method, NSURL *, NSDictionary *customHeaders, NSArray *postData);
 #endif
         
         DocumentLoader* activeDocumentLoader() const;
@@ -153,8 +193,6 @@ namespace WebCore {
         FrameState state() const;
         static double timeOfLastCompletedLoad();
 
-        bool defersCallbacks() const;
-        void defersCallbacksChanged();
         id identifierForInitialRequest(NSURLRequest *);
         NSURLRequest *willSendRequest(WebResourceLoader*, NSMutableURLRequest *, NSURLResponse *redirectResponse);
         void didReceiveAuthenticationChallenge(WebResourceLoader*, NSURLAuthenticationChallenge *);
@@ -189,9 +227,11 @@ namespace WebCore {
         bool representationExistsForURLScheme(const String& URLScheme);
         String generatedMIMETypeForURLScheme(const String& URLScheme);
         void notifyIconChanged(NSURL *iconURL);
-        void checkNavigationPolicy(NSURLRequest *newRequest, id continuationObject, SEL continuationSelector);
-        void checkContentPolicy(const String& MIMEType, id continuationObject, SEL continuationSelector);
+
+        void checkNavigationPolicy(NSURLRequest *, NavigationPolicyDecisionFunction, void* argument);
+        void checkContentPolicy(const String& MIMEType, ContentPolicyDecisionFunction, void* argument);
         void cancelContentPolicyCheck();
+
         void reload();
         void reloadAllowingStaleData(const String& overrideEncoding);
 
@@ -220,7 +260,6 @@ namespace WebCore {
 
         void sendRemainingDelegateMessages(id identifier, NSURLResponse *, unsigned length, NSError *);
         NSURLRequest *requestFromDelegate(NSURLRequest *, id& identifier, NSError *& error);
-        void post(NSURL *, const String& referrer, const String& target, NSArray *postData, const String& contentType, NSEvent *, Element* form, NSDictionary *formValues);
         void loadedResourceFromMemoryCache(NSURLRequest *request, NSURLResponse *response, int length);
 
         void checkLoadComplete();
@@ -233,12 +272,7 @@ namespace WebCore {
         void setClient(FrameLoaderClient*);
         FrameLoaderClient* client() const;
 
-        void continueAfterWillSubmitForm(PolicyAction);
-        void continueAfterNewWindowPolicy(PolicyAction);
-        void continueAfterNavigationPolicy(PolicyAction);
-        void continueLoadRequestAfterNavigationPolicy(NSURLRequest *, FormState*);
-        void continueFragmentScrollAfterNavigationPolicy(NSURLRequest *);
-        void continueLoadRequestAfterNewWindowPolicy(NSURLRequest *, const String& frameName, FormState*);
+        void setDefersLoading(bool);
 #endif
 
     private:
@@ -248,7 +282,6 @@ namespace WebCore {
         bool startLoadingMainResource(NSMutableURLRequest *, id identifier);
         void stopLoadingSubframes();
 
-        void setDefersCallbacks(bool);
         void clearProvisionalLoad();
         void markLoadComplete();
         void commitProvisionalLoad();
@@ -259,9 +292,25 @@ namespace WebCore {
 
         void setLoadType(FrameLoadType);
 
-        void invalidatePendingPolicyDecision(bool callDefaultAction);
-        void checkNewWindowPolicy(NSURLRequest *, NSDictionary *, const String& frameName, PassRefPtr<FormState>);
-        void checkNavigationPolicy(NSURLRequest *, DocumentLoader*, PassRefPtr<FormState>, id continuationObject, SEL continuationSelector);
+        void checkNavigationPolicy(NSURLRequest *, DocumentLoader*, PassRefPtr<FormState>,
+            NavigationPolicyDecisionFunction, void* argument);
+        void checkNewWindowPolicy(NSDictionary *, NSURLRequest *, PassRefPtr<FormState>, const String& frameName);
+
+        void continueAfterNavigationPolicy(PolicyAction);
+        void continueAfterNewWindowPolicy(PolicyAction);
+        void continueAfterContentPolicy(PolicyAction);
+        void continueAfterWillSubmitForm(PolicyAction = PolicyUse);
+
+        static void callContinueLoadAfterNavigationPolicy(void*, NSURLRequest*, PassRefPtr<FormState>);
+        void continueLoadAfterNavigationPolicy(NSURLRequest *, PassRefPtr<FormState>);
+        static void callContinueLoadAfterNewWindowPolicy(void*, NSURLRequest*, PassRefPtr<FormState>, const String& frameName);
+        void continueLoadAfterNewWindowPolicy(NSURLRequest *, PassRefPtr<FormState>, const String& frameName);
+        static void callContinueFragmentScrollAfterNavigationPolicy(void*, NSURLRequest*, PassRefPtr<FormState>);
+        void continueFragmentScrollAfterNavigationPolicy(NSURLRequest *);
+
+        void stopPolicyCheck();
+
+        void closeDocument();
 
         void transitionToCommitted(NSDictionary *pageCache);
         void checkLoadCompleteForThisFrame();
@@ -274,15 +323,15 @@ namespace WebCore {
 
         void setState(FrameState);
 
-        WebCoreFrameBridge *bridge() const;
-
-        WebCoreFrameLoaderAsDelegate *asDelegate();
-
         void closeOldDataSources();
+        void open(NSURL *, bool reload, NSString *contentType, NSString *refresh, NSDate *lastModified, NSDictionary *pageCache);
+        void open(WebCorePageState *);
         void opened();
 
         void handleUnimplementablePolicy(NSError *);
         bool shouldReloadToHandleUnreachableURL(NSURLRequest *);
+
+        bool canTarget(Frame*) const;
 #endif
 
         Frame* m_frame;
@@ -294,23 +343,14 @@ namespace WebCore {
         RefPtr<MainResourceLoader> m_mainResourceLoader;
         HashSet<RefPtr<WebResourceLoader> > m_subresourceLoaders;
         HashSet<RefPtr<WebResourceLoader> > m_plugInStreamLoaders;
-    
-#if PLATFORM(MAC)
-        RetainPtr<WebCoreFrameLoaderAsDelegate> m_asDelegate;
 
+#if PLATFORM(MAC)
         RefPtr<DocumentLoader> m_documentLoader;
         RefPtr<DocumentLoader> m_provisionalDocumentLoader;
         RefPtr<DocumentLoader> m_policyDocumentLoader;
 
-        // state we'll need to continue after waiting for the policy delegate's decision
-        RetainPtr<WebPolicyDecider> m_policyDecider;    
-
-        RetainPtr<NSURLRequest> m_policyRequest;
-        String m_policyFrameName;
-        RetainPtr<id> m_policyTarget;
-        SEL m_policySelector;
-        RefPtr<FormState> m_policyFormState;
         FrameLoadType m_policyLoadType;
+        PolicyCheck m_policyCheck;
 
         bool m_delegateIsHandlingProvisionalLoadError;
         bool m_delegateIsDecidingNavigationPolicy;
index e27011b..be7f5ba 100644 (file)
 #import "Document.h"
 #import "DOMElementInternal.h"
 #import "Element.h"
+#import "FormDataMac.h"
 #import "FrameLoadRequest.h"
 #import "FrameMac.h"
+#import "FramePrivate.h"
 #import "FrameTree.h"
 #import "HTMLNames.h"
 #import "LoaderNSURLExtras.h"
 #import "LoaderNSURLRequestExtras.h"
 #import "Page.h"
+#import "Plugin.h"
 #import "WebCoreFrameBridge.h"
 #import "WebCoreIconDatabaseBridge.h"
+#import "WebCorePageState.h"
 #import "WebCoreSystemInterface.h"
 #import "WebDataProtocol.h"
 #import "WebDocumentLoader.h"
 #import "WebFormState.h"
 #import "WebFrameLoaderClient.h"
 #import "WebMainResourceLoader.h"
-#import "WebPolicyDecider.h"
 #import "WebSubresourceLoader.h"
 #import <objc/objc-runtime.h>
 #import <wtf/Assertions.h>
+#import <kjs/JSLock.h>
 
-using namespace WebCore;
-
-@interface WebCoreFrameLoaderAsDelegate : NSObject
-{
-    FrameLoader* m_loader;
-}
-- (id)initWithLoader:(FrameLoader*)loader;
-- (void)detachFromLoader;
-@end
+using KJS::JSLock;
+using KJS::PausedTimeouts;
+using KJS::SavedBuiltins;
+using KJS::SavedProperties;
 
 namespace WebCore {
 
@@ -128,7 +127,6 @@ FrameLoader::FrameLoader(Frame* frame)
 
 FrameLoader::~FrameLoader()
 {
-    [m_asDelegate.get() detachFromLoader];
     if (m_client)
         m_client->detachFrameLoader();
 }
@@ -163,49 +161,52 @@ void FrameLoader::safeLoad(NSURL *URL)
     FrameLoadRequest request;
     request.m_request.setURL(URL);
     request.m_request.setHTTPReferrer(urlOriginalDataAsString([m_documentLoader->request() URL]));
-    
-    Mac(m_frame)->loadRequest(request, true, [NSApp currentEvent], nil, nil);
-}
-
-void FrameLoader::load(NSURLRequest *request)
-{
-    // FIXME: is this the right place to reset loadType? Perhaps this should be done after loading is finished or aborted.
-    m_loadType = FrameLoadTypeStandard;
-    load(m_client->createDocumentLoader(request).get());
+    load(request, true, [NSApp currentEvent], 0, HashMap<String, String>());
 }
 
-void FrameLoader::load(NSURLRequest *request, const String& frameName)
+void FrameLoader::load(const FrameLoadRequest& request, bool userGesture, NSEvent* triggeringEvent,
+    Element* submitForm, const HashMap<String, String>& formValues)
 {
-    if (frameName.isNull()) {
-        load(request);
+    String referrer;
+    String argsReferrer = request.m_request.httpReferrer();
+    if (!argsReferrer.isEmpty())
+        referrer = argsReferrer;
+    else
+        referrer = m_frame->referrer();
+    bool hideReferrer;
+    if (!canLoad(request.m_request.url().getNSURL(), referrer, hideReferrer))
         return;
-    }
-
-    Frame* frame = m_frame->tree()->find(frameName);
-    if (frame) {
-        frame->loader()->load(request);
+    if (hideReferrer)
+        referrer = String();
+    
+    Frame* targetFrame = m_frame->tree()->find(request.m_frameName);
+    if (!canTarget(targetFrame))
         return;
-    }
-
-    NSDictionary *action = actionInformation(NavigationTypeOther, nil, [request URL]);
-    checkNewWindowPolicy(request, action, frameName, 0);
-}
-
-void FrameLoader::load(NSURLRequest *request, NSDictionary *action, FrameLoadType type, PassRefPtr<FormState> formState)
-{
-    RefPtr<DocumentLoader> loader = m_client->createDocumentLoader(request);
-    setPolicyDocumentLoader(loader.get());
-
-    loader->setTriggeringAction(action);
-    if (m_documentLoader)
-        loader->setOverrideEncoding(m_documentLoader->overrideEncoding());
+        
+    if (request.m_request.httpMethod() != "POST") {
+        FrameLoadType loadType;
+        if (request.m_request.cachePolicy() == ReloadIgnoringCacheData)
+            loadType = FrameLoadTypeReload;
+        else if (!userGesture)
+            loadType = FrameLoadTypeInternal;
+        else
+            loadType = FrameLoadTypeStandard;    
+    
+        load(request.m_request.url().getNSURL(), referrer, loadType, 
+            (request.m_frameName.length() ? (NSString *)request.m_frameName : nil), triggeringEvent, submitForm, formValues);
+    } else
+        post(request.m_request.url().getNSURL(), referrer, (request.m_frameName.length() ? (NSString *)request.m_frameName : nil), 
+            arrayFromFormData(request.m_request.httpBody()), request.m_request.httpContentType(), triggeringEvent, submitForm, formValues);
 
-    load(loader.get(), type, formState);
+    if (targetFrame && targetFrame != m_frame)
+        [Mac(targetFrame)->bridge() activateWindow];
 }
 
-void FrameLoader::load(NSURL *URL, const String& referrer, FrameLoadType newLoadType, const String& target, NSEvent *event, Element* form, NSDictionary *values)
+void FrameLoader::load(NSURL *URL, const String& referrer, FrameLoadType newLoadType,
+    const String& frameName, NSEvent *event, Element* form, const HashMap<String, String>& values)
 {
-    bool isFormSubmission = values != nil;
+    bool isFormSubmission = !values.isEmpty();
     
     NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:URL];
     setHTTPReferrer(request, referrer);
@@ -217,15 +218,14 @@ void FrameLoader::load(NSURL *URL, const String& referrer, FrameLoadType newLoad
 
     NSDictionary *action = actionInformation(newLoadType, isFormSubmission, event, URL);
     RefPtr<FormState> formState;
-    if (form && values)
-        formState = FormState::create(form, values, bridge());
+    if (form && !values.isEmpty())
+        formState = FormState::create(form, values, m_frame);
     
-    if (!target.isNull()) {
-        Frame* targetFrame = m_frame->tree()->find(target);
-        if (targetFrame)
+    if (!frameName.isNull()) {
+        if (Frame* targetFrame = m_frame->tree()->find(frameName))
             targetFrame->loader()->load(URL, referrer, newLoadType, String(), event, form, values);
         else
-            checkNewWindowPolicy(request, action, target, formState.release());
+            checkNewWindowPolicy(action, request, formState.release(), frameName);
         [request release];
         return;
     }
@@ -243,7 +243,7 @@ void FrameLoader::load(NSURL *URL, const String& referrer, FrameLoadType newLoad
         && !shouldReload(URL, m_frame->url().getNSURL())
         // We don't want to just scroll if a link from within a
         // frameset is trying to reload the frameset into _top.
-        && ![bridge() isFrameSet]) {
+        && !m_frame->isFrameSet()) {
 
         // Just do anchor navigation within the existing content.
         
@@ -254,9 +254,9 @@ void FrameLoader::load(NSURL *URL, const String& referrer, FrameLoadType newLoad
         // FIXME: What about load types other than Standard and Reload?
         
         oldDocumentLoader->setTriggeringAction(action);
-        invalidatePendingPolicyDecision(true);
+        stopPolicyCheck();
         checkNavigationPolicy(request, oldDocumentLoader.get(), formState.release(),
-            asDelegate(), @selector(continueFragmentScrollAfterNavigationPolicy:formState:));
+            callContinueFragmentScrollAfterNavigationPolicy, this);
     } else {
         // must grab this now, since this load may stop the previous load and clear this flag
         bool isRedirect = m_quickRedirectComing;
@@ -275,9 +275,45 @@ void FrameLoader::load(NSURL *URL, const String& referrer, FrameLoadType newLoad
     [request release];
 }
 
+void FrameLoader::load(NSURLRequest *request)
+{
+    // FIXME: is this the right place to reset loadType? Perhaps this should be done after loading is finished or aborted.
+    m_loadType = FrameLoadTypeStandard;
+    load(m_client->createDocumentLoader(request).get());
+}
+
+void FrameLoader::load(NSURLRequest *request, const String& frameName)
+{
+    if (frameName.isNull()) {
+        load(request);
+        return;
+    }
+
+    Frame* frame = m_frame->tree()->find(frameName);
+    if (frame) {
+        frame->loader()->load(request);
+        return;
+    }
+
+    checkNewWindowPolicy(actionInformation(NavigationTypeOther, nil, [request URL]),
+        request, 0, frameName);
+}
+
+void FrameLoader::load(NSURLRequest *request, NSDictionary *action, FrameLoadType type, PassRefPtr<FormState> formState)
+{
+    RefPtr<DocumentLoader> loader = m_client->createDocumentLoader(request);
+    setPolicyDocumentLoader(loader.get());
+
+    loader->setTriggeringAction(action);
+    if (m_documentLoader)
+        loader->setOverrideEncoding(m_documentLoader->overrideEncoding());
+
+    load(loader.get(), type, formState);
+}
+
 void FrameLoader::load(DocumentLoader* newDocumentLoader)
 {
-    invalidatePendingPolicyDecision(true);
+    stopPolicyCheck();
     setPolicyDocumentLoader(newDocumentLoader);
 
     NSMutableURLRequest *r = newDocumentLoader->request();
@@ -317,11 +353,11 @@ void FrameLoader::load(DocumentLoader* loader, FrameLoadType type, PassRefPtr<Fo
     if (Frame* parent = m_frame->tree()->parent())
         loader->setOverrideEncoding(parent->loader()->documentLoader()->overrideEncoding());
 
-    invalidatePendingPolicyDecision(true);
+    stopPolicyCheck();
     setPolicyDocumentLoader(loader);
 
     checkNavigationPolicy(loader->request(), loader, formState,
-        asDelegate(), @selector(continueLoadRequestAfterNavigationPolicy:formState:));
+        callContinueLoadAfterNavigationPolicy, this);
 }
 
 bool FrameLoader::canLoad(NSURL *URL, const String& referrer, bool& hideReferrer)
@@ -336,6 +372,37 @@ 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);
@@ -398,7 +465,7 @@ void FrameLoader::stopLoading()
 
     m_isStoppingLoad = true;
 
-    invalidatePendingPolicyDecision(true);
+    stopPolicyCheck();
 
     stopLoadingSubframes();
     if (m_provisionalDocumentLoader)
@@ -441,33 +508,21 @@ void FrameLoader::removePlugInStreamLoader(WebResourceLoader* loader)
     activeDocumentLoader()->updateLoading();
 }
 
-void FrameLoader::defersCallbacksChanged()
-{
-    bool defers = defersCallbacks();
-    for (Frame* child = m_frame; child; child = child->tree()->traverseNext(m_frame))
-        child->loader()->setDefersCallbacks(defers);
-}
-
-bool FrameLoader::defersCallbacks() const
-{
-    return [bridge() defersLoading];
-}
-
-static void setAllDefersCallbacks(const ResourceLoaderSet& loaders, bool defers)
+static void setAllDefersLoading(const ResourceLoaderSet& loaders, bool defers)
 {
     const ResourceLoaderSet copy = loaders;
     ResourceLoaderSet::const_iterator end = copy.end();
     for (ResourceLoaderSet::const_iterator it = copy.begin(); it != end; ++it)
-        (*it)->setDefersCallbacks(defers);
+        (*it)->setDefersLoading(defers);
 }
 
-void FrameLoader::setDefersCallbacks(bool defers)
+void FrameLoader::setDefersLoading(bool defers)
 {
     if (m_mainResourceLoader)
-        m_mainResourceLoader->setDefersCallbacks(defers);
-    setAllDefersCallbacks(m_subresourceLoaders, defers);
-    setAllDefersCallbacks(m_plugInStreamLoaders, defers);
-    m_client->setDefersCallbacks(defers);
+        m_mainResourceLoader->setDefersLoading(defers);
+    setAllDefersLoading(m_subresourceLoaders, defers);
+    setAllDefersLoading(m_plugInStreamLoaders, defers);
+    m_client->setDefersLoading(defers);
 }
 
 bool FrameLoader::isLoadingMainResource() const
@@ -628,7 +683,7 @@ id FrameLoader::identifierForInitialRequest(NSURLRequest *clientRequest)
 
 NSURLRequest *FrameLoader::willSendRequest(WebResourceLoader* loader, NSMutableURLRequest *clientRequest, NSURLResponse *redirectResponse)
 {
-    [clientRequest setValue:[bridge() userAgentForURL:[clientRequest URL]] forHTTPHeaderField:@"User-Agent"];
+    [clientRequest setValue:client()->userAgent([clientRequest URL]) forHTTPHeaderField:@"User-Agent"];
     return m_client->dispatchWillSendRequest(activeDocumentLoader(), loader->identifier(), clientRequest, redirectResponse);
 }
 
@@ -689,7 +744,6 @@ 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.
-        // Can't call _bridge because we might not have commited yet
         m_frame->stop();
         if (m_client->shouldFallBack(error))
             m_frame->handleFallbackContent();
@@ -746,6 +800,13 @@ bool FrameLoader::shouldReload(NSURL *currentURL, NSURL *destinationURL)
         && [urlByRemovingFragment(currentURL) isEqual:urlByRemovingFragment(destinationURL)]);
 }
 
+void FrameLoader::callContinueFragmentScrollAfterNavigationPolicy(void* argument,
+    NSURLRequest *request, PassRefPtr<FormState>)
+{
+    FrameLoader* loader = static_cast<FrameLoader*>(argument);
+    loader->continueFragmentScrollAfterNavigationPolicy(request);
+}
+
 void FrameLoader::continueFragmentScrollAfterNavigationPolicy(NSURLRequest *request)
 {
     if (!request)
@@ -798,6 +859,98 @@ void FrameLoader::closeOldDataSources()
     m_client->setMainFrameDocumentReady(false); // stop giving out the actual DOMDocument to observers
 }
 
+void FrameLoader::open(NSURL *URL, bool reload, NSString *contentType, NSString *refresh, NSDate *lastModified, NSDictionary *pageCache)
+{
+    if (pageCache) {
+        WebCorePageState *state = [pageCache objectForKey:WebCorePageCacheStateKey];
+        open(state);
+        [state invalidate];
+        return;
+    }
+        
+    m_frame->setResponseMIMEType(contentType);
+    
+    // opening the URL
+    if (m_frame->didOpenURL(URL)) {
+        // things we have to set up after calling didOpenURL
+        if (refresh)
+            m_frame->addMetaData("http-refresh", refresh);
+        if (lastModified) {
+            NSString *modifiedString = [lastModified descriptionWithCalendarFormat:@"%a %b %d %Y %H:%M:%S" timeZone:nil locale:nil];
+            m_frame->addMetaData("modified", modifiedString);
+        }
+    }
+}
+
+void FrameLoader::open(WebCorePageState *state)
+{
+    FramePrivate* d = m_frame->d;
+
+    // It's safe to assume none of the WebCorePageState methods will raise
+    // exceptions, since WebCorePageState is implemented by WebCore and
+    // does not throw
+
+    Document* doc = [state document];
+    Node* mousePressNode = [state mousePressNode];
+    KURL URL = *[state URL];
+    SavedProperties* windowProperties = [state windowProperties];
+    SavedProperties* locationProperties = [state locationProperties];
+    SavedBuiltins* interpreterBuiltins = [state interpreterBuiltins];
+    PausedTimeouts* timeouts = [state pausedTimeouts];
+    
+    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->jScriptEnabled()) {
+        d->m_kjsStatusBarText = String();
+        d->m_kjsDefaultStatusBarText = String();
+    }
+    
+    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();
+
+    doc->setInPageCache(false);
+
+    d->m_bCleared = false;
+    d->m_bComplete = false;
+    d->m_bLoadEventEmitted = false;
+    d->m_referrer = URL.url();
+    
+    m_frame->setView(doc->view());
+    
+    d->m_doc = doc;
+    d->m_mousePressNode = mousePressNode;
+    d->m_decoder = doc->decoder();
+
+    m_frame->updatePolicyBaseURL();
+
+    { // scope the lock
+        JSLock lock;
+        m_frame->restoreWindowProperties(windowProperties);
+        m_frame->restoreLocationProperties(locationProperties);
+        m_frame->restoreInterpreterBuiltins(*interpreterBuiltins);
+    }
+
+    m_frame->resumeTimeouts(timeouts);
+
+    m_frame->checkCompleted();
+}
+
 void FrameLoader::opened()
 {
     if (m_loadType == FrameLoadTypeStandard && m_documentLoader->isClientRedirect())
@@ -861,13 +1014,9 @@ void FrameLoader::commitProvisionalLoad(NSDictionary *pageCache)
     if (!URL || urlIsEmpty(URL))
         URL = [NSURL URLWithString:@"about:blank"];    
     
-    [bridge() openURL:URL
-               reload:reload 
-          contentType:[response MIMEType]
-              refresh:[headers objectForKey:@"Refresh"]
-         lastModified:(pageCache ? nil : wkGetNSURLResponseLastModifiedDate(response))
-            pageCache:pageCache];
-    
+    NSDate *lastModified = pageCache ? nil : wkGetNSURLResponseLastModifiedDate(response);
+
+    open(URL, reload, [response MIMEType], [headers objectForKey:@"Refresh"], lastModified, pageCache);
     opened();
 }
 
@@ -891,11 +1040,6 @@ void FrameLoader::download(NSURLConnection *connection, NSURLRequest *request, N
     m_client->download(connection, request, response, proxy);
 }
 
-WebCoreFrameBridge *FrameLoader::bridge() const
-{
-    return Mac(m_frame)->bridge();
-}
-
 void FrameLoader::handleFallbackContent()
 {
     m_frame->handleFallbackContent();
@@ -1008,23 +1152,23 @@ String FrameLoader::generatedMIMETypeForURLScheme(const String& URLScheme)
     return m_client->generatedMIMETypeForURLScheme(URLScheme);
 }
 
-void FrameLoader::checkNavigationPolicy(NSURLRequest *newRequest, id obj, SEL sel)
+void FrameLoader::checkNavigationPolicy(NSURLRequest *newRequest,
+    NavigationPolicyDecisionFunction function, void* argument)
 {
-    checkNavigationPolicy(newRequest, activeDocumentLoader(), 0, obj, sel);
+    checkNavigationPolicy(newRequest, activeDocumentLoader(), 0, function, argument);
 }
 
-void FrameLoader::checkContentPolicy(const String& MIMEType, id obj, SEL sel)
+void FrameLoader::checkContentPolicy(const String& MIMEType, ContentPolicyDecisionFunction function, void* argument)
 {
-    WebPolicyDecider *d = m_client->createPolicyDecider(obj, sel);
-    m_policyDecider = d;
-    m_client->dispatchDecidePolicyForMIMEType(d, MIMEType, activeDocumentLoader()->request());
-    [d release];
+    m_policyCheck.set(function, argument);
+    m_client->dispatchDecidePolicyForMIMEType(&FrameLoader::continueAfterContentPolicy,
+        MIMEType, activeDocumentLoader()->request());
 }
 
 void FrameLoader::cancelContentPolicyCheck()
 {
-    [m_policyDecider.get() invalidate];
-    m_policyDecider = nil;
+    m_client->cancelPolicyCheck();
+    m_policyCheck.clear();
 }
 
 bool FrameLoader::shouldReloadToHandleUnreachableURL(NSURLRequest *request)
@@ -1187,73 +1331,46 @@ FrameLoadType FrameLoader::loadType() const
     return m_loadType;
 }
 
-void FrameLoader::invalidatePendingPolicyDecision(bool callDefaultAction)
+void FrameLoader::stopPolicyCheck()
 {
-    [m_policyDecider.get() invalidate];
-    m_policyDecider = nil;
-
-    bool hadFrameName = !m_policyFrameName.isNull();
-    RetainPtr<id> target = m_policyTarget;
-    SEL selector = m_policySelector;
-
-    m_policyRequest = nil;
-    m_policyFrameName = String();
-    m_policyTarget = nil;
-    m_policyFormState = 0;
-
-    if (callDefaultAction) {
-        if (hadFrameName)
-            objc_msgSend(target.get(), selector, nil, nil, nil);
-        else
-            objc_msgSend(target.get(), selector, nil, nil);
-    }
+    m_client->cancelPolicyCheck();
+    PolicyCheck check = m_policyCheck;
+    m_policyCheck.clear();
+    check.clearRequest();
+    check.call();
 }
 
-void FrameLoader::checkNewWindowPolicy(NSURLRequest *request, NSDictionary *action, const String& frameName, PassRefPtr<FormState> formState)
+void FrameLoader::checkNewWindowPolicy(NSDictionary *action, NSURLRequest *request,
+    PassRefPtr<FormState> formState, const String& frameName)
 {
-    WebPolicyDecider *decider = m_client->createPolicyDecider(asDelegate(),
-        @selector(continueAfterNewWindowPolicy:));
-
-    m_policyRequest = request;
-    m_policyTarget = asDelegate();
-    m_policyFrameName = frameName;
-    m_policySelector = @selector(continueLoadRequestAfterNewWindowPolicy:frameName:formState:);
-    m_policyDecider = decider;
-    m_policyFormState = formState;
-
-    m_client->dispatchDecidePolicyForNewWindowAction(decider, action, request, frameName);
-
-    [decider release];
+    m_policyCheck.set(request, formState, frameName,
+        callContinueLoadAfterNewWindowPolicy, this);
+    m_client->dispatchDecidePolicyForNewWindowAction(&FrameLoader::continueAfterNewWindowPolicy,
+        action, request, frameName);
 }
 
 void FrameLoader::continueAfterNewWindowPolicy(PolicyAction policy)
 {
-    RetainPtr<NSURLRequest> request = m_policyRequest;
-    String frameName = m_policyFrameName;
-    RetainPtr<id> target = m_policyTarget;
-    SEL selector = m_policySelector;
-    RefPtr<FormState> formState = m_policyFormState;
-
-    invalidatePendingPolicyDecision(false);
+    PolicyCheck check = m_policyCheck;
+    m_policyCheck.clear();
 
     switch (policy) {
         case PolicyIgnore:
-            request = nil;
+            check.clearRequest();
             break;
         case PolicyDownload:
-            m_client->startDownload(request.get());
-            request = nil;
+            m_client->startDownload(check.request());
+            check.clearRequest();
             break;
         case PolicyUse:
             break;
     }
 
-    NSString *frameNameAsNSString = frameName;
-    objc_msgSend(target.get(), selector, request.get(), frameNameAsNSString, formState.get());
+    check.call();
 }
 
 void FrameLoader::checkNavigationPolicy(NSURLRequest *request, DocumentLoader* loader,
-    PassRefPtr<FormState> formState, id target, SEL selector)
+    PassRefPtr<FormState> formState, NavigationPolicyDecisionFunction function, void* argument)
 {
     NSDictionary *action = loader->triggeringAction();
     if (!action) {
@@ -1264,7 +1381,7 @@ void FrameLoader::checkNavigationPolicy(NSURLRequest *request, DocumentLoader* l
     // Don't ask more than once for the same request or if we are loading an empty URL.
     // This avoids confusion on the part of the client.
     if ([request isEqual:loader->lastCheckedRequest()] || urlIsEmpty([request URL])) {
-        objc_msgSend(target, selector, request, nil);
+        function(argument, request, 0);
         return;
     }
     
@@ -1273,66 +1390,65 @@ void FrameLoader::checkNavigationPolicy(NSURLRequest *request, DocumentLoader* l
     if ([request _webDataRequestUnreachableURL] != nil) {
         if (isBackForwardLoadType(m_policyLoadType))
             m_policyLoadType = FrameLoadTypeReload;
-        objc_msgSend(target, selector, request, nil);
+        function(argument, request, 0);
         return;
     }
     
     loader->setLastCheckedRequest(request);
 
-    WebPolicyDecider *decider = m_client->createPolicyDecider(asDelegate(),
-        @selector(continueAfterNavigationPolicy:));
-    
-    m_policyRequest = request;
-    m_policyTarget = target;
-    m_policySelector = selector;
-    m_policyDecider = decider;
-    m_policyFormState = formState;
+    m_policyCheck.set(request, formState, function, argument);
 
     m_delegateIsDecidingNavigationPolicy = true;
-    m_client->dispatchDecidePolicyForNavigationAction(decider, action, request);
+    m_client->dispatchDecidePolicyForNavigationAction(&FrameLoader::continueAfterNavigationPolicy,
+        action, request);
     m_delegateIsDecidingNavigationPolicy = false;
-    
-    [decider release];
 }
 
 void FrameLoader::continueAfterNavigationPolicy(PolicyAction policy)
 {
-    RetainPtr<NSURLRequest> request = m_policyRequest;
-    RetainPtr<id> target = m_policyTarget;
-    SEL selector = m_policySelector;
-    RefPtr<FormState> formState = m_policyFormState.release();
-    
-    invalidatePendingPolicyDecision(false);
+    PolicyCheck check = m_policyCheck;
+    m_policyCheck.clear();
 
     switch (policy) {
         case PolicyIgnore:
-            request = nil;
+            check.clearRequest();
             break;
         case PolicyDownload:
-            m_client->startDownload(request.get());
-            request = nil;
+            m_client->startDownload(check.request());
+            check.clearRequest();
             break;
         case PolicyUse:
-            if (!m_client->canHandleRequest(request.get())) {
-                handleUnimplementablePolicy(m_client->cannotShowURLError(request.get()));
-                request = nil;
+            if (!m_client->canHandleRequest(check.request())) {
+                handleUnimplementablePolicy(m_client->cannotShowURLError(check.request()));
+                check.clearRequest();
             }
             break;
     }
 
-    objc_msgSend(target.get(), selector, request.get(), formState.get());
+    check.call();
 }
 
-void FrameLoader::continueAfterWillSubmitForm(PolicyAction policy)
+void FrameLoader::continueAfterContentPolicy(PolicyAction policy)
+{
+    PolicyCheck check = m_policyCheck;
+    m_policyCheck.clear();
+    check.call(policy);
+}
+
+void FrameLoader::continueAfterWillSubmitForm(PolicyAction)
 {
-    if (m_policyDecider) {
-        [m_policyDecider.get() invalidate];
-        m_policyDecider = nil;
-    }
     startLoading();
 }
 
-void FrameLoader::continueLoadRequestAfterNavigationPolicy(NSURLRequest *request, FormState* formState)
+void FrameLoader::callContinueLoadAfterNavigationPolicy(void* argument,
+    NSURLRequest *request, PassRefPtr<FormState> formState)
+{
+    FrameLoader* loader = static_cast<FrameLoader*>(argument);
+    loader->continueLoadAfterNavigationPolicy(request, formState);
+}
+
+void FrameLoader::continueLoadAfterNavigationPolicy(NSURLRequest *request,
+    PassRefPtr<FormState> formState)
 {
     // If we loaded an alternate page to replace an unreachableURL, we'll get in here with a
     // nil policyDataSource because loading the alternate page will have passed
@@ -1376,15 +1492,10 @@ void FrameLoader::continueLoadRequestAfterNavigationPolicy(NSURLRequest *request
     if (isBackForwardLoadType(type) && m_client->loadProvisionalItemFromPageCache())
         return;
 
-    if (formState) {
-        // It's a bit of a hack to reuse the WebPolicyDecider for the continuation
-        // mechanism across the willSubmitForm callout.
-        WebPolicyDecider *decider = m_client->createPolicyDecider(asDelegate(), @selector(continueAfterWillSubmitForm:));
-        m_policyDecider = decider;
-        m_client->dispatchWillSubmitForm(decider, formState->sourceFrame(), formState->form(), formState->valuesAsNSDictionary());
-        [decider release];
-    } else
-        continueAfterWillSubmitForm(PolicyUse);
+    if (formState)
+        m_client->dispatchWillSubmitForm(&FrameLoader::continueAfterWillSubmitForm, formState);
+    else
+        continueAfterWillSubmitForm();
 }
 
 void FrameLoader::didFirstLayout()
@@ -1416,6 +1527,12 @@ 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());
@@ -1431,7 +1548,7 @@ void FrameLoader::transitionToCommitted(NSDictionary *pageCache)
     // JavaScript. If the script initiates a new load, we need to abandon the current load,
     // or the two will stomp each other.
     DocumentLoader* pdl = m_provisionalDocumentLoader.get();
-    [bridge() closeURL];
+    closeDocument();
     if (pdl != m_provisionalDocumentLoader)
         return;
 
@@ -1578,7 +1695,15 @@ void FrameLoader::checkLoadCompleteForThisFrame()
     ASSERT_NOT_REACHED();
 }
 
-void FrameLoader::continueLoadRequestAfterNewWindowPolicy(NSURLRequest *request, const String& frameName, FormState* formState)
+void FrameLoader::callContinueLoadAfterNewWindowPolicy(void* argument,
+    NSURLRequest *request, PassRefPtr<FormState> formState, const String& frameName)
+{
+    FrameLoader* loader = static_cast<FrameLoader*>(argument);
+    loader->continueLoadAfterNewWindowPolicy(request, formState, frameName);
+}
+
+void FrameLoader::continueLoadAfterNewWindowPolicy(NSURLRequest *request,
+    PassRefPtr<FormState> formState, const String& frameName)
 {
     if (!request)
         return;
@@ -1634,8 +1759,8 @@ void FrameLoader::loadedResourceFromMemoryCache(NSURLRequest *request, NSURLResp
     sendRemainingDelegateMessages(identifier, response, length, error);
 }
 
-void FrameLoader::post(NSURL *URL, const String& referrer, const String& target, NSArray *postData, 
-                       const String& contentType, NSEvent *event, Element* form, NSDictionary *formValues)
+void FrameLoader::post(NSURL *URL, const String& referrer, const String& frameName, NSArray *postData, 
+    const String& contentType, NSEvent *event, Element* form, const HashMap<String, String>& formValues)
 {
     // When posting, use the NSURLRequestReloadIgnoringCacheData load flag.
     // This prevents a potential bug which may cause a page with a form that uses itself
@@ -1653,15 +1778,14 @@ void FrameLoader::post(NSURL *URL, const String& referrer, const String& target,
 
     NSDictionary *action = actionInformation(FrameLoadTypeStandard, true, event, URL);
     RefPtr<FormState> formState;
-    if (form && formValues)
-        formState = FormState::create(form, formValues, bridge());
+    if (form && !formValues.isEmpty())
+        formState = FormState::create(form, formValues, m_frame);
 
-    if (target != nil) {
-        Frame* targetFrame = m_frame->tree()->find(target);
-        if (targetFrame)
+    if (!frameName.isNull()) {
+        if (Frame* targetFrame = m_frame->tree()->find(frameName))
             targetFrame->loader()->load(request, action, FrameLoadTypeStandard, formState.release());
         else
-            checkNewWindowPolicy(request, action, target, formState.release());
+            checkNewWindowPolicy(action, request, formState.release(), frameName);
     } else
         load(request, action, FrameLoadTypeStandard, formState.release());
 
@@ -1682,7 +1806,7 @@ void FrameLoader::detachFromParent()
 {
     RefPtr<Frame> protect(m_frame);
 
-    [bridge() closeURL];
+    closeDocument();
     stopLoading();
     m_client->detachedFromParent1();
     detachChildren();
@@ -1691,23 +1815,23 @@ void FrameLoader::detachFromParent()
     m_client->detachedFromParent3();
     if (Frame* parent = m_frame->tree()->parent())
         parent->tree()->removeChild(m_frame);
-    [bridge() close];
+    [Mac(m_frame)->bridge() close];
     m_client->detachedFromParent4();
 }
 
 void FrameLoader::addExtraFieldsToRequest(NSMutableURLRequest *request, bool mainResource, bool alwaysFromRequest)
 {
-    [request setValue:[bridge() userAgentForURL:[request URL]] forHTTPHeaderField:@"User-Agent"];
+    [request setValue:client()->userAgent([request URL]) forHTTPHeaderField:@"User-Agent"];
     
     if (m_loadType == FrameLoadTypeReload)
         [request setValue:@"max-age=0" forHTTPHeaderField:@"Cache-Control"];
     
     // Don't set the cookie policy URL if it's already been set.
-    if ([request mainDocumentURL] == nil) {
+    if (![request mainDocumentURL]) {
         if (mainResource && (isLoadingMainFrame() || alwaysFromRequest))
             [request setMainDocumentURL:[request URL]];
         else
-            [request setMainDocumentURL:m_client->mainFrameURL()];
+            [request setMainDocumentURL:m_frame->page()->mainFrame()->url().getNSURL()];
     }
     
     if (mainResource)
@@ -1843,72 +1967,85 @@ FrameLoaderClient* FrameLoader::client() const
     return m_client;
 }
 
-WebCoreFrameLoaderAsDelegate *FrameLoader::asDelegate()
+PolicyCheck::PolicyCheck()
+    : m_navigationFunction(0)
+    , m_newWindowFunction(0)
+    , m_contentFunction(0)
 {
-    if (!m_asDelegate) {
-        WebCoreFrameLoaderAsDelegate *d = [[WebCoreFrameLoaderAsDelegate alloc] initWithLoader:this];
-        m_asDelegate = d;
-        [d release];
-    }
-    return m_asDelegate.get();
 }
 
-FrameLoaderClient::~FrameLoaderClient()
+void PolicyCheck::clear()
 {
+    clearRequest();
+    m_navigationFunction = 0;
+    m_newWindowFunction = 0;
+    m_contentFunction = 0;
 }
 
-}
-
-@implementation WebCoreFrameLoaderAsDelegate
-
-- (id)initWithLoader:(FrameLoader*)loader
+void PolicyCheck::set(NSURLRequest *request, PassRefPtr<FormState> formState,
+    NavigationPolicyDecisionFunction function, void* argument)
 {
-    self = [self init];
-    if (!self)
-        return nil;
-    m_loader = loader;
-    return self;
-}
+    m_request = request;
+    m_formState = formState;
+    m_frameName = String();
 
-- (void)detachFromLoader
-{
-    m_loader = 0;
+    m_navigationFunction = function;
+    m_newWindowFunction = 0;
+    m_contentFunction = 0;
+    m_argument = argument;
 }
 
-- (void)continueFragmentScrollAfterNavigationPolicy:(NSURLRequest *)request formState:(FormState*)formState
+void PolicyCheck::set(NSURLRequest *request, PassRefPtr<FormState> formState,
+    const String& frameName, NewWindowPolicyDecisionFunction function, void* argument)
 {
-    if (m_loader)
-        m_loader->continueFragmentScrollAfterNavigationPolicy(request);
+    m_request = request;
+    m_formState = formState;
+    m_frameName = frameName;
+
+    m_navigationFunction = 0;
+    m_newWindowFunction = function;
+    m_contentFunction = 0;
+    m_argument = argument;
 }
 
-- (void)continueAfterNewWindowPolicy:(PolicyAction)policy
+void PolicyCheck::set(ContentPolicyDecisionFunction function, void* argument)
 {
-    if (m_loader)
-        m_loader->continueAfterNewWindowPolicy(policy);
+    m_request = nil;
+    m_formState = 0;
+    m_frameName = String();
+
+    m_navigationFunction = 0;
+    m_newWindowFunction = 0;
+    m_contentFunction = function;
+    m_argument = argument;
 }
 
-- (void)continueAfterNavigationPolicy:(PolicyAction)policy
+void PolicyCheck::call()
 {
-    if (m_loader)
-        m_loader->continueAfterNavigationPolicy(policy);
+    if (m_navigationFunction)
+        m_navigationFunction(m_argument, m_request.get(), m_formState.get());
+    if (m_newWindowFunction)
+        m_newWindowFunction(m_argument, m_request.get(), m_formState.get(), m_frameName);
+    ASSERT(!m_contentFunction);
 }
 
-- (void)continueAfterWillSubmitForm:(PolicyAction)policy
+void PolicyCheck::call(PolicyAction action)
 {
-    if (m_loader)
-        m_loader->continueAfterWillSubmitForm(policy);
+    ASSERT(!m_navigationFunction);
+    ASSERT(!m_newWindowFunction);
+    ASSERT(m_contentFunction);
+    m_contentFunction(m_argument, action);
 }
 
-- (void)continueLoadRequestAfterNavigationPolicy:(NSURLRequest *)request formState:(FormState*)formState
+void PolicyCheck::clearRequest()
 {
-    if (m_loader)
-        m_loader->continueLoadRequestAfterNavigationPolicy(request, formState);
+    m_request = nil;
+    m_formState = 0;
+    m_frameName = String();
 }
 
-- (void)continueLoadRequestAfterNewWindowPolicy:(NSURLRequest *)request frameName:(NSString *)frameName formState:(FormState *)formState
+FrameLoaderClient::~FrameLoaderClient()
 {
-    if (m_loader)
-        m_loader->continueLoadRequestAfterNewWindowPolicy(request, frameName, formState);
 }
 
-@end
+}
index 9fd2a02..2b35e92 100644 (file)
@@ -30,9 +30,6 @@
 #include "StringHash.h"
 #include <wtf/HashMap.h>
 
-@class NSDictionary;
-@class WebCoreFrameBridge;
-
 namespace WebCore {
 
     class Element;
@@ -46,12 +43,8 @@ namespace WebCore {
         const HashMap<String, String>& values() const { return m_values; }
         Frame* sourceFrame() const { return m_sourceFrame.get(); }
 
-        static PassRefPtr<FormState> create(PassRefPtr<Element> form, NSDictionary *values, WebCoreFrameBridge *sourceFrame);
-        NSDictionary *valuesAsNSDictionary() const;
-
     private:
         FormState(PassRefPtr<Element> form, const HashMap<String, String>& values, PassRefPtr<Frame> sourceFrame);
-        FormState(PassRefPtr<Element> form, NSDictionary *values, WebCoreFrameBridge *sourceFrame);
 
         RefPtr<Element> m_form;
         HashMap<String, String> m_values;
index a498fa7..2ccc727 100644 (file)
 #import "config.h"
 #import "WebFormState.h"
 
-#import "DOMElementInternal.h"
 #import "Element.h"
-#import "FrameMac.h"
-#import "WebCoreFrameBridge.h"
+#import "Frame.h"
 
 namespace WebCore {
 
@@ -41,11 +39,6 @@ PassRefPtr<FormState> FormState::create(PassRefPtr<Element> form, const HashMap<
     return new FormState(form, values, sourceFrame);
 }
 
-PassRefPtr<FormState> FormState::create(PassRefPtr<Element> form, NSDictionary *values, WebCoreFrameBridge *sourceFrame)
-{
-    return new FormState(form, values, sourceFrame);
-}
-
 FormState::FormState(PassRefPtr<Element> form, const HashMap<String, String>& values, PassRefPtr<Frame> sourceFrame)
     : m_form(form)
     , m_values(values)
@@ -53,22 +46,4 @@ FormState::FormState(PassRefPtr<Element> form, const HashMap<String, String>& va
 {
 }
 
-FormState::FormState(PassRefPtr<Element> form, NSDictionary *values, WebCoreFrameBridge *sourceFrame)
-    : m_form(form)
-    , m_sourceFrame([sourceFrame _frame])
-{
-    NSEnumerator *keyEnumerator = [values keyEnumerator];
-    while (NSString *key = [keyEnumerator nextObject])
-        m_values.set(key, [values objectForKey:key]);
-}
-
-NSDictionary *FormState::valuesAsNSDictionary() const
-{
-    NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithCapacity:m_values.size()];
-    HashMap<String, String>::const_iterator end = m_values.end();
-    for (HashMap<String, String>::const_iterator it = m_values.begin(); it != end; ++it)
-        [dictionary setObject:it->second forKey:it->first];
-    return dictionary;
-}
-
 }
index cc227c2..0672799 100644 (file)
 
 #include <wtf/Noncopyable.h>
 #include <wtf/Forward.h>
-
-@class WebPolicyDecider;
+#include "FrameLoaderTypes.h"
 
 namespace WebCore {
 
     class DocumentLoader;
     class Element;
+    class FormState;
     class Frame;
+    class FrameLoader;
     class String;
     class WebResourceLoader;
 
     struct LoadErrorResetToken;
 
+    typedef void (FrameLoader::*FramePolicyFunction)(PolicyAction);
+
     class FrameLoaderClient : Noncopyable {
     public:
         virtual void detachFrameLoader() = 0;
@@ -78,6 +81,8 @@ namespace WebCore {
         virtual void resetAfterLoadError(LoadErrorResetToken*) = 0;
         virtual void doNotResetAfterLoadError(LoadErrorResetToken*) = 0;
 
+        virtual void willCloseDocument() = 0;
+
         virtual void detachedFromParent1() = 0;
         virtual void detachedFromParent2() = 0;
         virtual void detachedFromParent3() = 0;
@@ -115,12 +120,14 @@ namespace WebCore {
         virtual Frame* dispatchCreatePage(NSURLRequest *) = 0;
         virtual void dispatchShow() = 0;
 
-        virtual void dispatchDecidePolicyForMIMEType(WebPolicyDecider *, const String& MIMEType, NSURLRequest *) = 0;
-        virtual void dispatchDecidePolicyForNewWindowAction(WebPolicyDecider *, NSDictionary *action, NSURLRequest *, const String& frameName) = 0;
-        virtual void dispatchDecidePolicyForNavigationAction(WebPolicyDecider *, NSDictionary *action, NSURLRequest *) = 0;
+        virtual void dispatchDecidePolicyForMIMEType(FramePolicyFunction, const String& MIMEType, NSURLRequest *) = 0;
+        virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction, NSDictionary *action, NSURLRequest *, const String& frameName) = 0;
+        virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction, NSDictionary *action, NSURLRequest *) = 0;
+        virtual void cancelPolicyCheck() = 0;
+
         virtual void dispatchUnableToImplementPolicy(NSError *) = 0;
 
-        virtual void dispatchWillSubmitForm(WebPolicyDecider *, Frame* sourceFrame, Element* form, NSDictionary *values) = 0;
+        virtual void dispatchWillSubmitForm(FramePolicyFunction, PassRefPtr<FormState>) = 0;
 
         virtual void dispatchDidLoadMainResource(DocumentLoader*) = 0;
         virtual void clearLoadingFromPageCache(DocumentLoader*) = 0;
@@ -156,9 +163,7 @@ namespace WebCore {
 
         virtual bool shouldFallBack(NSError *) = 0;
 
-        virtual NSURL *mainFrameURL() = 0;
-
-        virtual void setDefersCallbacks(bool) = 0;
+        virtual void setDefersLoading(bool) = 0;
 
         virtual bool willUseArchive(WebResourceLoader*, NSURLRequest *, NSURL *originalURL) const = 0;
         virtual bool isArchiveLoadPending(WebResourceLoader*) const = 0;
@@ -172,8 +177,6 @@ namespace WebCore {
 
         virtual NSDictionary *elementForEvent(NSEvent *) const = 0;
 
-        virtual WebPolicyDecider *createPolicyDecider(id object, SEL selector) = 0;
-
         virtual void frameLoadCompleted() = 0;
         virtual void restoreScrollPositionAndViewState() = 0;
         virtual void provisionalLoadStarted() = 0;
@@ -182,7 +185,9 @@ namespace WebCore {
         virtual void didFinishLoad() = 0;
         virtual void prepareForDataSourceReplacement() = 0;
         virtual PassRefPtr<DocumentLoader> createDocumentLoader(NSURLRequest *) = 0;
-        virtual void setTitle(NSString *title, NSURL *URL) = 0;
+        virtual void setTitle(const String& title, NSURL *) = 0;
+
+        virtual String userAgent(NSURL *) = 0;
 
     protected:
         virtual ~FrameLoaderClient();
index a5bd954..d91ca20 100644 (file)
@@ -54,8 +54,7 @@ namespace WebCore {
         virtual void cancel(NSError * = nil);
         NSError *cancelledError();
 
-        virtual void setDefersCallbacks(bool);
-        bool defersCallbacks() const;
+        virtual void setDefersLoading(bool);
 
         void setIdentifier(id);
         id identifier() const { return m_identifier.get(); }
@@ -96,6 +95,7 @@ namespace WebCore {
         NSURLRequest *request() const { return m_request.get(); }
         bool reachedTerminalState() const { return m_reachedTerminalState; }
         bool cancelled() const { return m_cancelled; }
+        bool defersLoading() const { return m_defersLoading; }
 
         RetainPtr<NSURLConnection> m_connection;
 
@@ -110,7 +110,7 @@ namespace WebCore {
         RetainPtr<NSURLResponse> m_response;
         NSURLAuthenticationChallenge *m_currentConnectionChallenge;
         RetainPtr<NSURLAuthenticationChallenge> m_currentWebChallenge;
-        bool m_defersCallbacks;
+        bool m_defersLoading;
         RetainPtr<NSURL> m_originalURL;
         RetainPtr<NSMutableData> m_resourceData;
         RetainPtr<WebCoreResourceLoaderAsDelegate> m_delegate;
index 166c5e8..986bb1d 100644 (file)
@@ -31,6 +31,7 @@
 
 #import "FrameLoader.h"
 #import "FrameMac.h"
+#import "Page.h"
 #import "WebCoreFrameBridge.h"
 #import "WebCoreSystemInterface.h"
 #import "WebDataProtocol.h"
@@ -74,7 +75,7 @@ WebResourceLoader::WebResourceLoader(Frame* frame)
     , m_calledDidFinishLoad(false)
     , m_frame(frame)
     , m_currentConnectionChallenge(nil)
-    , m_defersCallbacks(frameLoader()->defersCallbacks())
+    , m_defersLoading(frame->page()->defersLoading())
 {
     static bool initialized = false;
     if (!initialized) {
@@ -138,23 +139,18 @@ bool WebResourceLoader::load(NSURLRequest *r)
 #endif
     m_connection = connection;
     [connection release];
-    if (defersCallbacks())
+    if (m_defersLoading)
         wkSetNSURLConnectionDefersCallbacks(m_connection.get(), YES);
 
     return true;
 }
 
-void WebResourceLoader::setDefersCallbacks(bool defers)
+void WebResourceLoader::setDefersLoading(bool defers)
 {
-    m_defersCallbacks = defers;
+    m_defersLoading = defers;
     wkSetNSURLConnectionDefersCallbacks(m_connection.get(), defers);
 }
 
-bool WebResourceLoader::defersCallbacks() const
-{
-    return m_defersCallbacks;
-}
-
 FrameLoader* WebResourceLoader::frameLoader() const
 {
     if (!m_frame)
index 4b8f216..84d4bcf 100644 (file)
 #import "WebLoader.h"
 #import <wtf/Forward.h>
 
-@class WebCoreMainResourceLoaderAsPolicyDelegate;
-
 namespace WebCore {
 
+    class FormState;
+
     class MainResourceLoader : public WebResourceLoader {
     public:
         static PassRefPtr<MainResourceLoader> create(Frame*);
@@ -42,7 +42,7 @@ namespace WebCore {
 
         virtual bool load(NSURLRequest *);
 
-        virtual void setDefersCallbacks(bool);
+        virtual void setDefersLoading(bool);
 
         virtual void addData(NSData *, bool allAtOnce);
 
@@ -52,9 +52,6 @@ namespace WebCore {
         virtual void didFinishLoading();
         virtual void didFail(NSError *);
 
-        void continueAfterNavigationPolicy(NSURLRequest *);
-        void continueAfterContentPolicy(PolicyAction);
-
     private:
         virtual void didCancel(NSError *);
 
@@ -62,9 +59,6 @@ namespace WebCore {
 
         virtual void releaseDelegate();
 
-        WebCoreMainResourceLoaderAsPolicyDelegate *policyDelegate();
-        void releasePolicyDelegate();
-
         NSURLRequest *loadNow(NSURLRequest *);
 
         void receivedError(NSError *);
@@ -72,6 +66,11 @@ namespace WebCore {
         void stopLoadingForPolicyChange();
         bool isPostOrRedirectAfterPost(NSURLRequest *newRequest, NSURLResponse *redirectResponse);
 
+        static void callContinueAfterNavigationPolicy(void*, NSURLRequest *, PassRefPtr<FormState>);
+        void continueAfterNavigationPolicy(NSURLRequest *);
+
+        static void callContinueAfterContentPolicy(void*, PolicyAction);
+        void continueAfterContentPolicy(PolicyAction);
         void continueAfterContentPolicy(PolicyAction, NSURLResponse *);
 
         int m_contentLength; // for logging only
@@ -79,8 +78,9 @@ namespace WebCore {
         RetainPtr<NSURLResponse> m_response;
         RetainPtr<id> m_proxy;
         RetainPtr<NSURLRequest> m_initialRequest;
-        RetainPtr<WebCoreMainResourceLoaderAsPolicyDelegate> m_policyDelegate;
         bool m_loadingMultipartContent;
+
+        bool m_waitingForContentPolicy;
     };
 
 }
index c13256b..9125ef3 100644 (file)
 
 using namespace WebCore;
 
-@interface WebCoreMainResourceLoaderAsPolicyDelegate : NSObject
-{
-    MainResourceLoader* m_loader;
-}
-- (id)initWithLoader:(MainResourceLoader *)loader;
-- (void)detachLoader;
-@end
-
 namespace WebCore {
 
 const size_t URLBufferLength = 2048;
@@ -63,6 +55,7 @@ MainResourceLoader::MainResourceLoader(Frame* frame)
     , m_bytesReceived(0)
     , m_proxy(wkCreateNSURLConnectionDelegateProxy())
     , m_loadingMultipartContent(false)
+    , m_waitingForContentPolicy(false)
 {
     [m_proxy.get() setDelegate:delegate()];
     [m_proxy.get() release];
@@ -74,7 +67,6 @@ MainResourceLoader::~MainResourceLoader()
 
 void MainResourceLoader::releaseDelegate()
 {
-    releasePolicyDelegate();
     [m_proxy.get() setDelegate:nil];
     WebResourceLoader::releaseDelegate();
 }
@@ -107,7 +99,12 @@ void MainResourceLoader::didCancel(NSError *error)
     // Calling receivedMainResourceError will likely result in the last reference to this object to go away.
     RefPtr<MainResourceLoader> protect(this);
 
-    frameLoader()->cancelContentPolicyCheck();
+    if (m_waitingForContentPolicy) {
+        frameLoader()->cancelContentPolicyCheck();
+        ASSERT(m_waitingForContentPolicy);
+        m_waitingForContentPolicy = false;
+        deref(); // balances ref in didReceiveResponse
+    }
     frameLoader()->receivedMainResourceError(error, true);
     WebResourceLoader::didCancel(error);
 }
@@ -122,10 +119,16 @@ void MainResourceLoader::stopLoadingForPolicyChange()
     cancel(interruptionForPolicyChangeError());
 }
 
-void MainResourceLoader::continueAfterNavigationPolicy(NSURLRequest *r)
+void MainResourceLoader::callContinueAfterNavigationPolicy(void* argument, NSURLRequest *request, PassRefPtr<FormState>)
 {
-    if (!r)
+    static_cast<MainResourceLoader*>(argument)->continueAfterNavigationPolicy(request);
+}
+
+void MainResourceLoader::continueAfterNavigationPolicy(NSURLRequest *request)
+{
+    if (!request)
         stopLoadingForPolicyChange();
+    deref(); // balances ref in willSendRequest
 }
 
 bool MainResourceLoader::isPostOrRedirectAfterPost(NSURLRequest *newRequest, NSURLResponse *redirectResponse)
@@ -191,7 +194,8 @@ NSURLRequest *MainResourceLoader::willSendRequest(NSURLRequest *newRequest, NSUR
     // Don't set this on the first request. It is set when the main load was started.
     frameLoader()->setRequest(newRequest);
 
-    frameLoader()->checkNavigationPolicy(newRequest, policyDelegate(), @selector(continueAfterNavigationPolicy:formState:));
+    ref(); // balanced by deref in continueAfterNavigationPolicy
+    frameLoader()->checkNavigationPolicy(newRequest, callContinueAfterNavigationPolicy, this);
 
     return newRequest;
 }
@@ -269,18 +273,23 @@ void MainResourceLoader::continueAfterContentPolicy(PolicyAction contentPolicy,
         didFinishLoading();
 }
 
+void MainResourceLoader::callContinueAfterContentPolicy(void* argument, PolicyAction policy)
+{
+    static_cast<MainResourceLoader*>(argument)->continueAfterContentPolicy(policy);
+}
+
 void MainResourceLoader::continueAfterContentPolicy(PolicyAction policy)
 {
-    bool isStopping = frameLoader()->isStopping();
-    frameLoader()->cancelContentPolicyCheck();
-    if (!isStopping)
+    ASSERT(m_waitingForContentPolicy);
+    m_waitingForContentPolicy = false;
+    if (!frameLoader()->isStopping())
         continueAfterContentPolicy(policy, m_response.get());
+    deref(); // balances ref in didReceiveResponse
 }
 
 void MainResourceLoader::didReceiveResponse(NSURLResponse *r)
 {
-    ASSERT(shouldLoadAsEmptyDocument([r URL]) || !defersCallbacks());
-    ASSERT(shouldLoadAsEmptyDocument([r URL]) || !frameLoader()->defersCallbacks());
+    ASSERT(shouldLoadAsEmptyDocument([r URL]) || !defersLoading());
 
     if (m_loadingMultipartContent) {
         frameLoader()->setupForReplaceByMIMEType([r MIMEType]);
@@ -298,15 +307,18 @@ void MainResourceLoader::didReceiveResponse(NSURLResponse *r)
     m_contentLength = (int)[r expectedContentLength];
 
     m_response = r;
-    frameLoader()->checkContentPolicy([m_response.get() MIMEType], policyDelegate(), @selector(continueAfterContentPolicy:));
+
+    ASSERT(!m_waitingForContentPolicy);
+    m_waitingForContentPolicy = true;
+    ref(); // balanced by deref in continueAfterContentPolicy and didCancel
+    frameLoader()->checkContentPolicy([m_response.get() MIMEType], callContinueAfterContentPolicy, this);
 }
 
 void MainResourceLoader::didReceiveData(NSData *data, long long lengthReceived, bool allAtOnce)
 {
     ASSERT(data);
     ASSERT([data length] != 0);
-    ASSERT(!defersCallbacks());
-    ASSERT(!frameLoader()->defersCallbacks());
+    ASSERT(!defersLoading());
  
     // The additional processing can do anything including possibly removing the last
     // reference to this object; one example of this is 3266216.
@@ -318,8 +330,7 @@ void MainResourceLoader::didReceiveData(NSData *data, long long lengthReceived,
 
 void MainResourceLoader::didFinishLoading()
 {
-    ASSERT(shouldLoadAsEmptyDocument(frameLoader()->URL()) || !defersCallbacks());
-    ASSERT(shouldLoadAsEmptyDocument(frameLoader()->URL()) || !frameLoader()->defersCallbacks());
+    ASSERT(shouldLoadAsEmptyDocument(frameLoader()->URL()) || !defersLoading());
 
     // The additional processing can do anything including possibly removing the last
     // reference to this object.
@@ -331,8 +342,7 @@ void MainResourceLoader::didFinishLoading()
 
 void MainResourceLoader::didFail(NSError *error)
 {
-    ASSERT(!defersCallbacks());
-    ASSERT(!frameLoader()->defersCallbacks());
+    ASSERT(!defersLoading());
 
     receivedError(error);
 }
@@ -342,8 +352,7 @@ NSURLRequest *MainResourceLoader::loadNow(NSURLRequest *r)
     bool shouldLoadEmptyBeforeRedirect = shouldLoadAsEmptyDocument([r URL]);
 
     ASSERT(!connection());
-    ASSERT(shouldLoadEmptyBeforeRedirect || !defersCallbacks());
-    ASSERT(shouldLoadEmptyBeforeRedirect || !frameLoader()->defersCallbacks());
+    ASSERT(shouldLoadEmptyBeforeRedirect || !defersLoading());
 
     // Send this synthetic delegate callback since clients expect it, and
     // we no longer send the callback from within NSURLConnection for
@@ -352,7 +361,7 @@ NSURLRequest *MainResourceLoader::loadNow(NSURLRequest *r)
     NSURL *URL = [r URL];
     bool shouldLoadEmpty = shouldLoadAsEmptyDocument(URL);
 
-    if (shouldLoadEmptyBeforeRedirect && !shouldLoadEmpty && defersCallbacks())
+    if (shouldLoadEmptyBeforeRedirect && !shouldLoadEmpty && defersLoading())
         return r;
 
     if (shouldLoadEmpty || frameLoader()->representationExistsForURLScheme([URL scheme])) {
@@ -379,7 +388,7 @@ bool MainResourceLoader::load(NSURLRequest *r)
 {
     ASSERT(!connection());
 
-    bool defer = defersCallbacks();
+    bool defer = defersLoading();
     if (defer) {
         bool shouldLoadEmpty = shouldLoadAsEmptyDocument([r URL]);
         if (shouldLoadEmpty)
@@ -389,7 +398,7 @@ bool MainResourceLoader::load(NSURLRequest *r)
         r = loadNow(r);
         if (r) {
             // Started as an empty document, but was redirected to something non-empty.
-            ASSERT(defersCallbacks());
+            ASSERT(defersLoading());
             defer = true;
         }
     }
@@ -402,9 +411,9 @@ bool MainResourceLoader::load(NSURLRequest *r)
     return true;
 }
 
-void MainResourceLoader::setDefersCallbacks(bool defers)
+void MainResourceLoader::setDefersLoading(bool defers)
 {
-    WebResourceLoader::setDefersCallbacks(defers);
+    WebResourceLoader::setDefersLoading(defers);
     if (!defers) {
         RetainPtr<NSURLRequest> r = m_initialRequest;
         if (r) {
@@ -414,54 +423,4 @@ void MainResourceLoader::setDefersCallbacks(bool defers)
     }
 }
 
-WebCoreMainResourceLoaderAsPolicyDelegate *MainResourceLoader::policyDelegate()
-{
-    if (!m_policyDelegate) {
-        WebCoreMainResourceLoaderAsPolicyDelegate *d = [[WebCoreMainResourceLoaderAsPolicyDelegate alloc] initWithLoader:this];
-        m_policyDelegate = d;
-        [d release];
-    }
-    return m_policyDelegate.get();
 }
-
-void MainResourceLoader::releasePolicyDelegate()
-{
-    if (!m_policyDelegate)
-        return;
-    [m_policyDelegate.get() detachLoader];
-    m_policyDelegate = nil;
-}
-
-}
-
-@implementation WebCoreMainResourceLoaderAsPolicyDelegate
-
-- (id)initWithLoader:(MainResourceLoader*)loader
-{
-    self = [self init];
-    if (!self)
-        return nil;
-    m_loader = loader;
-    return self;
-}
-
-- (void)detachLoader
-{
-    m_loader = nil;
-}
-
-- (void)continueAfterNavigationPolicy:(NSURLRequest *)request formState:(id)formState
-{
-    if (!m_loader)
-        return;
-    m_loader->continueAfterNavigationPolicy(request);
-}
-
-- (void)continueAfterContentPolicy:(PolicyAction)policy
-{
-    if (!m_loader)
-        return;
-    m_loader->continueAfterContentPolicy(policy);
-}
-
-@end
diff --git a/WebCore/loader/mac/WebPolicyDecider.h b/WebCore/loader/mac/WebPolicyDecider.h
deleted file mode 100644 (file)
index 84b6280..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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.
- */
-
-#import <Cocoa/Cocoa.h>
-
-@interface WebPolicyDecider : NSObject
-{
-}
-
-- (void)invalidate;
-
-@end
diff --git a/WebCore/loader/mac/WebPolicyDecider.mm b/WebCore/loader/mac/WebPolicyDecider.mm
deleted file mode 100644 (file)
index 1d8df76..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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.
- */
-
-#import "config.h"
-#import "WebPolicyDecider.h"
-
-#import <wtf/Assertions.h>
-
-@implementation WebPolicyDecider
-
-
-- (void)invalidate
-{
-    ASSERT_NOT_REACHED();
-}
-
-@end
index cd601ce..5f8b2c1 100644 (file)
@@ -3018,7 +3018,7 @@ void Frame::paint(GraphicsContext* p, const IntRect& rect)
             renderer()->document()->invalidateRenderedRectsForMarkersInRect(rect);
         renderer()->layer()->paint(p, rect, d->m_paintRestriction, eltRenderer);
 
-#if __APPLE__
+#if PLATFORM(MAC)
         // Regions may have changed as a result of the visibility/z-index of element changing.
         if (renderer()->document()->dashboardRegionsDirty())
             renderer()->view()->frameView()->updateDashboardRegions();
index b016983..09c0c0a 100644 (file)
@@ -792,14 +792,11 @@ protected:
     void autoscrollTimerFired(Timer<Frame>*);
 
 public:
-  friend class FrameMac;
-  friend class FrameWin;
-#if PLATFORM(GDK)
   friend class FrameGdk;
-#endif
-#if PLATFORM(QT)
+  friend class FrameLoader;
+  friend class FrameMac;
   friend class FrameQt;
-#endif
+  friend class FrameWin;
 
   HitTestResult hitTestResultAtPoint(const IntPoint&, bool allowShadowContent);
   bool hasSelection();
index ae1823c..1a59b10 100644 (file)
@@ -532,7 +532,7 @@ void FrameView::layout(bool allowSubtree)
     
     d->layoutCount++;
 
-#if __APPLE__
+#if PLATFORM(MAC)
     if (AXObjectCache::accessibilityEnabled())
         root->document()->axObjectCache()->postNotificationToElement(root, "AXLayoutComplete");
     updateDashboardRegions();
index 14b41b5..5d55618 100644 (file)
@@ -184,7 +184,7 @@ public:
     
     void setResizingFrameSet(HTMLFrameSetElement *);
 
-#if __APPLE__
+#if PLATFORM(MAC)
     void updateDashboardRegions();
 #endif
 
index 3ce1dc2..0bad24e 100644 (file)
@@ -22,6 +22,7 @@
 #include "Page.h"
 
 #include "Frame.h"
+#include "FrameLoader.h"
 #include "FrameTree.h"
 #include "StringHash.h"
 #include "Widget.h"
@@ -132,4 +133,14 @@ SelectionController* Page::dragCaretController() const
     return &m_dragCaretController;
 }
 
+void Page::setDefersLoading(bool defers)
+{
+    if (defers == m_defersLoading)
+        return;
+
+    m_defersLoading = defers;
+    for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext())
+        frame->loader()->setDefersLoading(defers);
+}
+
 }
index 9e9e261..0ae620d 100644 (file)
@@ -75,6 +75,9 @@ namespace WebCore {
         bool canRunModalNow();
         void runModal();
 
+        void setDefersLoading(bool);
+        bool defersLoading() const { return m_defersLoading; }
+
 #if PLATFORM(MAC)
         Page(WebCorePageBridge*);
         WebCorePageBridge* bridge() const { return m_bridge; }
@@ -94,6 +97,7 @@ namespace WebCore {
         int m_frameCount;
         String m_groupName;
         mutable SelectionController m_dragCaretController;
+        bool m_defersLoading;
 
 #if PLATFORM(MAC)
         WebCorePageBridge* m_bridge;
index a7bf32b..7d3191d 100644 (file)
 
 #include <ctype.h>
 #include <unicode/uchar.h>
-#if __APPLE__
+#include "DeprecatedCString.h"
+
+#if PLATFORM(CF)
 #include <CoreFoundation/CoreFoundation.h>
 #endif
-#include "DeprecatedCString.h"
 
 #if __APPLE__
 #ifdef __OBJC__
index c96706a..aa735bf 100644 (file)
 #include "DeprecatedString.h"
 #include "DeprecatedValueList.h"
 
-#ifdef __APPLE__
 #ifdef __OBJC__
 @class NSArray;
-#else
-class NSArray;
-#endif
 #endif
 
 namespace WebCore {
@@ -48,7 +44,7 @@ public:
     
     DeprecatedString pop_front();
     
-#ifdef __APPLE__
+#ifdef __OBJC__
     NSArray *getNSArray() const;
 #endif
 };
index 67f0c46..0fa2936 100644 (file)
@@ -52,9 +52,7 @@ private:
     const FontData* fontDataAt(const Font*, unsigned index) const;
     const FontData* fontDataForCharacters(const Font*, const UChar*, int length) const;
     
-#if __APPLE__
     void setPlatformFont(const FontPlatformData&);
-#endif
 
     mutable Vector<const FontData*, 1> m_fontList;
     mutable int m_familyIndex;
index 2bda80d..c948ddb 100644 (file)
 #include "PlatformString.h"
 #include <wtf/Platform.h>
 
+#if PLATFORM(MAC)
 #ifdef __OBJC__
 @class NSEvent;
 #else
 class NSEvent;
 #endif
+#endif
 
 #if PLATFORM(WIN)
 typedef struct HWND__ *HWND;
-typedef unsigned    WPARAM;
-typedef long        LPARAM;
+typedef unsigned WPARAM;
+typedef long LPARAM;
 #endif
 
 #if PLATFORM(GDK)
@@ -65,7 +67,7 @@ namespace WebCore {
         bool altKey() const { return m_altKey; }
         bool metaKey() const { return m_metaKey; }
 
-#ifdef __APPLE__
+#if PLATFORM(MAC)
         PlatformKeyboardEvent(NSEvent*, bool forceAutoRepeat = false);
 #endif
 
index b785fe8..fbd6812 100644 (file)
@@ -29,7 +29,7 @@
 #include "IntPoint.h"
 #include <wtf/Platform.h>
 
-#if __APPLE__
+#if PLATFORM(MAC)
 #ifdef __OBJC__
 @class NSEvent;
 #else
@@ -96,7 +96,7 @@ namespace WebCore {
         bool altKey() const { return m_altKey; }
         bool metaKey() const { return m_metaKey; }
 
-#if __APPLE__
+#if PLATFORM(MAC)
         PlatformMouseEvent(NSEvent*);
 #endif
 #if PLATFORM(WIN)
index dc8c2db..3ae6c67 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "IntPoint.h"
 
-#ifdef __APPLE__
+#ifdef PLATFORM(MAC)
 #ifdef __OBJC__
 @class NSEvent;
 #else
@@ -70,7 +70,7 @@ namespace WebCore {
         void accept() { m_isAccepted = true; }
         void ignore() { m_isAccepted = false; }
 
-#ifdef __APPLE__
+#ifdef PLATFORM(MAC)
         PlatformWheelEvent(NSEvent*);
 #endif
 #if PLATFORM(WIN)
index fb59438..8b6483d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2004, 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
@@ -28,7 +28,6 @@
 #ifndef ClipboardMac_h
 #define ClipboardMac_h
 
-#include "Image.h"
 #include "IntPoint.h"
 #include "Clipboard.h"
 #include "ClipboardAccessPolicy.h"
@@ -40,7 +39,7 @@
 #else
 class NSImage;
 class NSPasteboard;
-typedef unsigned int NSDragOperation;
+typedef unsigned NSDragOperation;
 #endif
 
 namespace WebCore {
@@ -49,44 +48,42 @@ class FrameMac;
 
 class ClipboardMac : public Clipboard, public CachedResourceClient {
 public:
-    ClipboardMac(bool forDragging, NSPasteboard *pasteboard, ClipboardAccessPolicy policy, FrameMac *frame = 0);
+    ClipboardMac(bool forDragging, NSPasteboard *, ClipboardAccessPolicy, FrameMac* = 0);
     virtual ~ClipboardMac();
 
     bool isForDragging() const;
     
     String dropEffect() const;
-    void setDropEffect(const String &s);
+    void setDropEffect(const String&);
     String effectAllowed() const;
-    void setEffectAllowed(const String &s);
+    void setEffectAllowed(const String&);
     
-    void clearData(const String &type);
+    void clearData(const Stringtype);
     void clearAllData();
-    String getData(const String &type, bool &success) const;
-    bool setData(const String &type, const String &data);
+    String getData(const String& type, bool& success) const;
+    bool setData(const String& type, const String& data);
         
     // extensions beyond IE's API
     virtual HashSet<String> types() const;
 
     IntPoint dragLocation() const;    // same point as client passed us
     CachedImage* dragImage() const;
-    void setDragImage(CachedImage*, const IntPoint &);
-    Node *dragImageElement();
-    void setDragImageElement(Node *, const IntPoint &);
+    void setDragImage(CachedImage*, const IntPoint&);
+    NodedragImageElement();
+    void setDragImageElement(Node *, const IntPoint&);
 
-#if __APPLE__
     // Methods for getting info in Cocoa's type system
-    NSImage *dragNSImage(NSPoint *loc);    // loc converted from dragLoc, based on whole image size
-    bool sourceOperation(NSDragOperation *op) const;
-    bool destinationOperation(NSDragOperation *op) const;
-    void setSourceOperation(NSDragOperation op);
-    void setDestinationOperation(NSDragOperation op);
-#endif
+    NSImage *dragNSImage(NSPoint&); // loc converted from dragLoc, based on whole image size
+    bool sourceOperation(NSDragOperation&) const;
+    bool destinationOperation(NSDragOperation&) const;
+    void setSourceOperation(NSDragOperation);
+    void setDestinationOperation(NSDragOperation);
 
     void setAccessPolicy(ClipboardAccessPolicy);
     void setDragHasStarted() { m_dragStarted = true; }
     
 private:
-    void setDragImage(CachedImage* cachedImage, Node *, const IntPoint &loc);
+    void setDragImage(CachedImage*, Node*, const IntPoint&);
 
     NSPasteboard *m_pasteboard;
     bool m_forDragging;
@@ -98,7 +95,7 @@ private:
     ClipboardAccessPolicy m_policy;
     int m_changeCount;
     bool m_dragStarted;
-    FrameMac *m_frame;   // used on the source side to generate dragging images
+    FrameMac* m_frame; // used on the source side to generate dragging images
 };
 
 }
index 8482a03..31b902f 100644 (file)
 #import "CachedImage.h"
 #import "FoundationExtras.h"
 #import "FrameMac.h"
+#import "Image.h"
 #import "WebCoreSystemInterface.h"
 
 namespace WebCore {
 
 ClipboardMac::ClipboardMac(bool forDragging, NSPasteboard *pasteboard, ClipboardAccessPolicy policy, FrameMac *frame)
-  : m_pasteboard(HardRetain(pasteboard)), m_forDragging(forDragging), m_dragImage(0),
-    m_policy(policy), m_dragStarted(false), m_frame(frame)
+    : m_pasteboard(HardRetain(pasteboard))
+    , m_forDragging(forDragging)
+    , m_dragImage(0)
+    , m_policy(policy)
+    , m_dragStarted(false)
+    , m_frame(frame)
 {
     m_changeCount = [m_pasteboard changeCount];
 }
@@ -57,7 +62,7 @@ void ClipboardMac::setAccessPolicy(ClipboardAccessPolicy policy)
     m_policy = policy;
 }
 
-static NSString *cocoaTypeFromMIMEType(const String &type)
+static NSString *cocoaTypeFromMIMEType(const Stringtype)
 {
     String qType = type.stripWhiteSpace();
 
@@ -85,18 +90,16 @@ static NSString *cocoaTypeFromMIMEType(const String &type)
     }
 
    // No mapping, just pass the whole string though
-    return (NSString*)qType;
+    return qType;
 }
 
-static DeprecatedString MIMETypeFromCocoaType(NSString *type)
+static String MIMETypeFromCocoaType(NSString *type)
 {
     // UTI may not do these right, so make sure we get the right, predictable result
-    if ([type isEqualToString:NSStringPboardType]) {
-        return DeprecatedString("text/plain");
-    }
-    if ([type isEqualToString:NSURLPboardType] || [type isEqualToString:NSFilenamesPboardType]) {
-        return DeprecatedString("text/uri-list");
-    }
+    if ([type isEqualToString:NSStringPboardType])
+        return "text/plain";
+    if ([type isEqualToString:NSURLPboardType] || [type isEqualToString:NSFilenamesPboardType])
+        return "text/uri-list";
     
     // Now try the general UTI mechanism
     CFStringRef UTIType = UTTypeCreatePreferredIdentifierForTag(kUTTagClassNSPboardType, (CFStringRef)type, NULL);
@@ -104,21 +107,21 @@ static DeprecatedString MIMETypeFromCocoaType(NSString *type)
         CFStringRef mimeType = UTTypeCopyPreferredTagWithClass(UTIType, kUTTagClassMIMEType);
         CFRelease(UTIType);
         if (mimeType) {
-            DeprecatedString result = DeprecatedString::fromCFString(mimeType);
+            String result = mimeType;
             CFRelease(mimeType);
             return result;
         }
     }
 
     // No mapping, just pass the whole string though
-    return DeprecatedString::fromNSString(type);
+    return type;
 }
 
-void ClipboardMac::clearData(const String &type)
+void ClipboardMac::clearData(const Stringtype)
 {
-    if (m_policy != ClipboardWritable) {
+    if (m_policy != ClipboardWritable)
         return;
-    }
+
     // note NSPasteboard enforces changeCount itself on writing - can't write if not the owner
 
     NSString *cocoaType = cocoaTypeFromMIMEType(type);
@@ -129,20 +132,19 @@ void ClipboardMac::clearData(const String &type)
 
 void ClipboardMac::clearAllData()
 {
-    if (m_policy != ClipboardWritable) {
+    if (m_policy != ClipboardWritable)
         return;
-    }
+
     // note NSPasteboard enforces changeCount itself on writing - can't write if not the owner
 
     [m_pasteboard declareTypes:[NSArray array] owner:nil];
 }
 
-String ClipboardMac::getData(const String &type, bool &success) const
+String ClipboardMac::getData(const String& type, bool& success) const
 {
     success = false;
-    if (m_policy != ClipboardReadable) {
+    if (m_policy != ClipboardReadable)
         return String();
-    }
     
     NSString *cocoaType = cocoaTypeFromMIMEType(type);
     NSString *cocoaValue = nil;
@@ -303,7 +305,7 @@ void ClipboardMac::setDragImage(CachedImage* image, Node *node, const IntPoint &
         
         if (m_dragStarted && m_changeCount == [m_pasteboard changeCount]) {
             NSPoint cocoaLoc;
-            NSImage* cocoaImage = dragNSImage(&cocoaLoc);
+            NSImage* cocoaImage = dragNSImage(cocoaLoc);
             if (cocoaImage) {
                 // Dashboard wants to be able to set the drag image during dragging, but Cocoa does not allow this.
                 // Instead we must drop down to the CoreGraphics API.
@@ -323,7 +325,7 @@ void ClipboardMac::setDragImage(CachedImage* image, Node *node, const IntPoint &
     }
 }
 
-NSImage *ClipboardMac::dragNSImage(NSPoint *loc)
+NSImage *ClipboardMac::dragNSImage(NSPointloc)
 {
     NSImage *result = nil;
     if (m_dragImageElement) {
@@ -331,21 +333,17 @@ NSImage *ClipboardMac::dragNSImage(NSPoint *loc)
             NSRect imageRect;
             NSRect elementRect;
             result = m_frame->snapshotDragImage(m_dragImageElement.get(), &imageRect, &elementRect);
-            if (loc) {
-                // Client specifies point relative to element, not the whole image, which may include child
-                // layers spread out all over the place.
-                loc->x = elementRect.origin.x - imageRect.origin.x + m_dragLoc.x();
-                loc->y = elementRect.origin.y - imageRect.origin.y + m_dragLoc.y();
-                loc->y = imageRect.size.height - loc->y;
-            }
+            // Client specifies point relative to element, not the whole image, which may include child
+            // layers spread out all over the place.
+            loc.x = elementRect.origin.x - imageRect.origin.x + m_dragLoc.x();
+            loc.y = elementRect.origin.y - imageRect.origin.y + m_dragLoc.y();
+            loc.y = imageRect.size.height - loc.y;
         }
     } else if (m_dragImage) {
         result = m_dragImage->image()->getNSImage();
         
-        if (loc) {
-            *loc = m_dragLoc;
-            loc->y = [result size].height - loc->y;
-        }
+        loc = m_dragLoc;
+        loc.y = [result size].height - loc.y;
     }
     return result;
 }
@@ -374,70 +372,66 @@ void ClipboardMac::setEffectAllowed(const String &s)
 }
 
 // These "conversion" methods are called by the bridge and part, and never make sense to JS, so we don't
-// worry about security for these.  The don't allow access to the pasteboard anyway.
+// worry about security for these. They don't allow access to the pasteboard anyway.
 
-static NSDragOperation cocoaOpFromIEOp(const String &op) {
+static NSDragOperation cocoaOpFromIEOp(const String& op)
+{
     // yep, it's really just this fixed set
-    if (op == "none") {
+    if (op == "none")
         return NSDragOperationNone;
-    } else if (op == "copy") {
+    if (op == "copy")
         return NSDragOperationCopy;
-    } else if (op == "link") {
+    if (op == "link")
         return NSDragOperationLink;
-    } else if (op == "move") {
+    if (op == "move")
         return NSDragOperationGeneric;
-    } else if (op == "copyLink") {
+    if (op == "copyLink")
         return NSDragOperationCopy | NSDragOperationLink;
-    } else if (op == "copyMove") {
+    if (op == "copyMove")
         return NSDragOperationCopy | NSDragOperationGeneric | NSDragOperationMove;
-    } else if (op == "linkMove") {
+    if (op == "linkMove")
         return NSDragOperationLink | NSDragOperationGeneric | NSDragOperationMove;
-    } else if (op == "all") {
+    if (op == "all")
         return NSDragOperationEvery;
-    } else
-        return NSDragOperationPrivate;  // really a marker for "no conversion"
+    return NSDragOperationPrivate;  // really a marker for "no conversion"
 }
 
-static const String IEOpFromCocoaOp(NSDragOperation op) {
+static String IEOpFromCocoaOp(NSDragOperation op)
+{
     bool moveSet = ((NSDragOperationGeneric | NSDragOperationMove) & op) != 0;
     
     if ((moveSet && (op & NSDragOperationCopy) && (op & NSDragOperationLink))
-        || (op == NSDragOperationEvery)) {
+        || (op == NSDragOperationEvery))
         return "all";
-    } else if (moveSet && (op & NSDragOperationCopy)) {
+    if (moveSet && (op & NSDragOperationCopy))
         return "copyMove";
-    } else if (moveSet && (op & NSDragOperationLink)) {
+    if (moveSet && (op & NSDragOperationLink))
         return "linkMove";
-    } else if ((op & NSDragOperationCopy) && (op & NSDragOperationLink)) {
+    if ((op & NSDragOperationCopy) && (op & NSDragOperationLink))
         return "copyLink";
-    } else if (moveSet) {
+    if (moveSet)
         return "move";
-    } else if (op & NSDragOperationCopy) {
+    if (op & NSDragOperationCopy)
         return "copy";
-    } else if (op & NSDragOperationLink) {
+    if (op & NSDragOperationLink)
         return "link";
-    } else
-        return "none";
+    return "none";
 }
 
-bool ClipboardMac::sourceOperation(NSDragOperation *op) const
+bool ClipboardMac::sourceOperation(NSDragOperationop) const
 {
     if (m_effectAllowed.isNull())
         return false;
-    else {
-        *op = cocoaOpFromIEOp(m_effectAllowed);
-        return true;
-    }
+    op = cocoaOpFromIEOp(m_effectAllowed);
+    return true;
 }
 
-bool ClipboardMac::destinationOperation(NSDragOperation *op) const
+bool ClipboardMac::destinationOperation(NSDragOperationop) const
 {
     if (m_dropEffect.isNull())
         return false;
-    else {
-        *op = cocoaOpFromIEOp(m_dropEffect);
-        return true;
-    }
+    op = cocoaOpFromIEOp(m_dropEffect);
+    return true;
 }
 
 void ClipboardMac::setSourceOperation(NSDragOperation op)
index 65b43dd..6d39d0e 100644 (file)
@@ -2097,7 +2097,7 @@ void RenderObject::setStyle(RenderStyle *style)
         // If our z-index changes value or our visibility changes,
         // we need to dirty our stacking context's z-order list.
         if (style) {
-#if __APPLE__
+#if PLATFORM(MAC)
             if (m_style->visibility() != style->visibility() ||
                 m_style->zIndex() != style->zIndex() ||
                 m_style->hasAutoZIndex() != style->hasAutoZIndex())
index b6b5f61..8aa47ee 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "RenderText.h"
 
-#if __APPLE__
+#if PLATFORM(MAC)
 #include <CoreServices/CoreServices.h>
 #endif
 
@@ -33,7 +33,7 @@ namespace WebCore {
 
 int nextBreakablePosition(const UChar* str, int pos, int len, bool breakNBSP)
 {
-#if __APPLE__
+#if PLATFORM(MAC)
     OSStatus status = 0, findStatus = -1;
     static TextBreakLocatorRef breakLocator = 0;
     int nextUCBreak = -1;
@@ -49,7 +49,7 @@ int nextBreakablePosition(const UChar* str, int pos, int len, bool breakNBSP)
         // Match WinIE's breaking strategy, which is to always allow breaks after hyphens and question marks.
         if (lastCh == '-' || lastCh == '?' || lastCh == SOFT_HYPHEN)
             break;
-#if __APPLE__
+#if PLATFORM(MAC)
         // FIXME: Rewrite break location using ICU.
         // If current character, or the previous character aren't simple latin1 then
         // use the UC line break locator.  UCFindTextBreak will report false if we
index e839f30..446bdef 100644 (file)
@@ -1,3 +1,76 @@
+2006-10-28  Darin Adler  <darin@apple.com>
+
+        Reviewed by Maciej.
+
+        - eliminated the use of Objective-C for the policy decider
+          machinery, obviating the need for WebPolicyDeciderMac
+
+        - moved the defersLoading flag from WebView to WebCore::Page
+
+        - removed unused copies of four methods that in the frame bridge;
+          the actually-used copies are in the page bridge
+
+        - updated for rename of PassRefPtr::release to releaseRef
+
+        * WebView/WebPolicyDeciderMac.h: Removed.
+        * WebView/WebPolicyDeciderMac.m: Removed.
+        * WebKit.xcodeproj/project.pbxproj: Updated for removal.
+
+        * Plugins/WebBaseNetscapePluginView.mm:
+        (-[WebBaseNetscapePluginView sendEvent:]):
+        * Plugins/WebNetscapePluginStream.mm:
+        * WebCoreSupport/WebFrameBridge.mm:
+        * WebCoreSupport/WebFrameLoaderClient.h:
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+        (getWebView):
+        (WebFrameLoaderClient::WebFrameLoaderClient):
+        (WebFrameLoaderClient::willCloseDocument):
+        (WebFrameLoaderClient::dispatchDecidePolicyForMIMEType):
+        (WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
+        (WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
+        (WebFrameLoaderClient::cancelPolicyCheck):
+        (WebFrameLoaderClient::dispatchWillSubmitForm):
+        (WebFrameLoaderClient::setDefersLoading):
+        (WebFrameLoaderClient::setTitle):
+        (WebFrameLoaderClient::deliverArchivedResourcesAfterDelay):
+        (WebFrameLoaderClient::deliverArchivedResources):
+        (WebFrameLoaderClient::setUpPolicyListener):
+        (WebFrameLoaderClient::receivedPolicyDecison):
+        (WebFrameLoaderClient::userAgent):
+        (-[WebFramePolicyListener initWithWebCoreFrame:]):
+        (-[WebFramePolicyListener invalidate]):
+        (-[WebFramePolicyListener dealloc]):
+        (-[WebFramePolicyListener finalize]):
+        (-[WebFramePolicyListener receivedPolicyDecision:]):
+        (-[WebFramePolicyListener ignore]):
+        (-[WebFramePolicyListener download]):
+        (-[WebFramePolicyListener use]):
+        (-[WebFramePolicyListener continue]):
+        * WebCoreSupport/WebPageBridge.mm:
+        (-[WebPageBridge runModal]):
+        * WebView/WebArchiver.m:
+        (+[WebArchiver archiveSelectionInFrame:]):
+        * WebView/WebFormDelegate.h:
+        * WebView/WebFormDelegate.m:
+        (+[WebFormDelegate _sharedWebFormDelegate]):
+        (-[WebFormDelegate textFieldDidBeginEditing:inFrame:]):
+        (-[WebFormDelegate textFieldDidEndEditing:inFrame:]):
+        (-[WebFormDelegate textDidChangeInTextField:inFrame:]):
+        (-[WebFormDelegate textDidChangeInTextArea:inFrame:]):
+        (-[WebFormDelegate frame:sourceFrame:willSubmitForm:withValues:submissionListener:]):
+        * WebView/WebFrame.mm:
+        (-[WebFrame _loadURL:referrer:intoChild:]):
+        (-[WebFrame _isFrameSet]):
+        * WebView/WebFrameInternal.h:
+        * WebView/WebFrameView.mm:
+        (-[WebFrameView _shouldDrawBorder]):
+        * WebView/WebHTMLView.m:
+        (-[NSArray knowsPageRange:]):
+        * WebView/WebView.mm:
+        (-[WebView _formDelegate]):
+        * WebView/WebViewInternal.h:
+        * WebView/WebViewPrivate.h:
+
 2006-10-28  Adam Roben  <aroben@apple.com>
 
         Reviewed by Maciej.
index 867c498..54af977 100644 (file)
@@ -62,7 +62,7 @@ static WebDefaultPolicyDelegate *sharedDelegate = nil;
 - (void)webView: (WebView *)wv decidePolicyForMIMEType:(NSString *)type
                                                request:(NSURLRequest *)request
                                                  frame:(WebFrame *)frame
-                                      decisionListener:(WebPolicyDecisionListener *)listener;
+                                      decisionListener:(id <WebPolicyDecisionListener>)listener;
 {
     if ([[request URL] isFileURL]) {
         BOOL isDirectory;
@@ -85,7 +85,7 @@ static WebDefaultPolicyDelegate *sharedDelegate = nil;
 - (void)webView: (WebView *)wv decidePolicyForNavigationAction:(NSDictionary *)actionInformation 
                                                        request:(NSURLRequest *)request
                                                          frame:(WebFrame *)frame
-                                              decisionListener:(WebPolicyDecisionListener *)listener
+                                              decisionListener:(id <WebPolicyDecisionListener>)listener
 {
     WebNavigationType navType = [[actionInformation objectForKey:WebActionNavigationTypeKey] intValue];
 
@@ -106,7 +106,7 @@ static WebDefaultPolicyDelegate *sharedDelegate = nil;
 - (void)webView: (WebView *)wv decidePolicyForNewWindowAction:(NSDictionary *)actionInformation 
                                                       request:(NSURLRequest *)request
                                                  newFrameName:(NSString *)frameName
-                                             decisionListener:(WebPolicyDecisionListener *)listener
+                                             decisionListener:(id <WebPolicyDecisionListener>)listener
 {
     [listener use];
 }
index 5362c73..4a75870 100644 (file)
 #import <WebCore/FrameLoader.h> 
 #import <WebCore/FrameMac.h> 
 #import <WebCore/FrameTree.h> 
+#import <WebCore/Page.h> 
 #import <WebKit/DOMPrivate.h>
 #import <WebKit/WebUIDelegate.h>
 #import <WebKitSystemInterface.h>
 #import <objc/objc-runtime.h>
 
+using namespace WebCore;
+
 // Send null events 50 times a second when active, so plug-ins like Flash get high frame rates.
 #define NullEventIntervalActive         0.02
 #define NullEventIntervalNotActive      0.25
@@ -578,9 +581,10 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
     if (inSetWindow)
         return NO;
 
-    BOOL defers = [[self webView] defersCallbacks];
-    if (!defers)
-        [[self webView] setDefersCallbacks:YES];
+    Page* page = core([self webFrame])->page();
+    bool wasDeferring = page->defersLoading();
+    if (!wasDeferring)
+        page->setDefersLoading(true);
 
     // Can only send updateEvt to CoreGraphics and OpenGL plugins when actually drawing
     ASSERT((drawingModel != NPDrawingModelCoreGraphics && drawingModel != NPDrawingModelOpenGL) || event->what != updateEvt || [NSView focusView] == self);
@@ -624,8 +628,8 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
         free(portState);
     }
 
-    if (!defers)
-        [[self webView] setDefersCallbacks:NO];
+    if (!wasDeferring)
+        page->setDefersLoading(false);
             
     return acceptedEvent;
 }
index 99b5fc6..7abae1b 100644 (file)
@@ -72,7 +72,7 @@ using namespace WebCore;
     if (hideReferrer)
         [(NSMutableURLRequest *)request _web_setHTTPReferrer:nil];
 
-    _loader = NetscapePlugInStreamLoader::create(core([view webFrame]), self).release();
+    _loader = NetscapePlugInStreamLoader::create(core([view webFrame]), self).releaseRef();
     
     isTerminated = NO;
 
index 830e85f..127c1cb 100644 (file)
@@ -647,16 +647,6 @@ NSString *WebPluginContainerKey =   @"WebPluginContainer";
     return previousKeyView;
 }
 
-- (BOOL)defersLoading
-{
-    return [[self webView] defersCallbacks];
-}
-
-- (void)setDefersLoading:(BOOL)defers
-{
-    [[self webView] setDefersCallbacks:defers];
-}
-
 - (void)setNeedsReapplyStyles
 {
     NSView <WebDocumentView> *view = [[_frame frameView] documentView];
@@ -1391,87 +1381,6 @@ static id <WebFormDelegate> formDelegate(WebFrameBridge *self)
     return nil;
 }
 
-- (WebCorePageBridge *)createModalDialogWithURL:(NSURL *)URL
-{
-    ASSERT(_frame != nil);
-
-    NSMutableURLRequest *request = nil;
-
-    if (URL != nil && ![URL _web_isEmpty]) {
-        request = [NSMutableURLRequest requestWithURL:URL];
-        [request _web_setHTTPReferrer:m_frame->referrer()];
-    }
-
-    WebView *currentWebView = [self webView];
-    id UIDelegate = [currentWebView UIDelegate];
-
-    WebView *newWebView = nil;
-    if ([UIDelegate respondsToSelector:@selector(webView:createWebViewModalDialogWithRequest:)])
-        newWebView = [UIDelegate webView:currentWebView createWebViewModalDialogWithRequest:request];
-    else if ([UIDelegate respondsToSelector:@selector(webView:createWebViewWithRequest:)])
-        newWebView = [UIDelegate webView:currentWebView createWebViewWithRequest:request];
-    else
-        newWebView = [[WebDefaultUIDelegate sharedUIDelegate] webView:currentWebView createWebViewWithRequest:request];
-
-    return [newWebView _pageBridge];
-}
-
-- (BOOL)canRunModal
-{
-    WebView *webView = [self webView];
-    id UIDelegate = [webView UIDelegate];
-    return [UIDelegate respondsToSelector:@selector(webViewRunModal:)];
-}
-
-- (BOOL)canRunModalNow
-{
-    return [self canRunModal] && !WebResourceLoader::inConnectionCallback();
-}
-
-- (void)runModal
-{
-    if (![self canRunModal])
-        return;
-
-    WebView *webView = [self webView];
-    if ([webView defersCallbacks]) {
-        LOG_ERROR("tried to run modal in a view when it was deferring callbacks -- should never happen");
-        return;
-    }
-
-    // Defer callbacks in all the other views in this group, so we don't try to run JavaScript
-    // in a way that could interact with this view.
-    NSMutableArray *deferredWebViews = [NSMutableArray array];
-    NSString *groupName = [webView groupName];
-    if (groupName) {
-        NSEnumerator *enumerator = [WebCoreFrameNamespaces framesInNamespace:groupName];
-        WebView *otherWebView;
-        while ((otherWebView = [[enumerator nextObject] webView]) != nil) {
-            if (otherWebView != webView && ![otherWebView defersCallbacks]) {
-                [otherWebView setDefersCallbacks:YES];
-                [deferredWebViews addObject:otherWebView];
-            }
-        }
-    }
-
-    // Go run the modal event loop.
-    [[webView UIDelegate] webViewRunModal:webView];
-
-    // Restore the callbacks for any views that we deferred them for.
-    unsigned count = [deferredWebViews count];
-    unsigned i;
-    for (i = 0; i < count; ++i) {
-        WebView *otherWebView = [deferredWebViews objectAtIndex:i];
-        [otherWebView setDefersCallbacks:NO];
-    }
-}
-
-- (void)closeURL
-{
-    [_frame _willCloseURL];
-    [super closeURL];
-}
-
 - (NSString*)imageTitleForFilename:(NSString*)filename size:(NSSize)size
 {
     return [NSString stringWithFormat:UI_STRING("%@ %.0f×%.0f pixels", "window title for a standalone image (uses multiplication symbol, not x)"), filename, size.width, size.height];
index bfe97d8..3bfd0b9 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#import <WebCore/FrameLoaderTypes.h>
 #import <WebCore/RetainPtr.h>
 #import <WebCore/Timer.h>
 #import <WebCore/WebFrameLoaderClient.h>
 #import <wtf/HashMap.h>
 
 @class WebFrame;
+@class WebFramePolicyListener;
 @class WebHistoryItem;
 @class WebResource;
 
@@ -47,6 +49,8 @@ public:
     WebFrameLoaderClient(WebFrame*);
     WebFrame* webFrame() const { return m_webFrame.get(); }
 
+    void receivedPolicyDecison(WebCore::PolicyAction);
+
 private:
     virtual void detachFrameLoader();
 
@@ -83,6 +87,8 @@ private:
     virtual void resetAfterLoadError(WebCore::LoadErrorResetToken*);
     virtual void doNotResetAfterLoadError(WebCore::LoadErrorResetToken*);
 
+    virtual void willCloseDocument();
+
     virtual void detachedFromParent1();
     virtual void detachedFromParent2();
     virtual void detachedFromParent3();
@@ -119,12 +125,17 @@ private:
     virtual WebCore::Frame* dispatchCreatePage(NSURLRequest *);
     virtual void dispatchShow();
 
-    virtual void dispatchDecidePolicyForMIMEType(WebPolicyDecider *, const WebCore::String& MIMEType, NSURLRequest *);
-    virtual void dispatchDecidePolicyForNewWindowAction(WebPolicyDecider *, NSDictionary *action, NSURLRequest *, const WebCore::String& frameName);
-    virtual void dispatchDecidePolicyForNavigationAction(WebPolicyDecider *, NSDictionary *action, NSURLRequest *);
+    virtual void dispatchDecidePolicyForMIMEType(WebCore::FramePolicyFunction,
+        const WebCore::String& MIMEType, NSURLRequest *);
+    virtual void dispatchDecidePolicyForNewWindowAction(WebCore::FramePolicyFunction,
+        NSDictionary *action, NSURLRequest *, const WebCore::String& frameName);
+    virtual void dispatchDecidePolicyForNavigationAction(WebCore::FramePolicyFunction,
+        NSDictionary *action, NSURLRequest *);
+    virtual void cancelPolicyCheck();
+
     virtual void dispatchUnableToImplementPolicy(NSError *);
 
-    virtual void dispatchWillSubmitForm(WebPolicyDecider *, WebCore::Frame* sourceFrame, WebCore::Element* form, NSDictionary *values);
+    virtual void dispatchWillSubmitForm(WebCore::FramePolicyFunction, PassRefPtr<WebCore::FormState>);
 
     virtual void dispatchDidLoadMainResource(WebCore::DocumentLoader*);
     virtual void clearLoadingFromPageCache(WebCore::DocumentLoader*);
@@ -161,9 +172,9 @@ private:
 
     virtual bool shouldFallBack(NSError *);
 
-    virtual NSURL *mainFrameURL();
+    virtual void setDefersLoading(bool);
 
-    virtual void setDefersCallbacks(bool);
+    virtual WebCore::String userAgent(NSURL *);
 
     virtual bool willUseArchive(WebCore::WebResourceLoader*, NSURLRequest *, NSURL *originalURL) const;
     virtual bool isArchiveLoadPending(WebCore::WebResourceLoader*) const;
@@ -177,8 +188,6 @@ private:
 
     virtual NSDictionary *elementForEvent(NSEvent *) const;
 
-    virtual WebPolicyDecider *createPolicyDecider(id object, SEL selector);
-
     virtual void frameLoadCompleted();
     virtual void restoreScrollPositionAndViewState();
     virtual void provisionalLoadStarted();
@@ -187,16 +196,22 @@ private:
     virtual void didFinishLoad();
     virtual void prepareForDataSourceReplacement();
     virtual PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(NSURLRequest *);
-    virtual void setTitle(NSString *title, NSURL *);
+    virtual void setTitle(const WebCore::String& title, NSURL *);
 
     void deliverArchivedResourcesAfterDelay() const;
     bool canUseArchivedResource(NSURLRequest *) const;
     bool canUseArchivedResource(NSURLResponse *) const;
     void deliverArchivedResources(WebCore::Timer<WebFrameLoaderClient>*);
 
+    WebFramePolicyListener *setUpPolicyListener(WebCore::FramePolicyFunction);
+
     bool createPageCache(WebHistoryItem *);
 
     WebCore::RetainPtr<WebFrame> m_webFrame;
+
+    WebCore::RetainPtr<WebFramePolicyListener> m_policyListener;
+    WebCore::FramePolicyFunction m_policyFunction;
+
     mutable ResourceMap m_pendingArchivedResources;
     mutable WebCore::Timer<WebFrameLoaderClient> m_archivedResourcesDeliveryTimer;
 };
index 42cf721..4a725f1 100644 (file)
@@ -38,6 +38,7 @@
 #import "WebDocumentInternal.h"
 #import "WebDocumentLoaderMac.h"
 #import "WebDownloadInternal.h"
+#import "WebFormDelegate.h"
 #import "WebFrameInternal.h"
 #import "WebFrameLoadDelegate.h"
 #import "WebFrameViewInternal.h"
@@ -50,8 +51,7 @@
 #import "WebNSURLExtras.h"
 #import "WebPageBridge.h"
 #import "WebPanelAuthenticationHandler.h"
-#import "WebPolicyDeciderMac.h"
-#import "WebPolicyDelegatePrivate.h"
+#import "WebPolicyDelegate.h"
 #import "WebPreferences.h"
 #import "WebResourceLoadDelegate.h"
 #import "WebResourcePrivate.h"
@@ -67,6 +67,7 @@
 #import <WebCore/WebCoreFrameBridge.h>
 #import <WebCore/WebDataProtocol.h>
 #import <WebCore/WebDocumentLoader.h>
+#import <WebCore/WebFormState.h>
 #import <WebCore/WebLoader.h>
 #import <WebKit/DOMElement.h>
 #import <WebKit/WebDefaultResourceLoadDelegate.h>
 #import <WebKit/WebResourceLoadDelegate.h>
 #import <WebKit/WebViewInternal.h>
 #import <WebKitSystemInterface.h>
+#import <objc/objc-runtime.h>
 #import <wtf/PassRefPtr.h>
 
 using namespace WebCore;
 
-static inline WebView* getWebView(DocumentLoader* loader)
+@interface WebFramePolicyListener : NSObject <WebPolicyDecisionListener, WebFormSubmissionListener>
 {
-    return ((WebPageBridge *)loader->frameLoader()->frame()->page()->bridge())->_webView;
+    Frame* m_frame;
+}
+- (id)initWithWebCoreFrame:(Frame*)frame;
+- (void)invalidate;
+@end
+
+static inline WebView *getWebView(DocumentLoader* loader)
+{
+    return static_cast<WebPageBridge *>(loader->frameLoader()->frame()->page()->bridge())->_webView;
 }
 
 static inline WebView *getWebView(WebFrame *webFrame)
 {
    Frame* coreFrame = core(webFrame);
-   return coreFrame ? ((WebPageBridge *)coreFrame->page()->bridge())->_webView : nil;
+   return coreFrame ? static_cast<WebPageBridge *>(coreFrame->page()->bridge())->_webView : nil;
 }
 
 static inline WebDataSource *dataSource(DocumentLoader* loader)
@@ -94,13 +104,9 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
     return loader ? static_cast<WebDocumentLoaderMac*>(loader)->dataSource() : nil;
 }
 
-static inline WebPolicyDecisionListener *decisionListener(WebPolicyDecider *decider)
-{
-    return [(WebPolicyDeciderMac *)decider decisionListener];
-}
-
 WebFrameLoaderClient::WebFrameLoaderClient(WebFrame *webFrame)
     : m_webFrame(webFrame)
+    , m_policyFunction(0)
     , m_archivedResourcesDeliveryTimer(this, &WebFrameLoaderClient::deliverArchivedResources)
 {
 }
@@ -354,6 +360,13 @@ void WebFrameLoaderClient::doNotResetAfterLoadError(LoadErrorResetToken* token)
     [item release];
 }
 
+void WebFrameLoaderClient::willCloseDocument()
+{
+    [m_webFrame->_private->plugInViews makeObjectsPerformSelector:@selector(setWebFrame:) withObject:nil];
+    [m_webFrame->_private->plugInViews release];
+    m_webFrame->_private->plugInViews = nil;
+}
+
 void WebFrameLoaderClient::detachedFromParent1()
 {
     [m_webFrame.get() _saveScrollPositionAndViewStateToItem:m_webFrame->_private->currentItem];
@@ -618,44 +631,74 @@ void WebFrameLoaderClient::dispatchShow()
     [[webView _UIDelegateForwarder] webViewShow:webView];
 }
 
-void WebFrameLoaderClient::dispatchDecidePolicyForMIMEType(WebPolicyDecider *decider, const String& MIMEType, NSURLRequest *request)
+void WebFrameLoaderClient::dispatchDecidePolicyForMIMEType(FramePolicyFunction function,
+    const String& MIMEType, NSURLRequest *request)
 {
     WebView *webView = getWebView(m_webFrame.get());
 
-    [[webView _policyDelegateForwarder] webView:webView decidePolicyForMIMEType:MIMEType request:request frame:m_webFrame.get() decisionListener:decisionListener(decider)];
+    [[webView _policyDelegateForwarder] webView:webView
+                        decidePolicyForMIMEType:MIMEType
+                                        request:request
+                                          frame:m_webFrame.get()
+                               decisionListener:setUpPolicyListener(function)];
 }
 
-void WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(WebPolicyDecider *decider, NSDictionary *action, NSURLRequest *request, const String& frameName)
+void WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function,
+    NSDictionary *action, NSURLRequest *request, const String& frameName)
 {
     WebView *webView = getWebView(m_webFrame.get());
     [[webView _policyDelegateForwarder] webView:webView
             decidePolicyForNewWindowAction:action
                                    request:request
                               newFrameName:frameName
-                          decisionListener:decisionListener(decider)];
+                          decisionListener:setUpPolicyListener(function)];
 }
 
-void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(WebPolicyDecider *decider, NSDictionary *action,
-    NSURLRequest *request)
+void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function,
+    NSDictionary *action, NSURLRequest *request)
 {
     WebView *webView = getWebView(m_webFrame.get());
     [[webView _policyDelegateForwarder] webView:webView
                 decidePolicyForNavigationAction:action
                                         request:request
                                           frame:m_webFrame.get()
-                               decisionListener:decisionListener(decider)];
+                               decisionListener:setUpPolicyListener(function)];
+}
+
+void WebFrameLoaderClient::cancelPolicyCheck()
+{
+    [m_policyListener.get() invalidate];
+    m_policyListener = nil;
+    m_policyFunction = 0;
 }
 
 void WebFrameLoaderClient::dispatchUnableToImplementPolicy(NSError *error)
 {
     WebView *webView = getWebView(m_webFrame.get());
-    [[webView _policyDelegateForwarder] webView:webView unableToImplementPolicyWithError:error frame:m_webFrame.get()];    
+    [[webView _policyDelegateForwarder] webView:webView
+        unableToImplementPolicyWithError:error frame:m_webFrame.get()];    
 }
 
-void WebFrameLoaderClient::dispatchWillSubmitForm(WebPolicyDecider *decider, Frame* sourceFrame,
-    Element* form, NSDictionary *values)
+void WebFrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState> formState)
 {
-    [[getWebView(m_webFrame.get()) _formDelegate] frame:m_webFrame.get() sourceFrame:kit(sourceFrame) willSubmitForm:kit(form) withValues:values submissionListener:decisionListener(decider)];
+    id <WebFormDelegate> formDelegate = [getWebView(m_webFrame.get()) _formDelegate];
+    if (!formDelegate) {
+        (core(m_webFrame.get())->loader()->*function)(PolicyUse);
+        return;
+    }
+
+    NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] initWithCapacity:formState->values().size()];
+    HashMap<String, String>::const_iterator end = formState->values().end();
+    for (HashMap<String, String>::const_iterator it = formState->values().begin(); it != end; ++it)
+        [dictionary setObject:it->second forKey:it->first];
+
+    [formDelegate frame:m_webFrame.get()
+            sourceFrame:kit(formState->sourceFrame())
+         willSubmitForm:kit(formState->form())
+             withValues:dictionary
+     submissionListener:setUpPolicyListener(function)];
+
+    [dictionary release];
 }
 
 void WebFrameLoaderClient::dispatchDidLoadMainResource(DocumentLoader* loader)
@@ -786,12 +829,7 @@ bool WebFrameLoaderClient::shouldFallBack(NSError *error)
     return [error code] != NSURLErrorCancelled && [error code] != WebKitErrorPlugInWillHandleLoad;
 }
 
-NSURL *WebFrameLoaderClient::mainFrameURL()
-{
-    return [[[getWebView(m_webFrame.get()) mainFrame] dataSource] _URL];
-}
-
-void WebFrameLoaderClient::setDefersCallbacks(bool defers)
+void WebFrameLoaderClient::setDefersLoading(bool defers)
 {
     if (!defers)
         deliverArchivedResourcesAfterDelay();
@@ -880,11 +918,6 @@ NSDictionary *WebFrameLoaderClient::elementForEvent(NSEvent *event) const
     return nil;
 }
 
-WebPolicyDecider *WebFrameLoaderClient::createPolicyDecider(id object, SEL selector)
-{
-    return [[WebPolicyDeciderMac alloc] initWithTarget:object action:selector];
-}
-
 void WebFrameLoaderClient::frameLoadCompleted()
 {
     // Note: Can be called multiple times.
@@ -1016,10 +1049,11 @@ PassRefPtr<DocumentLoader> WebFrameLoaderClient::createDocumentLoader(NSURLReque
     return loader.release();
 }
 
-void WebFrameLoaderClient::setTitle(NSString *title, NSURL *URL)
+void WebFrameLoaderClient::setTitle(const String& title, NSURL *URL)
 {
-    [[[WebHistory optionalSharedHistory] itemForURL:URL] setTitle:title];
-    [m_webFrame->_private->currentItem setTitle:title];
+    NSString *titleNSString = title;
+    [[[WebHistory optionalSharedHistory] itemForURL:URL] setTitle:titleNSString];
+    [m_webFrame->_private->currentItem setTitle:titleNSString];
 }
 
 // The following 2 functions are copied from [NSHTTPURLProtocol _cachedResponsePassesValidityChecks] and modified for our needs.
@@ -1059,7 +1093,7 @@ void WebFrameLoaderClient::deliverArchivedResourcesAfterDelay() const
 {
     if (m_pendingArchivedResources.isEmpty())
         return;
-    if (core(m_webFrame.get())->loader()->defersCallbacks())
+    if (core(m_webFrame.get())->page()->defersLoading())
         return;
     if (!m_archivedResourcesDeliveryTimer.isActive())
         m_archivedResourcesDeliveryTimer.startOneShot(0);
@@ -1069,7 +1103,7 @@ void WebFrameLoaderClient::deliverArchivedResources(Timer<WebFrameLoaderClient>*
 {
     if (m_pendingArchivedResources.isEmpty())
         return;
-    if (core(m_webFrame.get())->loader()->defersCallbacks())
+    if (core(m_webFrame.get())->page()->defersLoading())
         return;
 
     const ResourceMap copy = m_pendingArchivedResources;
@@ -1100,3 +1134,99 @@ bool WebFrameLoaderClient::createPageCache(WebHistoryItem *item)
     [pageCache setObject:[m_webFrame->_private->webFrameView documentView] forKey: WebPageCacheDocumentViewKey];
     return YES;
 }
+
+WebFramePolicyListener *WebFrameLoaderClient::setUpPolicyListener(FramePolicyFunction function)
+{
+    ASSERT(!m_policyListener);
+    ASSERT(!m_policyFunction);
+
+    [m_policyListener.get() invalidate];
+
+    WebFramePolicyListener *listener = [[WebFramePolicyListener alloc] initWithWebCoreFrame:core(m_webFrame.get())];
+    m_policyListener = listener;
+    [listener release];
+    m_policyFunction = function;
+
+    return listener;
+}
+
+void WebFrameLoaderClient::receivedPolicyDecison(PolicyAction action)
+{
+    ASSERT(m_policyListener);
+    ASSERT(m_policyFunction);
+
+    FramePolicyFunction function = m_policyFunction;
+
+    m_policyListener = nil;
+    m_policyFunction = 0;
+
+    (core(m_webFrame.get())->loader()->*function)(action);
+}
+
+String WebFrameLoaderClient::userAgent(NSURL *URL)
+{
+    return [getWebView(m_webFrame.get()) userAgentForURL:URL];
+}
+
+@implementation WebFramePolicyListener
+
+- (id)initWithWebCoreFrame:(Frame*)frame
+{
+    self = [self init];
+    if (!self)
+        return nil;
+    frame->ref();
+    m_frame = frame;
+    return self;
+}
+
+- (void)invalidate
+{
+    if (m_frame) {
+        m_frame->deref();
+        m_frame = 0;
+    }
+}
+
+- (void)dealloc
+{
+    if (m_frame)
+        m_frame->deref();
+    [super dealloc];
+}
+
+- (void)finalize
+{
+    if (m_frame)
+        m_frame->deref();
+    [super finalize];
+}
+
+- (void)receivedPolicyDecision:(PolicyAction)action
+{
+    RefPtr<Frame> frame = adoptRef(m_frame);
+    m_frame = 0;
+    static_cast<WebFrameLoaderClient*>(frame->loader()->client())->receivedPolicyDecison(action);
+}
+
+- (void)ignore
+{
+    [self receivedPolicyDecision:PolicyIgnore];
+}
+
+- (void)download
+{
+    [self receivedPolicyDecision:PolicyDownload];
+}
+
+- (void)use
+{
+    [self receivedPolicyDecision:PolicyUse];
+}
+
+- (void)continue
+{
+    [self receivedPolicyDecision:PolicyUse];
+}
+
+@end
index 3c0e1f5..2d4f2b3 100644 (file)
@@ -37,6 +37,7 @@
 #import "WebView.h"
 #import "WebViewInternal.h"
 #import <JavaScriptCore/Assertions.h>
+#import <WebCore/Page.h>
 #import <WebCore/WebCoreFrameNamespaces.h>
 #import <WebCore/WebLoader.h>
 
@@ -117,36 +118,32 @@ using namespace WebCore;
     if (![self canRunModal])
         return;
 
-    if ([_webView defersCallbacks]) {
-        LOG_ERROR("tried to run modal in a view when it was deferring callbacks -- should never happen");
+    if (_page->defersLoading()) {
+        LOG_ERROR("tried to run modal in a view when it was deferring loading -- should never happen");
         return;
     }
 
-    // Defer callbacks in all the other views in this group, so we don't try to run JavaScript
+    // Defer callbacks in all the other pages in this group, so we don't try to run JavaScript
     // in a way that could interact with this view.
-    NSMutableArray *deferredWebViews = [NSMutableArray array];
-    NSString *groupName = [_webView groupName];
-    if (groupName) {
-        NSEnumerator *enumerator = [WebCoreFrameNamespaces framesInNamespace:groupName];
-        WebView *otherWebView;
-        while ((otherWebView = [[enumerator nextObject] webView]) != nil) {
-            if (otherWebView != _webView && ![otherWebView defersCallbacks]) {
-                [otherWebView setDefersCallbacks:YES];
-                [deferredWebViews addObject:otherWebView];
-            }
+    Vector<Page*> pagesToDefer;
+    if (const HashSet<Page*>* group = _page->frameNamespace()) {
+        HashSet<Page*>::const_iterator end = group->end();
+        for (HashSet<Page*>::const_iterator it = group->begin(); it != end; ++it) {
+            Page* otherPage = *it;
+            if (otherPage != _page && !otherPage->defersLoading())
+                pagesToDefer.append(otherPage);
         }
     }
+    size_t count = pagesToDefer.size();
+    for (size_t i = 0; i < count; ++i)
+        pagesToDefer[i]->setDefersLoading(true);
 
     // Go run the modal event loop.
     [[_webView UIDelegate] webViewRunModal:_webView];
 
-    // Restore the callbacks for any views that we deferred them for.
-    unsigned count = [deferredWebViews count];
-    unsigned i;
-    for (i = 0; i < count; ++i) {
-        WebView *otherWebView = [deferredWebViews objectAtIndex:i];
-        [otherWebView setDefersCallbacks:NO];
-    }
+    // Restore loading for any views that we shut down.
+    for (size_t i = 0; i < count; ++i)
+        pagesToDefer[i]->setDefersLoading(false);
 }
 
 @end
index 04b4b0c..874531e 100644 (file)
@@ -50,8 +50,6 @@
                6550B7C8099EFAE90090D781 /* WebArchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 6550B7C6099EFAE90090D781 /* WebArchiver.m */; };
                656D333E0AF21AE900212169 /* WebResourceLoadDelegatePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 656D333D0AF21AE900212169 /* WebResourceLoadDelegatePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                658A40960A14853B005E6987 /* WebDataSourceInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 658A40950A14853B005E6987 /* WebDataSourceInternal.h */; };
-               658BA6FC0ADB39DE00AEB387 /* WebPolicyDeciderMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 658BA6FA0ADB39DE00AEB387 /* WebPolicyDeciderMac.h */; };
-               658BA6FD0ADB39DE00AEB387 /* WebPolicyDeciderMac.m in Sources */ = {isa = PBXBuildFile; fileRef = 658BA6FB0ADB39DE00AEB387 /* WebPolicyDeciderMac.m */; };
                65A0006908527D1A005620FA /* libWebKitSystemInterface.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 65A0006808527D1A005620FA /* libWebKitSystemInterface.a */; };
                65C7F42C0979DE640022E453 /* WebPageBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 65C7F42A0979DE640022E453 /* WebPageBridge.h */; };
                65C7F42D0979DE640022E453 /* WebPageBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65C7F42B0979DE640022E453 /* WebPageBridge.mm */; };
                6578F5DF045F817400000128 /* WebDownload.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebDownload.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                65836F5E07EE425900682F95 /* WebPluginContainerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPluginContainerPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                658A40950A14853B005E6987 /* WebDataSourceInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebDataSourceInternal.h; sourceTree = "<group>"; };
-               658BA6FA0ADB39DE00AEB387 /* WebPolicyDeciderMac.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebPolicyDeciderMac.h; sourceTree = "<group>"; };
-               658BA6FB0ADB39DE00AEB387 /* WebPolicyDeciderMac.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = WebPolicyDeciderMac.m; sourceTree = "<group>"; };
                65A0006808527D1A005620FA /* libWebKitSystemInterface.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libWebKitSystemInterface.a; sourceTree = BUILT_PRODUCTS_DIR; };
                65A7D44A0568AB2600E70EF6 /* WebUIDelegatePrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebUIDelegatePrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                65C7F42A0979DE640022E453 /* WebPageBridge.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebPageBridge.h; sourceTree = "<group>"; };
                9C7CABBB0190A37C0ECA16EA /* WebView */ = {
                        isa = PBXGroup;
                        children = (
-                               656D333D0AF21AE900212169 /* WebResourceLoadDelegatePrivate.h */,
                                F52CA6BD02DF9D0F018635CA /* HTML */,
                                51E94C0706C02CA300A9B09E /* PDF */,
+                               656D333D0AF21AE900212169 /* WebResourceLoadDelegatePrivate.h */,
                                8373435A0624EE0D00F3B289 /* WebArchive.h */,
                                6550B7C5099EFAE90090D781 /* WebArchiver.h */,
                                933D659903413FF2008635CE /* WebClipView.h */,
                                51A8B52E04282B5900CA2D3A /* WebFrameView.h */,
                                51A8B53204282BD200CA2D3A /* WebFrameViewInternal.h */,
                                93C6F14507920B93002449CD /* WebFrameViewPrivate.h */,
-                               658BA6FA0ADB39DE00AEB387 /* WebPolicyDeciderMac.h */,
                                51443F9A0429392B00CA2D3A /* WebPolicyDelegate.h */,
                                51443F9C0429392B00CA2D3A /* WebPolicyDelegatePrivate.h */,
                                EDE850CD06ECC79E005FAB05 /* WebPreferenceKeysPrivate.h */,
                                2D81DAB303EB0B2D00A80166 /* WebFormDelegate.m */,
                                F5143A370221DCCE01A80181 /* WebFrame.mm */,
                                51A8B52F04282B5900CA2D3A /* WebFrameView.mm */,
-                               658BA6FB0ADB39DE00AEB387 /* WebPolicyDeciderMac.m */,
                                51443F9B0429392B00CA2D3A /* WebPolicyDelegate.mm */,
                                F5AEBB3D024A527601C1A526 /* WebPreferences.m */,
                                84311A1305EAAAF00088EDA4 /* WebResource.m */,
                                51E4D3990A886B5E00ECEE2C /* WebIconDatabaseBridge.h in Headers */,
                                1C0D40870AC1C8F40009C113 /* WebKitVersionChecks.h in Headers */,
                                65FFB7FC0AD0B7D30048CD05 /* WebDocumentLoaderMac.h in Headers */,
-                               658BA6FC0ADB39DE00AEB387 /* WebPolicyDeciderMac.h in Headers */,
                                51B2A1000ADB15D0002A9BEE /* WebIconDatabaseDelegate.h in Headers */,
                                1C8CB07A0AE9830C00B1F6E9 /* WebEditingDelegatePrivate.h in Headers */,
                                4BF99F900AE050BC00815C2B /* WebEditorClient.h in Headers */,
                                51E4D39A0A886B5E00ECEE2C /* WebIconDatabaseBridge.m in Sources */,
                                1C0D40880AC1C8F40009C113 /* WebKitVersionChecks.m in Sources */,
                                65FFB7FD0AD0B7D30048CD05 /* WebDocumentLoaderMac.mm in Sources */,
-                               658BA6FD0ADB39DE00AEB387 /* WebPolicyDeciderMac.m in Sources */,
                                4BF99F910AE050BC00815C2B /* WebEditorClient.mm in Sources */,
                                1CA57D630AED6A470009BDD0 /* WebGraphicsExtras.c in Sources */,
                                931633EF0AEDFFAE0062B92D /* WebFrameLoaderClient.mm in Sources */,
index da34ecb..599a93c 100644 (file)
@@ -149,7 +149,7 @@ using namespace WebCore;
     NSString *markupString = [bridge markupStringFromRange:kit(coreFrame->selectionController()->toRange().get()) nodes:&nodes];
     WebArchive *archive = [self _archiveWithMarkupString:markupString fromFrame:frame nodes:nodes];
 
-    if ([bridge isFrameSet]) {
+    if (coreFrame->isFrameSet()) {
         // Wrap the frameset document in an iframe so it can be pasted into
         // another document (which will have a body or frameset of its own). 
 
index 2a3d518..1f4bee0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2003, 2005, 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
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-/*
-        WebFormDelegate.h
-        Copyright 2003, Apple Computer, Inc.
-*/
-
 #import <AppKit/AppKit.h>
 
 @class DOMElement;
@@ -40,7 +35,6 @@
 
 /*!
     @protocol  WebFormSubmissionListener
-    @discussion .
 */
 @protocol WebFormSubmissionListener <NSObject>
 - (void)continue;
@@ -48,7 +42,6 @@
 
 /*!
     @protocol  WebFormDelegate
-    @discussion .
 */
 @protocol WebFormDelegate <NSObject>
 
@@ -66,7 +59,9 @@
 
 // Sent when a form is just about to be submitted (before the load is started)
 // listener must be sent continue when the delegate is done.
-- (void)frame:(WebFrame *)frame sourceFrame:(WebFrame *)sourceFrame willSubmitForm:(DOMElement *)form withValues:(NSDictionary *)values submissionListener:(id <WebFormSubmissionListener>)listener;
+- (void)frame:(WebFrame *)frame sourceFrame:(WebFrame *)sourceFrame willSubmitForm:(DOMElement *)form
+    withValues:(NSDictionary *)values submissionListener:(id <WebFormSubmissionListener>)listener;
+
 @end
 
 /*!
@@ -76,7 +71,4 @@
     to implement some of the above methods and ignore others.
 */
 @interface WebFormDelegate : NSObject <WebFormDelegate>
-{
-}
 @end
-
index c64ab38..df25f20 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
@@ -28,8 +28,8 @@
 
 #import "WebFormDelegatePrivate.h"
 
-// FIXME: This should become an informal protocol, now that we switched all the others.
-// FIXME: To get the form elements off NSView we'll have to change this entirely.
+// FIXME: This could become an informal protocol; we switched all the API
+// delegates to be informal.
 
 @implementation WebFormDelegate
 
@@ -39,19 +39,26 @@ static WebFormDelegate *sharedDelegate = nil;
 // Note this feature relies on our default delegate being stateless
 + (WebFormDelegate *)_sharedWebFormDelegate
 {
-    if (!sharedDelegate) {
+    if (!sharedDelegate)
         sharedDelegate = [[WebFormDelegate alloc] init];
-    }
     return sharedDelegate;
 }
     
-- (void)textFieldDidBeginEditing:(DOMHTMLInputElement *)element inFrame:(WebFrame *)frame { }
+- (void)textFieldDidBeginEditing:(DOMHTMLInputElement *)element inFrame:(WebFrame *)frame
+{
+}
 
-- (void)textFieldDidEndEditing:(DOMHTMLInputElement *)element inFrame:(WebFrame *)frame { }
+- (void)textFieldDidEndEditing:(DOMHTMLInputElement *)element inFrame:(WebFrame *)frame
+{
+}
 
-- (void)textDidChangeInTextField:(DOMHTMLInputElement *)element inFrame:(WebFrame *)frame { }
+- (void)textDidChangeInTextField:(DOMHTMLInputElement *)element inFrame:(WebFrame *)frame
+{
+}
 
-- (void)textDidChangeInTextArea:(DOMHTMLTextAreaElement *)element inFrame:(WebFrame *)frame { }
+- (void)textDidChangeInTextArea:(DOMHTMLTextAreaElement *)element inFrame:(WebFrame *)frame
+{
+}
 
 - (BOOL)textField:(DOMHTMLInputElement *)element doCommandBySelector:(SEL)commandSelector inFrame:(WebFrame *)frame
 {
@@ -63,7 +70,8 @@ static WebFormDelegate *sharedDelegate = nil;
     return NO;
 }
 
-- (void)frame:(WebFrame *)frame sourceFrame:(WebFrame *)sourceFrame willSubmitForm:(DOMElement *)form withValues:(NSDictionary *)values submissionListener:(id <WebFormSubmissionListener>)listener
+- (void)frame:(WebFrame *)frame sourceFrame:(WebFrame *)sourceFrame willSubmitForm:(DOMElement *)form
+    withValues:(NSDictionary *)values submissionListener:(id <WebFormSubmissionListener>)listener
 {
     [listener continue];
 }
index 7dc1103..ee4175e 100644 (file)
@@ -54,7 +54,6 @@
 #import "WebNullPluginView.h"
 #import "WebPlugin.h"
 #import "WebPluginController.h"
-#import "WebPolicyDeciderMac.h"
 #import "WebPolicyDelegatePrivate.h"
 #import "WebPreferencesPrivate.h"
 #import "WebScriptDebugDelegatePrivate.h"
@@ -645,7 +644,8 @@ static inline WebView *getWebView(WebFrame *webFrame)
     if (archive)
         [childFrame loadArchive:archive];
     else
-        [childFrame _frameLoader]->load(URL, referrer, childLoadType, String(), nil, nil, nil);
+        [childFrame _frameLoader]->load(URL, referrer, childLoadType,
+            String(), nil, 0, HashMap<String, String>());
 }
 
 - (void)_saveScrollPositionAndViewStateToItem:(WebHistoryItem *)item
@@ -968,22 +968,6 @@ static inline WebView *getWebView(WebFrame *webFrame)
     [_private->plugInViews addObject:plugInView];
 }
 
-- (void)_removeAllPlugInViews
-{
-    if (!_private->plugInViews)
-        return;
-    
-    [_private->plugInViews makeObjectsPerformSelector:@selector(setWebFrame:) withObject:nil];
-    [_private->plugInViews release];
-    _private->plugInViews = nil;
-}
-
-// This is called when leaving a page or closing the WebView
-- (void)_willCloseURL
-{
-    [self _removeAllPlugInViews];
-}
-
 - (BOOL)_isMainFrame
 {
    Frame* coreFrame = core(self);
@@ -1071,7 +1055,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
 
 - (BOOL)_isFrameSet
 {
-    return [_private->bridge isFrameSet];
+    return core(self)->isFrameSet();
 }
 
 - (BOOL)_firstLayoutDone
index ae60530..e5e017f 100644 (file)
@@ -117,10 +117,6 @@ DOMRange *kit(WebCore::Range*);
 #endif
 
 - (void)_addPlugInView:(NSView *)plugInView;
-- (void)_removeAllPlugInViews;
-
-// This should be called when leaving a page or closing the WebView
-- (void)_willCloseURL;
 
 - (BOOL)_isMainFrame;
 
index bcd01d1..8c284db 100644 (file)
@@ -54,6 +54,7 @@
 #import "WebViewPrivate.h"
 #import <Foundation/NSURLRequest.h>
 #import <JavaScriptCore/Assertions.h>
+#import <WebCore/FrameMac.h>
 #import <WebCore/WebCoreFrameView.h>
 #import <WebCore/WebCoreView.h>
 #import <WebKitSystemInterface.h>
@@ -126,7 +127,7 @@ enum {
     // a border (left, right, top or bottom) if the frame edge abutts the window frame.
     NSView *docV = [self documentView];
     if ([docV isKindOfClass:[WebHTMLView class]])
-        if ([[_private->webFrame _bridge] isFrameSet])
+        if (core(_private->webFrame)->isFrameSet())
             return NO;
     return YES;
 }
index 3a42cf9..d48e1e0 100644 (file)
@@ -3303,7 +3303,7 @@ done:
     // according to the paper size
     float minLayoutWidth = 0.0f;
     float maxLayoutWidth = 0.0f;
-    if (![[self _bridge] isFrameSet]) {
+    if (!core([self _frame])->isFrameSet()) {
         float paperWidth = [self _availablePaperWidthForPrintOperation:[NSPrintOperation currentOperation]];
         minLayoutWidth = paperWidth * PrintingMinimumShrinkFactor;
         maxLayoutWidth = paperWidth * PrintingMaximumShrinkFactor;
diff --git a/WebKit/WebView/WebPolicyDeciderMac.h b/WebKit/WebView/WebPolicyDeciderMac.h
deleted file mode 100644 (file)
index e8c4956..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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.
- */
-
-#import <WebCore/WebPolicyDecider.h>
-
-@class WebPolicyDecisionListener;
-
-@interface WebPolicyDeciderMac : WebPolicyDecider
-{
-    WebPolicyDecisionListener *decisionListener;
-}
-
-- (id)initWithTarget:(id)target action:(SEL)action;
-- (WebPolicyDecisionListener *)decisionListener;
-
-@end
diff --git a/WebKit/WebView/WebPolicyDeciderMac.m b/WebKit/WebView/WebPolicyDeciderMac.m
deleted file mode 100644 (file)
index 6ed5cb1..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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.
- */
-
-#import "WebPolicyDeciderMac.h"
-
-#import <JavaScriptCore/Assertions.h>
-
-#import "WebPolicyDelegatePrivate.h"
-
-@implementation WebPolicyDeciderMac
-
-- (id)initWithTarget:(id)target action:(SEL)action
-{
-    self = [super init];
-    decisionListener = [[WebPolicyDecisionListener alloc] _initWithTarget:target action:action];
-
-    return self;
-}
-
-- (void)dealloc
-{
-    [decisionListener release];
-    [super dealloc];
-}
-
-- (WebPolicyDecisionListener *)decisionListener
-{
-    return decisionListener;
-}
-
-- (void)invalidate
-{
-    [decisionListener _invalidate];
-}
-
-@end
-
-
-
-
index d04d4ea..147e761 100644 (file)
@@ -28,7 +28,7 @@
 
 #import "WebPolicyDelegatePrivate.h"
 
-#import <WebCore/FrameLoader.h>
+#import <WebCore/FrameLoaderTypes.h>
 #import <objc/objc-runtime.h>
 
 using namespace WebCore;
@@ -46,23 +46,23 @@ NSString *WebActionOriginalURLKey = @"WebActionOriginalURLKey";
     SEL action;
 }
 
--(id)initWithTarget:(id)target action:(SEL)action;
+- (id)initWithTarget:(id)target action:(SEL)action;
 
 @end
 
 @implementation WebPolicyDecisionListenerPrivate
 
--(id)initWithTarget:(id)t action:(SEL)a
+- (id)initWithTarget:(id)t action:(SEL)a
 {
     self = [super init];
-    if (self != nil) {
-        target = [t retain];
-        action = a;
-    }
+    if (!self)
+        return nil;
+    target = [t retain];
+    action = a;
     return self;
 }
 
--(void)dealloc
+- (void)dealloc
 {
     [target release];
     [super dealloc];
@@ -72,12 +72,12 @@ NSString *WebActionOriginalURLKey = @"WebActionOriginalURLKey";
 
 @implementation WebPolicyDecisionListener
 
--(id)_initWithTarget:(id)target action:(SEL)action
+- (id)_initWithTarget:(id)target action:(SEL)action
 {
     self = [super init];
-    if (self != nil) {
-        _private = [[WebPolicyDecisionListenerPrivate alloc] initWithTarget:target action:action];
-    }
+    if (!self)
+        return nil;
+    _private = [[WebPolicyDecisionListenerPrivate alloc] initWithTarget:target action:action];
     return self;
 }
 
@@ -87,43 +87,34 @@ NSString *WebActionOriginalURLKey = @"WebActionOriginalURLKey";
     [super dealloc];
 }
 
-
--(void)_usePolicy:(PolicyAction)policy
+- (void)_usePolicy:(PolicyAction)policy
 {
-    if (_private->target != nil)
+    if (_private->target)
         ((void (*)(id, SEL, PolicyAction))objc_msgSend)(_private->target, _private->action, policy);
 }
 
--(void)_invalidate
+- (void)_invalidate
 {
-    [self retain];
-    [_private->target release];
+    id target = _private->target;
     _private->target = nil;
-    [self release];
+    [target release];
 }
 
 // WebPolicyDecisionListener implementation
 
--(void)use
+- (void)use
 {
     [self _usePolicy:PolicyUse];
 }
 
--(void)ignore
+- (void)ignore
 {
     [self _usePolicy:PolicyIgnore];
 }
 
--(void)download
+- (void)download
 {
     [self _usePolicy:PolicyDownload];
 }
 
-// WebFormSubmissionListener implementation
-
--(void)continue
-{
-    [self _usePolicy:PolicyUse];
-}
-
 @end
index 9204201..f7bbbd5 100644 (file)
  */
 
 #import <WebKit/WebPolicyDelegate.h>
-#import <WebKit/WebFormDelegate.h>
 
 @class WebHistoryItem;
+@class WebPolicyDecisionListenerPrivate;
 
 typedef enum {
-    WebNavigationTypePlugInRequest =  WebNavigationTypeOther + 1
+    WebNavigationTypePlugInRequest = WebNavigationTypeOther + 1
 } WebExtraNavigationType;
 
-@class WebPolicyDecisionListenerPrivate;
-
-@interface WebPolicyDecisionListener : NSObject <WebPolicyDecisionListener, WebFormSubmissionListener>
+@interface WebPolicyDecisionListener : NSObject <WebPolicyDecisionListener>
 {
 @private
     WebPolicyDecisionListenerPrivate *_private;
 }
-
 - (id)_initWithTarget:(id)target action:(SEL)action;
-
 - (void)_invalidate;
-
 @end
 
 @interface NSObject (WebPolicyDelegatePrivate)
-// Temporary SPI needed for <rdar://problem/3951283> can view pages from the back/forward cache that should be disallowed by Parental Controls
+// Needed for <rdar://problem/3951283> can view pages from the back/forward cache that should be disallowed by Parental Controls
 - (BOOL)webView:(WebView *)webView shouldGoToHistoryItem:(WebHistoryItem *)item;
 @end
index 7019e7b..4c025a9 100644 (file)
@@ -251,8 +251,6 @@ macro(yankAndSelect) \
     NSString *userAgent;
     BOOL userAgentOverridden;
     
-    BOOL defersCallbacks;
-
     WebPreferences *preferences;
     WebCoreSettings *settings;
         
@@ -699,22 +697,6 @@ static bool debugWidget = true;
     [request release];
 }
 
-- (BOOL)defersCallbacks
-{
-    return _private->defersCallbacks;
-}
-
-- (void)setDefersCallbacks:(BOOL)defers
-{
-    if (defers == _private->defersCallbacks)
-        return;
-
-    _private->defersCallbacks = defers;
-    FrameLoader* mainFrameLoader = [[self mainFrame] _frameLoader];
-    if (mainFrameLoader)
-        mainFrameLoader->defersCallbacksChanged();
-}
-
 - (WebView *)_openNewWindowWithRequest:(NSURLRequest *)request
 {
     id wd = [self UIDelegate];
@@ -856,10 +838,6 @@ static bool debugWidget = true;
 
 - (id<WebFormDelegate>)_formDelegate
 {
-    if (!_private->formDelegate) {
-        // create lazily, to give the client a chance to set one before we bother to alloc the shared one
-        _private->formDelegate = [WebFormDelegate _sharedWebFormDelegate];
-    }
     return _private->formDelegate;
 }
 
@@ -1595,6 +1573,16 @@ WebResourceDelegateImplementationCache WebViewGetResourceLoadDelegateImplementat
     return _private->backgroundColor;
 }
 
+- (BOOL)defersCallbacks
+{
+    return [_private->_pageBridge impl]->defersLoading();
+}
+
+- (void)setDefersCallbacks:(BOOL)defer
+{
+    return [_private->_pageBridge impl]->setDefersLoading(defer);
+}
+
 @end
 
 @implementation _WebSafeForwarder
index 6f7e946..1c67293 100644 (file)
@@ -55,8 +55,6 @@ id WebViewGetResourceLoadDelegate(WebView *webView);
 WebResourceDelegateImplementationCache WebViewGetResourceLoadDelegateImplementations(WebView *webView);
 
 @interface WebView (WebViewMiscInternal)
-- (BOOL)defersCallbacks;
-- (void)setDefersCallbacks:(BOOL)defers;
 - (NSMenu *)_menuForElement:(NSDictionary *)element defaultItems:(NSArray *)items;
 - (void)_setInitiatedDrag:(BOOL)initiatedDrag;
 - (id)_UIDelegateForwarder;
index 11c6de2..771e491 100644 (file)
@@ -42,8 +42,6 @@
 
 @protocol WebFormDelegate;
 
-
-
 typedef void (*WebDidCancelAuthenticationChallengeFunc)(id, SEL, WebView *, id, NSURLAuthenticationChallenge *, WebDataSource *);
 typedef void (*WebDidReceiveAuthenticationChallengeFunc)(id, SEL, WebView *, id, NSURLAuthenticationChallenge *, WebDataSource *);
 typedef id (*WebIdentifierForRequestFunc)(id, SEL, WebView *, NSURLRequest *, WebDataSource *);
@@ -187,7 +185,6 @@ Could be worth adding to the API.
 */
 + (NSString *)suggestedFileExtensionForMIMEType: (NSString *)MIMEType;
 
-
 // May well become public
 - (void)_setFormDelegate:(id<WebFormDelegate>)delegate;
 - (id<WebFormDelegate>)_formDelegate;
@@ -302,6 +299,9 @@ Could be worth adding to the API.
  */
 - (void)_detachScriptDebuggerFromAllFrames;
 
+- (BOOL)defersCallbacks; // called by QuickTime plug-in
+- (void)setDefersCallbacks:(BOOL)defer; // called by QuickTime plug-in
+
 @end
 
 @interface WebView (WebViewPrintingPrivate)