+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.
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;
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;
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;
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(T* ptr) : 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 (T* ptr = 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 (T* ptr = m_ptr) ptr->ref(); }
- T *get() const { return m_ptr; }
+ T* get() 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; }
+ T* operator->() const { return m_ptr; }
bool operator!() const { return !m_ptr; }
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(T* ptr, bool) : m_ptr(ptr) {}
+ mutable T* m_ptr;
};
template <typename T> template <typename U> inline PassRefPtr<T>& PassRefPtr<T>::operator=(const RefPtr<U>& o)
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;
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;
return a != b.get();
}
- template <typename T> inline PassRefPtr<T> adoptRef(T *p)
+ template <typename T> inline PassRefPtr<T> adoptRef(T* p)
{
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)
};
template <typename T> template <typename U> inline RefPtr<T>::RefPtr(const PassRefPtr<U>& o)
- : m_ptr(o.release())
+ : m_ptr(o.releaseRef())
{
}
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;
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;
+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.
.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
__ZN7WebCore11FrameLoader19requestFromDelegateEP12NSURLRequestRP11objc_objectRP7NSError
__ZN7WebCore11FrameLoader21addPlugInStreamLoaderEPNS_17WebResourceLoaderE
__ZN7WebCore11FrameLoader21commitProvisionalLoadEP12NSDictionary
-__ZN7WebCore11FrameLoader22defersCallbacksChangedEv
__ZN7WebCore11FrameLoader23addExtraFieldsToRequestEP19NSMutableURLRequestbb
__ZN7WebCore11FrameLoader23reloadAllowingStaleDataERKNS_6StringE
__ZN7WebCore11FrameLoader23timeOfLastCompletedLoadEv
__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
__ZN7WebCore21isBackForwardLoadTypeENS_13FrameLoadTypeE
__ZN7WebCore26NetscapePlugInStreamLoader6createEPNS_5FrameEP11objc_object
__ZN7WebCore4KURLC1EP5NSURL
+__ZN7WebCore4Page16setDefersLoadingEb
__ZN7WebCore5Frame11setSettingsEPNS_8SettingsE
__ZN7WebCore5Frame12canCachePageEv
__ZN7WebCore5Frame12ownerElementEv
__ZNK7WebCore10StringImplcvP8NSStringEv
__ZNK7WebCore10StringImplcvP8NSStringEv
__ZNK7WebCore11FrameLoader14documentLoaderEv
-__ZNK7WebCore11FrameLoader15defersCallbacksEv
__ZNK7WebCore11FrameLoader15firstLayoutDoneEv
__ZNK7WebCore11FrameLoader20activeDocumentLoaderEv
__ZNK7WebCore11FrameLoader21isQuickRedirectComingEv
__ZNK7WebCore14DocumentLoader9isLoadingEv
__ZNK7WebCore17WebResourceLoader11frameLoaderEv
__ZNK7WebCore26NetscapePlugInStreamLoader6isDoneEv
+__ZNK7WebCore4Page14frameNamespaceEv
__ZNK7WebCore4Page19dragCaretControllerEv
+__ZNK7WebCore5Frame10isFrameSetEv
__ZNK7WebCore5Frame13selectionRectEv
__ZNK7WebCore5Frame15containsPluginsEv
__ZNK7WebCore5Frame15revealSelectionERKNS_11RenderLayer15ScrollAlignmentE
_wkSignalCFReadStreamError
_wkSignalCFReadStreamHasBytes
_wkSupportsMultipartXMixedReplace
-
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 */,
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;
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 ||
-// -*- 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)
#define KJS_BINDING_H_
#include <kjs/lookup.h>
+#include <wtf/Noncopyable.h>
-#if __APPLE__
+#if PLATFORM(MAC)
#include <JavaScriptCore/runtime.h>
#endif
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
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*) { }
#import "BlockExceptions.h"
#import "FloatRect.h"
+#import "FrameLoader.h"
#import "FrameLoadRequest.h"
#import "FrameMac.h"
#import "FrameTree.h"
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;
~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);
#import "EventNames.h"
#import "FloatRect.h"
#import "FontData.h"
-#import "FormDataMac.h"
#import "FoundationExtras.h"
#import "FrameLoadRequest.h"
#import "FrameLoader.h"
#import "Logging.h"
#import "MouseEventWithHitTestResults.h"
#import "HitTestResult.h"
+#import "Page.h"
#import "PlatformKeyboardEvent.h"
#import "PlatformScrollBar.h"
#import "PlatformWheelEvent.h"
using namespace KJS::Bindings;
using KJS::JSLock;
-using KJS::PausedTimeouts;
-using KJS::SavedBuiltins;
-using KJS::SavedProperties;
namespace WebCore {
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)
{
#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;
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;
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)
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
// 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;
_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;
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
Page::Page(WebCorePageBridge* bridge)
: m_frameCount(0)
, m_dragCaretController(0, true)
+ , m_defersLoading(false)
, m_bridge(bridge)
-
{
init();
}
{
ASSERT(command);
[super init];
- m_command = command.release();
+ m_command = command.releaseRef();
return self;
}
+ (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;
- (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;
- (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;
- (NSView *)nextValidKeyViewOutsideWebFrameViews;
- (NSView *)previousKeyViewOutsideWebFrameViews;
-- (BOOL)defersLoading;
-- (void)setDefersLoading:(BOOL)loading;
- (void)saveDocumentState:(NSArray *)documentState;
- (NSArray *)documentState;
doc->updateRendering();
}
-static BOOL isCaseSensitiveEqual(NSString *a, NSString *b)
-{
- return [a caseInsensitiveCompare:b] == NSOrderedSame;
-}
-
static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue* jsValue)
{
NSAppleEventDescriptor* aeDesc = 0;
}
#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:
_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();
}
}
-- (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
m_frame->selectionController()->clear();
}
-- (BOOL)isFrameSet
-{
- return m_frame->isFrameSet();
-}
-
- (void)reapplyStylesForDeviceType:(WebCoreDeviceType)deviceType
{
m_frame->setMediaType(deviceType == WebCoreDeviceScreen ? "screen" : "print");
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)
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;
CSS_PROP_CLEAR,
CSS_PROP_COLOR,
CSS_PROP_CURSOR,
-#if __APPLE__
+#if PLATFORM(MAC)
CSS_PROP__WEBKIT_DASHBOARD_REGION,
#endif
CSS_PROP_DIRECTION,
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();
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
CSSPrimitiveValue::CSSPrimitiveValue(PassRefPtr<Pair> p)
{
- m_value.pair = p.release();
+ m_value.pair = p.releaseRef();
m_type = CSS_PAIR;
}
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();
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(";
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
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;
}
RectImpl* rect;
unsigned rgbcolor;
Pair* pair;
-#if __APPLE__
+#if PLATFORM(MAC)
DashboardRegion* region;
#endif
} m_value;
void CSSValueList::append(PassRefPtr<CSSValue> val)
{
- m_values.append(val.release());
+ m_values.append(val.releaseRef());
}
String CSSValueList::cssText() const
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);
return false;
}
-#if __APPLE__
+#if PLATFORM(MAC)
+
#define DASHBOARD_REGION_NUM_PARAMETERS 6
#define DASHBOARD_REGION_SHORT_NUM_PARAMETERS 2
void addBackgroundValue(CSSValue*& lval, CSSValue* rval);
-#if __APPLE__
+#if PLATFORM(MAC)
bool parseDashboardRegions(int propId, bool important);
#endif
}
style->setTextSecurity(textSecurity);
}
-#if __APPLE__
+#if PLATFORM(MAC)
case CSS_PROP__WEBKIT_DASHBOARD_REGION: {
HANDLE_INHERIT_AND_INITIAL(dashboardRegions, DashboardRegions)
if (!primitiveValue)
#ifdef SVG_SUPPORT
, m_svgExtensions(0)
#endif
-#if __APPLE__
+#if PLATFORM(MAC)
, m_hasDashboardRegions(false)
, m_dashboardRegionsDirty(false)
#endif
}
}
-#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
}
view()->layout();
}
-#if __APPLE__
+#if PLATFORM(MAC)
if (renderer() && AXObjectCache::accessibilityEnabled())
axObjectCache()->postNotificationToElement(renderer(), "AXLoadComplete");
#endif
frame()->didEndEditing();
}
-#if __APPLE__
+#if PLATFORM(MAC)
const Vector<DashboardRegionValue>& Document::dashboardRegions() const
{
return m_dashboardRegions;
}
}
-#if __APPLE__
+#if PLATFORM(MAC)
if (!focusChangeBlocked && m_focusNode && AXObjectCache::accessibilityEnabled())
axObjectCache()->handleFocusedUIElementChanged();
#endif
class XPathResult;
#endif
-#if __APPLE__
struct DashboardRegionValue;
-#endif
#ifdef SVG_SUPPORT
class SVGDocumentExtensions;
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; }
SVGDocumentExtensions* m_svgExtensions;
#endif
-#if __APPLE__
+#if PLATFORM(MAC)
Vector<DashboardRegionValue> m_dashboardRegions;
bool m_hasDashboardRegions;
bool m_dashboardRegionsDirty;
#define replace_selection_command_h__
#include "CompositeEditCommand.h"
-#include <wtf/HashMap.h>
-#include <wtf/Vector.h>
namespace WebCore {
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().
#import <WebCore/PlatformString.h>
#import <wtf/Forward.h>
#import <wtf/HashSet.h>
+#import <wtf/HashMap.h>
#import <wtf/Noncopyable.h>
#import <wtf/RefPtr.h>
#import <objc/objc.h>
#ifdef __OBJC__
+
@class WebCoreFrameBridge;
-@class WebCoreFrameLoaderAsDelegate;
-@class WebPolicyDecider;
+@class WebCorePageState;
@class NSArray;
@class NSDate;
#else
class WebCoreFrameBridge;
-class WebCoreFrameLoaderAsDelegate;
-class WebPolicyDecider;
+class WebCorePageState;
class NSArray;
class NSDate;
class NSData;
class NSMutableURLRequest;
class NSURLAuthenticationChallenge;
+
#endif // __OBJC__
#endif // PLATFORM(MAC)
class Element;
class FormState;
class Frame;
+ class FrameLoadRequest;
class FrameLoaderClient;
class MainResourceLoader;
class String;
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*);
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);
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;
FrameState state() const;
static double timeOfLastCompletedLoad();
- bool defersCallbacks() const;
- void defersCallbacksChanged();
id identifierForInitialRequest(NSURLRequest *);
NSURLRequest *willSendRequest(WebResourceLoader*, NSMutableURLRequest *, NSURLResponse *redirectResponse);
void didReceiveAuthenticationChallenge(WebResourceLoader*, NSURLAuthenticationChallenge *);
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);
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();
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:
bool startLoadingMainResource(NSMutableURLRequest *, id identifier);
void stopLoadingSubframes();
- void setDefersCallbacks(bool);
void clearProvisionalLoad();
void markLoadComplete();
void commitProvisionalLoad();
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();
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;
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;
#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 {
FrameLoader::~FrameLoader()
{
- [m_asDelegate.get() detachFromLoader];
if (m_client)
m_client->detachFrameLoader();
}
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);
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;
}
&& !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.
// 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;
[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();
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)
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);
m_isStoppingLoad = true;
- invalidatePendingPolicyDecision(true);
+ stopPolicyCheck();
stopLoadingSubframes();
if (m_provisionalDocumentLoader)
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
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);
}
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();
&& [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)
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())
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();
}
m_client->download(connection, request, response, proxy);
}
-WebCoreFrameBridge *FrameLoader::bridge() const
-{
- return Mac(m_frame)->bridge();
-}
-
void FrameLoader::handleFallbackContent()
{
m_frame->handleFallbackContent();
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)
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) {
// 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;
}
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
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()
return m_quickRedirectComing;
}
+void FrameLoader::closeDocument()
+{
+ m_client->willCloseDocument();
+ m_frame->closeURL();
+}
+
void FrameLoader::transitionToCommitted(NSDictionary *pageCache)
{
ASSERT(m_client->hasWebView());
// 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;
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;
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
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());
{
RefPtr<Frame> protect(m_frame);
- [bridge() closeURL];
+ closeDocument();
stopLoading();
m_client->detachedFromParent1();
detachChildren();
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)
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
+}
#include "StringHash.h"
#include <wtf/HashMap.h>
-@class NSDictionary;
-@class WebCoreFrameBridge;
-
namespace WebCore {
class Element;
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;
#import "config.h"
#import "WebFormState.h"
-#import "DOMElementInternal.h"
#import "Element.h"
-#import "FrameMac.h"
-#import "WebCoreFrameBridge.h"
+#import "Frame.h"
namespace WebCore {
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)
{
}
-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;
-}
-
}
#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;
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;
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;
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;
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;
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();
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(); }
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;
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;
#import "FrameLoader.h"
#import "FrameMac.h"
+#import "Page.h"
#import "WebCoreFrameBridge.h"
#import "WebCoreSystemInterface.h"
#import "WebDataProtocol.h"
, m_calledDidFinishLoad(false)
, m_frame(frame)
, m_currentConnectionChallenge(nil)
- , m_defersCallbacks(frameLoader()->defersCallbacks())
+ , m_defersLoading(frame->page()->defersLoading())
{
static bool initialized = false;
if (!initialized) {
#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)
#import "WebLoader.h"
#import <wtf/Forward.h>
-@class WebCoreMainResourceLoaderAsPolicyDelegate;
-
namespace WebCore {
+ class FormState;
+
class MainResourceLoader : public WebResourceLoader {
public:
static PassRefPtr<MainResourceLoader> create(Frame*);
virtual bool load(NSURLRequest *);
- virtual void setDefersCallbacks(bool);
+ virtual void setDefersLoading(bool);
virtual void addData(NSData *, bool allAtOnce);
virtual void didFinishLoading();
virtual void didFail(NSError *);
- void continueAfterNavigationPolicy(NSURLRequest *);
- void continueAfterContentPolicy(PolicyAction);
-
private:
virtual void didCancel(NSError *);
virtual void releaseDelegate();
- WebCoreMainResourceLoaderAsPolicyDelegate *policyDelegate();
- void releasePolicyDelegate();
-
NSURLRequest *loadNow(NSURLRequest *);
void receivedError(NSError *);
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
RetainPtr<NSURLResponse> m_response;
RetainPtr<id> m_proxy;
RetainPtr<NSURLRequest> m_initialRequest;
- RetainPtr<WebCoreMainResourceLoaderAsPolicyDelegate> m_policyDelegate;
bool m_loadingMultipartContent;
+
+ bool m_waitingForContentPolicy;
};
}
using namespace WebCore;
-@interface WebCoreMainResourceLoaderAsPolicyDelegate : NSObject
-{
- MainResourceLoader* m_loader;
-}
-- (id)initWithLoader:(MainResourceLoader *)loader;
-- (void)detachLoader;
-@end
-
namespace WebCore {
const size_t URLBufferLength = 2048;
, m_bytesReceived(0)
, m_proxy(wkCreateNSURLConnectionDelegateProxy())
, m_loadingMultipartContent(false)
+ , m_waitingForContentPolicy(false)
{
[m_proxy.get() setDelegate:delegate()];
[m_proxy.get() release];
void MainResourceLoader::releaseDelegate()
{
- releasePolicyDelegate();
[m_proxy.get() setDelegate:nil];
WebResourceLoader::releaseDelegate();
}
// 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);
}
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)
// 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;
}
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]);
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.
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.
void MainResourceLoader::didFail(NSError *error)
{
- ASSERT(!defersCallbacks());
- ASSERT(!frameLoader()->defersCallbacks());
+ ASSERT(!defersLoading());
receivedError(error);
}
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
NSURL *URL = [r URL];
bool shouldLoadEmpty = shouldLoadAsEmptyDocument(URL);
- if (shouldLoadEmptyBeforeRedirect && !shouldLoadEmpty && defersCallbacks())
+ if (shouldLoadEmptyBeforeRedirect && !shouldLoadEmpty && defersLoading())
return r;
if (shouldLoadEmpty || frameLoader()->representationExistsForURLScheme([URL scheme])) {
{
ASSERT(!connection());
- bool defer = defersCallbacks();
+ bool defer = defersLoading();
if (defer) {
bool shouldLoadEmpty = shouldLoadAsEmptyDocument([r URL]);
if (shouldLoadEmpty)
r = loadNow(r);
if (r) {
// Started as an empty document, but was redirected to something non-empty.
- ASSERT(defersCallbacks());
+ ASSERT(defersLoading());
defer = true;
}
}
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) {
}
}
-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
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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
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();
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();
d->layoutCount++;
-#if __APPLE__
+#if PLATFORM(MAC)
if (AXObjectCache::accessibilityEnabled())
root->document()->axObjectCache()->postNotificationToElement(root, "AXLayoutComplete");
updateDashboardRegions();
void setResizingFrameSet(HTMLFrameSetElement *);
-#if __APPLE__
+#if PLATFORM(MAC)
void updateDashboardRegions();
#endif
#include "Page.h"
#include "Frame.h"
+#include "FrameLoader.h"
#include "FrameTree.h"
#include "StringHash.h"
#include "Widget.h"
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);
+}
+
}
bool canRunModalNow();
void runModal();
+ void setDefersLoading(bool);
+ bool defersLoading() const { return m_defersLoading; }
+
#if PLATFORM(MAC)
Page(WebCorePageBridge*);
WebCorePageBridge* bridge() const { return m_bridge; }
int m_frameCount;
String m_groupName;
mutable SelectionController m_dragCaretController;
+ bool m_defersLoading;
#if PLATFORM(MAC)
WebCorePageBridge* m_bridge;
#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__
#include "DeprecatedString.h"
#include "DeprecatedValueList.h"
-#ifdef __APPLE__
#ifdef __OBJC__
@class NSArray;
-#else
-class NSArray;
-#endif
#endif
namespace WebCore {
DeprecatedString pop_front();
-#ifdef __APPLE__
+#ifdef __OBJC__
NSArray *getNSArray() const;
#endif
};
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;
#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)
bool altKey() const { return m_altKey; }
bool metaKey() const { return m_metaKey; }
-#ifdef __APPLE__
+#if PLATFORM(MAC)
PlatformKeyboardEvent(NSEvent*, bool forceAutoRepeat = false);
#endif
#include "IntPoint.h"
#include <wtf/Platform.h>
-#if __APPLE__
+#if PLATFORM(MAC)
#ifdef __OBJC__
@class NSEvent;
#else
bool altKey() const { return m_altKey; }
bool metaKey() const { return m_metaKey; }
-#if __APPLE__
+#if PLATFORM(MAC)
PlatformMouseEvent(NSEvent*);
#endif
#if PLATFORM(WIN)
#include "IntPoint.h"
-#ifdef __APPLE__
+#ifdef PLATFORM(MAC)
#ifdef __OBJC__
@class NSEvent;
#else
void accept() { m_isAccepted = true; }
void ignore() { m_isAccepted = false; }
-#ifdef __APPLE__
+#ifdef PLATFORM(MAC)
PlatformWheelEvent(NSEvent*);
#endif
#if PLATFORM(WIN)
/*
- * 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
#ifndef ClipboardMac_h
#define ClipboardMac_h
-#include "Image.h"
#include "IntPoint.h"
#include "Clipboard.h"
#include "ClipboardAccessPolicy.h"
#else
class NSImage;
class NSPasteboard;
-typedef unsigned int NSDragOperation;
+typedef unsigned NSDragOperation;
#endif
namespace WebCore {
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 String& type);
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&);
+ Node* dragImageElement();
+ 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;
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
};
}
#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];
}
m_policy = policy;
}
-static NSString *cocoaTypeFromMIMEType(const String &type)
+static NSString *cocoaTypeFromMIMEType(const String& type)
{
String qType = type.stripWhiteSpace();
}
// 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);
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 String& type)
{
- 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);
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;
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.
}
}
-NSImage *ClipboardMac::dragNSImage(NSPoint *loc)
+NSImage *ClipboardMac::dragNSImage(NSPoint& loc)
{
NSImage *result = nil;
if (m_dragImageElement) {
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;
}
}
// 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(NSDragOperation& op) 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(NSDragOperation& op) 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)
// 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())
#include "RenderText.h"
-#if __APPLE__
+#if PLATFORM(MAC)
#include <CoreServices/CoreServices.h>
#endif
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;
// 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
+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.
- (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;
- (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];
- (void)webView: (WebView *)wv decidePolicyForNewWindowAction:(NSDictionary *)actionInformation
request:(NSURLRequest *)request
newFrameName:(NSString *)frameName
- decisionListener:(WebPolicyDecisionListener *)listener
+ decisionListener:(id <WebPolicyDecisionListener>)listener
{
[listener use];
}
#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
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);
free(portState);
}
- if (!defers)
- [[self webView] setDefersCallbacks:NO];
+ if (!wasDeferring)
+ page->setDefersLoading(false);
return acceptedEvent;
}
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;
return previousKeyView;
}
-- (BOOL)defersLoading
-{
- return [[self webView] defersCallbacks];
-}
-
-- (void)setDefersLoading:(BOOL)defers
-{
- [[self webView] setDefersCallbacks:defers];
-}
-
- (void)setNeedsReapplyStyles
{
NSView <WebDocumentView> *view = [[_frame frameView] documentView];
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];
* 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;
WebFrameLoaderClient(WebFrame*);
WebFrame* webFrame() const { return m_webFrame.get(); }
+ void receivedPolicyDecison(WebCore::PolicyAction);
+
private:
virtual void detachFrameLoader();
virtual void resetAfterLoadError(WebCore::LoadErrorResetToken*);
virtual void doNotResetAfterLoadError(WebCore::LoadErrorResetToken*);
+ virtual void willCloseDocument();
+
virtual void detachedFromParent1();
virtual void detachedFromParent2();
virtual void detachedFromParent3();
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*);
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;
virtual NSDictionary *elementForEvent(NSEvent *) const;
- virtual WebPolicyDecider *createPolicyDecider(id object, SEL selector);
-
virtual void frameLoadCompleted();
virtual void restoreScrollPositionAndViewState();
virtual void provisionalLoadStarted();
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;
};
#import "WebDocumentInternal.h"
#import "WebDocumentLoaderMac.h"
#import "WebDownloadInternal.h"
+#import "WebFormDelegate.h"
#import "WebFrameInternal.h"
#import "WebFrameLoadDelegate.h"
#import "WebFrameViewInternal.h"
#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"
#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)
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)
{
}
[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];
[[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)
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();
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.
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.
{
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);
{
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;
[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
#import "WebView.h"
#import "WebViewInternal.h"
#import <JavaScriptCore/Assertions.h>
+#import <WebCore/Page.h>
#import <WebCore/WebCoreFrameNamespaces.h>
#import <WebCore/WebLoader.h>
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
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 */,
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).
/*
- * 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;
/*!
@protocol WebFormSubmissionListener
- @discussion .
*/
@protocol WebFormSubmissionListener <NSObject>
- (void)continue;
/*!
@protocol WebFormDelegate
- @discussion .
*/
@protocol WebFormDelegate <NSObject>
// 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
/*!
to implement some of the above methods and ignore others.
*/
@interface WebFormDelegate : NSObject <WebFormDelegate>
-{
-}
@end
-
/*
- * 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
#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
// 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
{
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];
}
#import "WebNullPluginView.h"
#import "WebPlugin.h"
#import "WebPluginController.h"
-#import "WebPolicyDeciderMac.h"
#import "WebPolicyDelegatePrivate.h"
#import "WebPreferencesPrivate.h"
#import "WebScriptDebugDelegatePrivate.h"
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
[_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);
- (BOOL)_isFrameSet
{
- return [_private->bridge isFrameSet];
+ return core(self)->isFrameSet();
}
- (BOOL)_firstLayoutDone
#endif
- (void)_addPlugInView:(NSView *)plugInView;
-- (void)_removeAllPlugInViews;
-
-// This should be called when leaving a page or closing the WebView
-- (void)_willCloseURL;
- (BOOL)_isMainFrame;
#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>
// 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;
}
// 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;
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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
-
-
-
-
#import "WebPolicyDelegatePrivate.h"
-#import <WebCore/FrameLoader.h>
+#import <WebCore/FrameLoaderTypes.h>
#import <objc/objc-runtime.h>
using namespace WebCore;
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];
@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;
}
[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
*/
#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
NSString *userAgent;
BOOL userAgentOverridden;
- BOOL defersCallbacks;
-
WebPreferences *preferences;
WebCoreSettings *settings;
[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];
- (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;
}
return _private->backgroundColor;
}
+- (BOOL)defersCallbacks
+{
+ return [_private->_pageBridge impl]->defersLoading();
+}
+
+- (void)setDefersCallbacks:(BOOL)defer
+{
+ return [_private->_pageBridge impl]->setDefersLoading(defer);
+}
+
@end
@implementation _WebSafeForwarder
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;
@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 *);
*/
+ (NSString *)suggestedFileExtensionForMIMEType: (NSString *)MIMEType;
-
// May well become public
- (void)_setFormDelegate:(id<WebFormDelegate>)delegate;
- (id<WebFormDelegate>)_formDelegate;
*/
- (void)_detachScriptDebuggerFromAllFrames;
+- (BOOL)defersCallbacks; // called by QuickTime plug-in
+- (void)setDefersCallbacks:(BOOL)defer; // called by QuickTime plug-in
+
@end
@interface WebView (WebViewPrintingPrivate)