diff options
Diffstat (limited to 'WebKit/mac')
17 files changed, 225 insertions, 28 deletions
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog index c59d8b4..eaed21b 100644 --- a/WebKit/mac/ChangeLog +++ b/WebKit/mac/ChangeLog @@ -1,3 +1,145 @@ +2010-07-09 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=13075 + XMLHttpRequest with failed authentication should set status to 401 + + https://bugs.webkit.org/show_bug.cgi?id=6871 + <rdar://problem/3363403> 401 error page is never shown + + * Panels/WebPanelAuthenticationHandler.m: + (-[WebPanelAuthenticationHandler startAuthentication:window:]): Updated a comment - this + code cancels loading, not authentication (canceling authentication means telling to + continue without credentials). + (-[WebPanelAuthenticationHandler _authenticationDoneWithChallenge:result:]): If there were + no credentials provided, tell to continue without any. There may be alternative content + returned with 401. + +2010-07-09 Leon Clarke <leonclarke@google.com> + + Reviewed by Adam Barth. + + add support for link prefetching + https://bugs.webkit.org/show_bug.cgi?id=3652 + + * Configurations/FeatureDefines.xcconfig: + +2010-07-08 Aaron Boodman <aa@chromium.org> + + Reviewed by Timothy Hatcher. + + Add the ability for user scripts and user styles to affect just the top frame. + + https://bugs.webkit.org/show_bug.cgi?id=41529 + + * WebView/WebView.mm: + (+[WebView _addUserScriptToGroup:world:source:url:whitelist:blacklist:injectionTime:]): + (+[WebView _addUserScriptToGroup:world:source:url:whitelist:blacklist:injectionTime:injectedFrames:]): + (+[WebView _addUserStyleSheetToGroup:world:source:url:whitelist:blacklist:]): + (+[WebView _addUserStyleSheetToGroup:world:source:url:whitelist:blacklist:injectedFrames:]): + * WebView/WebViewPrivate.h: + +2010-07-08 Adele Peterson <adele@apple.com> + + Reviewed by Jon Honeycutt, Adam Roben, and Darin Adler. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=41721 + <rdar://problem/8158561> Missing plug-in indicator should have a pressed state + + Implement shouldMissingPluginMessageBeButton. + + * WebCoreSupport/WebChromeClient.h: + * WebCoreSupport/WebChromeClient.mm: + (WebChromeClient::shouldMissingPluginMessageBeButton): + +2010-07-08 Brady Eidson <beidson@apple.com> + + Reviewed by Tim Hatcher. + + <rdar://problem/8136327> - Crash in Entourage calling WebCache method from background thread + + * Misc/WebCache.mm: + (+[WebCache setDisabled:]): Forward the call to the main thread if called from a background thread. + + * Misc/WebNSObjectExtras.h: + * Misc/WebNSObjectExtras.mm: + (+[NSObject _webkit_invokeOnMainThread]): Add a class version of the main thread invoker. + +2010-07-08 Mike Thole <mthole@apple.com> + + Reviewed by Darin Adler. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=41896 + Crash under allScriptsInPDFDocument() in WebPDFDocumentExtras.mm for certain PDFs + + * WebView/WebPDFDocumentExtras.mm: + (allScriptsInPDFDocument): Null-check 'data', as CGPDFStreamCopyData() may have returned 0. + +2010-07-08 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=41826 + Convert BackForwardList to an abstract base class and add BackForwardListImpl + as the concrete implementation of it. + + * History/WebBackForwardList.mm: + (-[WebBackForwardList init]): + (-[WebBackForwardList setPageCacheSize:]): + (-[WebBackForwardList pageCacheSize]): + +2010-07-07 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=41772 + Add basic piping for BackForwardControllerClient. + + * WebView/WebView.mm: + (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]): + +2010-07-07 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Change requestURL to a KURL. + https://bugs.webkit.org/show_bug.cgi?id=41775 + + * Plugins/WebNetscapePluginStream.h: + (WebNetscapePluginStream::setRequestURL): + * Plugins/WebNetscapePluginStream.mm: + (WebNetscapePluginStream::pluginCancelledConnectionError): + (WebNetscapePluginStream::errorForReason): + (WebNetscapePluginStream::startStream): + (WebNetscapePluginStream::didReceiveResponse): + (WebNetscapePluginStream::destroyStream): + +2010-07-07 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Rename the WebBaseNetscapePluginStream.cpp and .h files to WebNetscapePluginStream.cpp and .h to match the class name. + + * Plugins/WebNetscapePluginStream.h: Renamed from WebKit/mac/Plugins/WebBaseNetscapePluginStream.h. + * Plugins/WebNetscapePluginStream.mm: Renamed from WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm. + +2010-07-06 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Simon Fraser. + + Expose URL matching from WebUserContentURLPattern + https://bugs.webkit.org/show_bug.cgi?id=41726 + <rdar://problem/7910144> + + We previously had a way to construct WebUserContentURLPattern + instances via WebKit, but no way for callers to perform matching. + This patch adds the matchesURL functionality to allow for this. + + * Misc/WebUserContentURLPattern.h: Added matchesURL. + * Misc/WebUserContentURLPattern.mm: + (-[WebUserContentURLPattern matchesURL:]): Added. Calls through to WebCore::UserContentURLPattern::matches. + 2010-06-23 Philippe Normand <pnormand@igalia.com> Reviewed by Eric Carlson. diff --git a/WebKit/mac/Configurations/FeatureDefines.xcconfig b/WebKit/mac/Configurations/FeatureDefines.xcconfig index 8d2ff72..9a3ec0b 100644 --- a/WebKit/mac/Configurations/FeatureDefines.xcconfig +++ b/WebKit/mac/Configurations/FeatureDefines.xcconfig @@ -31,6 +31,8 @@ // Set any ENABLE_FEATURE_NAME macro to an empty string to disable that feature. +ENABLE_LINK_PREFETCH = ; + ENABLE_3D_CANVAS = $(ENABLE_3D_CANVAS_$(TARGET_MAC_OS_X_VERSION_MAJOR)); ENABLE_3D_CANVAS_1050 = ENABLE_3D_CANVAS; ENABLE_3D_CANVAS_1060 = ENABLE_3D_CANVAS; @@ -84,4 +86,4 @@ ENABLE_XHTMLMP = ; ENABLE_XPATH = ENABLE_XPATH; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_LINK_PREFETCH) $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT); diff --git a/WebKit/mac/History/WebBackForwardList.mm b/WebKit/mac/History/WebBackForwardList.mm index 6d9e998..617ee0e 100644 --- a/WebKit/mac/History/WebBackForwardList.mm +++ b/WebKit/mac/History/WebBackForwardList.mm @@ -38,7 +38,7 @@ #import "WebPreferencesPrivate.h" #import "WebTypesInternal.h" #import "WebViewPrivate.h" -#import <WebCore/BackForwardList.h> +#import <WebCore/BackForwardListImpl.h> #import <WebCore/HistoryItem.h> #import <WebCore/Page.h> #import <WebCore/PageCache.h> @@ -109,7 +109,7 @@ WebBackForwardList *kit(BackForwardList* backForwardList) - (id)init { - return [self initWithBackForwardList:BackForwardList::create(0)]; + return [self initWithBackForwardList:BackForwardListImpl::create(0)]; } - (void)dealloc @@ -293,12 +293,14 @@ static bool bumperCarBackForwardHackNeeded() - (void)setPageCacheSize:(NSUInteger)size { - [kit(core(self)->page()) setUsesPageCache:size != 0]; + ASSERT(core(self)->isBackForwardListImpl()); + [kit(static_cast<BackForwardListImpl*>(core(self))->page()) setUsesPageCache:size != 0]; } - (NSUInteger)pageCacheSize { - return [kit(core(self)->page()) usesPageCache] ? pageCache()->capacity() : 0; + ASSERT(core(self)->isBackForwardListImpl()); + return [kit(static_cast<BackForwardListImpl*>(core(self))->page()) usesPageCache] ? pageCache()->capacity() : 0; } - (int)backListCount diff --git a/WebKit/mac/Misc/WebCache.mm b/WebKit/mac/Misc/WebCache.mm index b29f720..747d213 100644 --- a/WebKit/mac/Misc/WebCache.mm +++ b/WebKit/mac/Misc/WebCache.mm @@ -25,6 +25,7 @@ #import "WebCache.h" +#import "WebNSObjectExtras.h" #import "WebPreferences.h" #import "WebSystemInterface.h" #import "WebView.h" @@ -126,6 +127,9 @@ + (void)setDisabled:(BOOL)disabled { + if (!pthread_main_np()) + return [[self _webkit_invokeOnMainThread] setDisabled:disabled]; + WebCore::cache()->setDisabled(disabled); } diff --git a/WebKit/mac/Misc/WebNSObjectExtras.h b/WebKit/mac/Misc/WebNSObjectExtras.h index f327966..0114bcc 100644 --- a/WebKit/mac/Misc/WebNSObjectExtras.h +++ b/WebKit/mac/Misc/WebNSObjectExtras.h @@ -54,5 +54,6 @@ static inline IMP method_setImplementation(Method m, IMP i) #endif @interface NSObject (WebNSObjectExtras) ++ (id)_webkit_invokeOnMainThread; - (id)_webkit_invokeOnMainThread; @end diff --git a/WebKit/mac/Misc/WebNSObjectExtras.mm b/WebKit/mac/Misc/WebNSObjectExtras.mm index 3beb641..d00726b 100644 --- a/WebKit/mac/Misc/WebNSObjectExtras.mm +++ b/WebKit/mac/Misc/WebNSObjectExtras.mm @@ -105,6 +105,11 @@ static bool returnTypeIsObject(NSInvocation *invocation) @implementation NSObject (WebNSObjectExtras) ++ (id)_webkit_invokeOnMainThread +{ + return [[[WebMainThreadInvoker alloc] initWithTarget:self] autorelease]; +} + - (id)_webkit_invokeOnMainThread { return [[[WebMainThreadInvoker alloc] initWithTarget:self] autorelease]; diff --git a/WebKit/mac/Misc/WebUserContentURLPattern.h b/WebKit/mac/Misc/WebUserContentURLPattern.h index 6ec4bcf..e7ccac4 100644 --- a/WebKit/mac/Misc/WebUserContentURLPattern.h +++ b/WebKit/mac/Misc/WebUserContentURLPattern.h @@ -34,5 +34,6 @@ - (NSString *)scheme; - (NSString *)host; - (BOOL)matchesSubdomains; +- (BOOL)matchesURL:(NSURL *)url; @end diff --git a/WebKit/mac/Misc/WebUserContentURLPattern.mm b/WebKit/mac/Misc/WebUserContentURLPattern.mm index 5d9f49e..883f2e6 100644 --- a/WebKit/mac/Misc/WebUserContentURLPattern.mm +++ b/WebKit/mac/Misc/WebUserContentURLPattern.mm @@ -24,6 +24,7 @@ #import "WebUserContentURLPattern.h" +#import <WebCore/KURL.h> #import <WebCore/UserContentURLPattern.h> using namespace WebCore; @@ -80,4 +81,9 @@ using namespace WebCore; return _private->pattern.matchSubdomains(); } +- (BOOL)matchesURL:(NSURL *)url +{ + return _private->pattern.matches(url); +} + @end diff --git a/WebKit/mac/Panels/WebPanelAuthenticationHandler.m b/WebKit/mac/Panels/WebPanelAuthenticationHandler.m index c4c6e5b..694bba5 100644 --- a/WebKit/mac/Panels/WebPanelAuthenticationHandler.m +++ b/WebKit/mac/Panels/WebPanelAuthenticationHandler.m @@ -113,7 +113,7 @@ WebPanelAuthenticationHandler *sharedHandler; // In this case, we have an attached sheet that's not one of our // authentication panels, so enqueing is not an option. Just - // cancel authentication instead, since this case is fairly + // cancel loading instead, since this case is fairly // unlikely (how would you be loading a page if you had an error // sheet up?) if ([w attachedSheet] != nil) { @@ -152,7 +152,7 @@ WebPanelAuthenticationHandler *sharedHandler; } if (credential == nil) { - [[challenge sender] cancelAuthenticationChallenge:challenge]; + [[challenge sender] continueWithoutCredentialForAuthenticationChallenge:challenge]; } else { [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge]; } diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginStream.h b/WebKit/mac/Plugins/WebNetscapePluginStream.h index 8fbe262..8ee9e7f 100644 --- a/WebKit/mac/Plugins/WebBaseNetscapePluginStream.h +++ b/WebKit/mac/Plugins/WebNetscapePluginStream.h @@ -36,6 +36,7 @@ #import <wtf/RefCounted.h> #import <wtf/RefPtr.h> #import <wtf/RetainPtr.h> +#import <wtf/text/CString.h> #import "WebNetscapePluginView.h" @@ -71,7 +72,7 @@ public: void cancelLoadAndDestroyStreamWithError(NSError *); - void setRequestURL(NSURL *requestURL) { m_requestURL = requestURL; } + void setRequestURL(const WebCore::KURL& requestURL) { m_requestURL = requestURL; } void start(); void stop(); @@ -89,7 +90,7 @@ private: void deliverDataToFile(NSData *data); void deliverData(); - void startStream(NSURL *, long long expectedContentLength, NSDate *lastModifiedDate, NSString *mimeType, NSData *headers); + void startStream(NSURL *, long long expectedContentLength, NSDate *lastModifiedDate, const WebCore::String& mimeType, NSData *headers); NSError *pluginCancelledConnectionError() const; @@ -99,9 +100,9 @@ private: bool wantsAllStreams() const; RetainPtr<NSMutableData> m_deliveryData; - RetainPtr<NSURL> m_requestURL; + WebCore::KURL m_requestURL; RetainPtr<NSURL> m_responseURL; - RetainPtr<NSString> m_mimeType; + CString m_mimeType; NPP m_plugin; uint16_t m_transferMode; diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm b/WebKit/mac/Plugins/WebNetscapePluginStream.mm index 07d1d4f..5c1e8ee 100644 --- a/WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm +++ b/WebKit/mac/Plugins/WebNetscapePluginStream.mm @@ -27,7 +27,7 @@ */ #if ENABLE(NETSCAPE_PLUGIN_API) -#import "WebBaseNetscapePluginStream.h" +#import "WebNetscapePluginStream.h" #import "WebNetscapePluginView.h" #import "WebFrameInternal.h" @@ -102,10 +102,10 @@ NPReason WebNetscapePluginStream::reasonForError(NSError *error) NSError *WebNetscapePluginStream::pluginCancelledConnectionError() const { return [[[NSError alloc] _initWithPluginErrorCode:WebKitErrorPlugInCancelledConnection - contentURL:m_responseURL ? m_responseURL.get() : m_requestURL.get() + contentURL:m_responseURL ? m_responseURL.get() : (NSURL *)m_requestURL pluginPageURL:nil pluginName:[[m_pluginView.get() pluginPackage] pluginInfo].name - MIMEType:m_mimeType.get()] autorelease]; + MIMEType:(NSString *)String::fromUTF8(m_mimeType.data(), m_mimeType.length())] autorelease]; } NSError *WebNetscapePluginStream::errorForReason(NPReason reason) const @@ -116,7 +116,7 @@ NSError *WebNetscapePluginStream::errorForReason(NPReason reason) const if (reason == NPRES_USER_BREAK) return [NSError _webKitErrorWithDomain:NSURLErrorDomain code:NSURLErrorCancelled - URL:m_responseURL ? m_responseURL.get() : m_requestURL.get()]; + URL:m_responseURL ? m_responseURL.get() : (NSURL *)m_requestURL]; return pluginCancelledConnectionError(); } @@ -209,12 +209,12 @@ void WebNetscapePluginStream::setPlugin(NPP plugin) } } -void WebNetscapePluginStream::startStream(NSURL *url, long long expectedContentLength, NSDate *lastModifiedDate, NSString *mimeType, NSData *headers) +void WebNetscapePluginStream::startStream(NSURL *url, long long expectedContentLength, NSDate *lastModifiedDate, const String& mimeType, NSData *headers) { ASSERT(!m_isTerminated); m_responseURL = url; - m_mimeType = mimeType; + m_mimeType = mimeType.utf8(); free((void *)m_stream.url); m_stream.url = strdup([m_responseURL.get() _web_URLCString]); @@ -243,10 +243,10 @@ void WebNetscapePluginStream::startStream(NSURL *url, long long expectedContentL NPError npErr; { PluginStopDeferrer deferrer(m_pluginView.get()); - npErr = m_pluginFuncs->newstream(m_plugin, (char *)[m_mimeType.get() UTF8String], &m_stream, NO, &m_transferMode); + npErr = m_pluginFuncs->newstream(m_plugin, m_mimeType.mutableData(), &m_stream, NO, &m_transferMode); } - LOG(Plugins, "NPP_NewStream URL=%@ MIME=%@ error=%d", m_responseURL.get(), m_mimeType.get(), npErr); + LOG(Plugins, "NPP_NewStream URL=%@ MIME=%s error=%d", m_responseURL.get(), m_mimeType.data(), npErr); if (npErr != NPERR_NO_ERROR) { LOG_ERROR("NPP_NewStream failed with error: %d responseURL: %@", npErr, m_responseURL.get()); @@ -350,7 +350,7 @@ void WebNetscapePluginStream::didReceiveResponse(NetscapePlugInStreamLoader*, co // startStreamResponseURL:... will null-terminate. } - startStream([r URL], expectedContentLength, WKGetNSURLResponseLastModifiedDate(r), [r MIMEType], theHeaders); + startStream([r URL], expectedContentLength, WKGetNSURLResponseLastModifiedDate(r), response.mimeType(), theHeaders); } void WebNetscapePluginStream::startStreamWithResponse(NSURLResponse *response) @@ -440,8 +440,8 @@ void WebNetscapePluginStream::destroyStream() if (m_sendNotification) { // NPP_URLNotify expects the request URL, not the response URL. PluginStopDeferrer deferrer(m_pluginView.get()); - m_pluginFuncs->urlnotify(m_plugin, [m_requestURL.get() _web_URLCString], m_reason, m_notifyData); - LOG(Plugins, "NPP_URLNotify requestURL=%@ reason=%d", m_requestURL.get(), m_reason); + m_pluginFuncs->urlnotify(m_plugin, m_requestURL.string().utf8().data(), m_reason, m_notifyData); + LOG(Plugins, "NPP_URLNotify requestURL=%@ reason=%d", (NSURL *)m_requestURL, m_reason); } m_isTerminated = true; diff --git a/WebKit/mac/Plugins/WebNetscapePluginView.mm b/WebKit/mac/Plugins/WebNetscapePluginView.mm index f062f7c..10a3187 100644 --- a/WebKit/mac/Plugins/WebNetscapePluginView.mm +++ b/WebKit/mac/Plugins/WebNetscapePluginView.mm @@ -30,7 +30,6 @@ #import "WebNetscapePluginView.h" -#import "WebBaseNetscapePluginStream.h" #import "WebDataSourceInternal.h" #import "WebDefaultUIDelegate.h" #import "WebFrameInternal.h" @@ -49,6 +48,7 @@ #import "WebNetscapeContainerCheckPrivate.h" #import "WebNetscapePluginEventHandler.h" #import "WebNetscapePluginPackage.h" +#import "WebNetscapePluginStream.h" #import "WebPluginContainerCheck.h" #import "WebPluginRequest.h" #import "WebPreferences.h" diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.h b/WebKit/mac/WebCoreSupport/WebChromeClient.h index 5587a8d..ea59c4d 100644 --- a/WebKit/mac/WebCoreSupport/WebChromeClient.h +++ b/WebKit/mac/WebCoreSupport/WebChromeClient.h @@ -105,6 +105,7 @@ public: virtual void setStatusbarText(const WebCore::String&); virtual void scrollbarsModeDidChange() const { } + virtual bool shouldMissingPluginMessageBeButton() const; virtual void missingPluginButtonClicked(WebCore::Element*) const; virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags); diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/WebKit/mac/WebCoreSupport/WebChromeClient.mm index e426f05..3bf310a 100644 --- a/WebKit/mac/WebCoreSupport/WebChromeClient.mm +++ b/WebKit/mac/WebCoreSupport/WebChromeClient.mm @@ -516,6 +516,11 @@ void WebChromeClient::scrollRectIntoView(const IntRect& r, const ScrollView*) co // End host window methods. +bool WebChromeClient::shouldMissingPluginMessageBeButton() const +{ + return [[m_webView UIDelegate] respondsToSelector:@selector(webView:didPressMissingPluginButton:)]; +} + void WebChromeClient::missingPluginButtonClicked(Element* element) const { CallUIDelegate(m_webView, @selector(webView:didPressMissingPluginButton:), kit(element)); diff --git a/WebKit/mac/WebView/WebPDFDocumentExtras.mm b/WebKit/mac/WebView/WebPDFDocumentExtras.mm index b7043df..7651dba 100644 --- a/WebKit/mac/WebView/WebPDFDocumentExtras.mm +++ b/WebKit/mac/WebView/WebPDFDocumentExtras.mm @@ -112,6 +112,8 @@ NSArray *allScriptsInPDFDocument(PDFDocument *document) if (CGPDFDictionaryGetStream(javaScriptAction, "JS", &stream)) { CGPDFDataFormat format; data.adoptCF(CGPDFStreamCopyData(stream, &format)); + if (!data) + continue; bytes = CFDataGetBytePtr(data.get()); length = CFDataGetLength(data.get()); } else if (CGPDFDictionaryGetString(javaScriptAction, "JS", &string)) { diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm index ada00b5..6d61453 100644 --- a/WebKit/mac/WebView/WebView.mm +++ b/WebKit/mac/WebView/WebView.mm @@ -675,8 +675,7 @@ static bool shouldEnableLoadDeferring() #else WebGeolocationControllerClient* geolocationControllerClient = 0; #endif - DeviceOrientationClient* deviceOrientationClient = 0; - _private->page = new Page(new WebChromeClient(self), new WebContextMenuClient(self), new WebEditorClient(self), new WebDragClient(self), new WebInspectorClient(self), new WebPluginHalterClient(self), geolocationControllerClient, deviceOrientationClient); + _private->page = new Page(new WebChromeClient(self), new WebContextMenuClient(self), new WebEditorClient(self), new WebDragClient(self), new WebInspectorClient(self), new WebPluginHalterClient(self), geolocationControllerClient, 0, 0); _private->page->setCanStartMedia([self window]); _private->page->settings()->setLocalStorageDatabasePath([[self preferences] _localStorageDatabasePath]); @@ -2363,7 +2362,16 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) } + (void)_addUserScriptToGroup:(NSString *)groupName world:(WebScriptWorld *)world source:(NSString *)source url:(NSURL *)url - whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist injectionTime:(WebUserScriptInjectionTime)injectionTime + whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist + injectionTime:(WebUserScriptInjectionTime)injectionTime +{ + [WebView _addUserScriptToGroup:groupName world:world source:source url:url whitelist:whitelist blacklist:blacklist injectionTime:injectionTime injectedFrames:WebInjectInAllFrames]; +} + ++ (void)_addUserScriptToGroup:(NSString *)groupName world:(WebScriptWorld *)world source:(NSString *)source url:(NSURL *)url + whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist + injectionTime:(WebUserScriptInjectionTime)injectionTime + injectedFrames:(WebUserContentInjectedFrames)injectedFrames { String group(groupName); if (group.isEmpty()) @@ -2374,11 +2382,19 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) return; pageGroup->addUserScriptToWorld(core(world), source, url, toStringVector(whitelist), toStringVector(blacklist), - injectionTime == WebInjectAtDocumentStart ? InjectAtDocumentStart : InjectAtDocumentEnd); + injectionTime == WebInjectAtDocumentStart ? InjectAtDocumentStart : InjectAtDocumentEnd, + injectedFrames == WebInjectInAllFrames ? InjectInAllFrames : InjectInTopFrameOnly); +} + ++ (void)_addUserStyleSheetToGroup:(NSString *)groupName world:(WebScriptWorld *)world source:(NSString *)source url:(NSURL *)url + whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist +{ + [WebView _addUserStyleSheetToGroup:groupName world:world source:source url:url whitelist:whitelist blacklist:blacklist injectedFrames:WebInjectInAllFrames]; } + (void)_addUserStyleSheetToGroup:(NSString *)groupName world:(WebScriptWorld *)world source:(NSString *)source url:(NSURL *)url whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist + injectedFrames:(WebUserContentInjectedFrames)injectedFrames { String group(groupName); if (group.isEmpty()) @@ -2388,7 +2404,7 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) if (!pageGroup) return; - pageGroup->addUserStyleSheetToWorld(core(world), source, url, toStringVector(whitelist), toStringVector(blacklist)); + pageGroup->addUserStyleSheetToWorld(core(world), source, url, toStringVector(whitelist), toStringVector(blacklist), injectedFrames == WebInjectInAllFrames ? InjectInAllFrames : InjectInTopFrameOnly); } + (void)_removeUserScriptFromGroup:(NSString *)groupName world:(WebScriptWorld *)world url:(NSURL *)url diff --git a/WebKit/mac/WebView/WebViewPrivate.h b/WebKit/mac/WebView/WebViewPrivate.h index cedc62c..9d47a4d 100644 --- a/WebKit/mac/WebView/WebViewPrivate.h +++ b/WebKit/mac/WebView/WebViewPrivate.h @@ -88,6 +88,11 @@ typedef enum { WebInjectAtDocumentEnd, } WebUserScriptInjectionTime; +typedef enum { + WebInjectInAllFrames, + WebInjectInTopFrameOnly +} WebUserContentInjectedFrames; + @interface WebController : NSTreeController { IBOutlet WebView *webView; } @@ -504,8 +509,12 @@ Could be worth adding to the API. // Removes all white list entries created with _addOriginAccessWhitelistEntryWithSourceOrigin. + (void)_resetOriginAccessWhitelists; +// FIXME: The following two methods are deprecated in favor of the overloads below that take the WebUserContentInjectedFrames argument. https://bugs.webkit.org/show_bug.cgi?id=41800. + (void)_addUserScriptToGroup:(NSString *)groupName world:(WebScriptWorld *)world source:(NSString *)source url:(NSURL *)url whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist injectionTime:(WebUserScriptInjectionTime)injectionTime; + (void)_addUserStyleSheetToGroup:(NSString *)groupName world:(WebScriptWorld *)world source:(NSString *)source url:(NSURL *)url whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist; + ++ (void)_addUserScriptToGroup:(NSString *)groupName world:(WebScriptWorld *)world source:(NSString *)source url:(NSURL *)url whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist injectionTime:(WebUserScriptInjectionTime)injectionTime injectedFrames:(WebUserContentInjectedFrames)injectedFrames; ++ (void)_addUserStyleSheetToGroup:(NSString *)groupName world:(WebScriptWorld *)world source:(NSString *)source url:(NSURL *)url whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist injectedFrames:(WebUserContentInjectedFrames)injectedFrames; + (void)_removeUserScriptFromGroup:(NSString *)groupName world:(WebScriptWorld *)world url:(NSURL *)url; + (void)_removeUserStyleSheetFromGroup:(NSString *)groupName world:(WebScriptWorld *)world url:(NSURL *)url; + (void)_removeUserScriptsFromGroup:(NSString *)groupName world:(WebScriptWorld *)world; |