Title: [184441] trunk/Source/WebKit2
Revision
184441
Author
[email protected]
Date
2015-05-16 17:24:43 -0700 (Sat, 16 May 2015)

Log Message

[iOS] WKPDFView should not follow _javascript_: links
https://bugs.webkit.org/show_bug.cgi?id=145101

Reviewed by Dan Bernstein.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick): Returned early if url's protocol is _javascript_:.
(WebKit::WebPageProxy::navigateToURLWithSimulatedClick): Renamed to navigateToPDFLinkWithSimulatedClick to
reflect that this function is exclusively for following PDF links.
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKPDFView.mm:
(-[WKPDFView annotation:wasTouchedAtPoint:controller:]):
(-[WKPDFView actionSheetAssistant:openElementAtLocation:]):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::navigateToPDFLinkWithSimulatedClick): Renamed from navigateToURLWithSimulatedClick.
(WebKit::WebPage::navigateToURLWithSimulatedClick): Renamed to navigateToPDFLinkWithSimulatedClick.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (184440 => 184441)


--- trunk/Source/WebKit2/ChangeLog	2015-05-16 23:24:00 UTC (rev 184440)
+++ trunk/Source/WebKit2/ChangeLog	2015-05-17 00:24:43 UTC (rev 184441)
@@ -1,3 +1,24 @@
+2015-05-16  Andy Estes  <[email protected]>
+
+        [iOS] WKPDFView should not follow _javascript_: links
+        https://bugs.webkit.org/show_bug.cgi?id=145101
+
+        Reviewed by Dan Bernstein.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick): Returned early if url's protocol is _javascript_:.
+        (WebKit::WebPageProxy::navigateToURLWithSimulatedClick): Renamed to navigateToPDFLinkWithSimulatedClick to
+        reflect that this function is exclusively for following PDF links.
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/ios/WKPDFView.mm:
+        (-[WKPDFView annotation:wasTouchedAtPoint:controller:]):
+        (-[WKPDFView actionSheetAssistant:openElementAtLocation:]):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick): Renamed from navigateToURLWithSimulatedClick.
+        (WebKit::WebPage::navigateToURLWithSimulatedClick): Renamed to navigateToPDFLinkWithSimulatedClick.
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+
 2015-05-16  Brent Fulgham  <[email protected]>
 
         [iOS] Remote scrolling tree needs to coordinate scroll snap state during resize/rotations

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (184440 => 184441)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2015-05-16 23:24:00 UTC (rev 184440)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2015-05-17 00:24:43 UTC (rev 184441)
@@ -110,6 +110,7 @@
 #include <WebCore/SerializedCryptoKeyWrap.h>
 #include <WebCore/TextCheckerClient.h>
 #include <WebCore/TextIndicator.h>
+#include <WebCore/URL.h>
 #include <WebCore/WindowFeatures.h>
 #include <stdio.h>
 #include <wtf/NeverDestroyed.h>
@@ -987,15 +988,18 @@
     m_process->responsivenessTimer()->start();
 }
 
-void WebPageProxy::navigateToURLWithSimulatedClick(const String& url, IntPoint documentPoint, IntPoint screenPoint)
+void WebPageProxy::navigateToPDFLinkWithSimulatedClick(const String& url, IntPoint documentPoint, IntPoint screenPoint)
 {
     if (m_isClosed)
         return;
 
+    if (WebCore::protocolIsJavaScript(url))
+        return;
+
     if (!isValid())
         reattachToWebProcess();
 
-    m_process->send(Messages::WebPage::NavigateToURLWithSimulatedClick(url, documentPoint, screenPoint), m_pageID);
+    m_process->send(Messages::WebPage::NavigateToPDFLinkWithSimulatedClick(url, documentPoint, screenPoint), m_pageID);
     m_process->responsivenessTimer()->start();
 }
 

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (184440 => 184441)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2015-05-16 23:24:00 UTC (rev 184440)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2015-05-17 00:24:43 UTC (rev 184441)
@@ -358,7 +358,7 @@
     void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL, API::Object* userData = nullptr);
     void loadPlainTextString(const String&, API::Object* userData = nullptr);
     void loadWebArchiveData(API::Data*, API::Object* userData = nullptr);
-    void navigateToURLWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
+    void navigateToPDFLinkWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
 
     void stopLoading();
     RefPtr<API::Navigation> reload(bool reloadFromOrigin);

Modified: trunk/Source/WebKit2/UIProcess/ios/WKPDFView.mm (184440 => 184441)


--- trunk/Source/WebKit2/UIProcess/ios/WKPDFView.mm	2015-05-16 23:24:00 UTC (rev 184440)
+++ trunk/Source/WebKit2/UIProcess/ios/WKPDFView.mm	2015-05-17 00:24:43 UTC (rev 184441)
@@ -669,7 +669,7 @@
     RetainPtr<WKWebView> retainedWebView = _webView;
 
     [self _highlightLinkAnnotation:linkAnnotation forDuration:.2 completionHandler:^{
-        retainedWebView->_page->navigateToURLWithSimulatedClick([url absoluteString], roundedIntPoint(documentPoint), roundedIntPoint(screenPoint));
+        retainedWebView->_page->navigateToPDFLinkWithSimulatedClick([url absoluteString], roundedIntPoint(documentPoint), roundedIntPoint(screenPoint));
     }];
 }
 
@@ -715,7 +715,7 @@
 - (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant openElementAtLocation:(CGPoint)location
 {
     CGPoint screenPoint = [self.window convertPoint:[self convertPoint:location toView:nil] toWindow:nil];
-    _webView->_page->navigateToURLWithSimulatedClick(_positionInformation.url, roundedIntPoint(location), roundedIntPoint(screenPoint));
+    _webView->_page->navigateToPDFLinkWithSimulatedClick(_positionInformation.url, roundedIntPoint(location), roundedIntPoint(screenPoint));
 }
 
 - (RetainPtr<NSArray>)actionSheetAssistant:(WKActionSheetAssistant *)assistant decideActionsForElement:(_WKActivatedElementInfo *)element defaultActions:(RetainPtr<NSArray>)defaultActions

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (184440 => 184441)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-05-16 23:24:00 UTC (rev 184440)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-05-17 00:24:43 UTC (rev 184441)
@@ -1094,7 +1094,7 @@
     loadDataImpl(0, sharedBuffer, ASCIILiteral("application/x-webarchive"), ASCIILiteral("utf-16"), blankURL(), URL(), userData);
 }
 
-void WebPage::navigateToURLWithSimulatedClick(const String& url, IntPoint documentPoint, IntPoint screenPoint)
+void WebPage::navigateToPDFLinkWithSimulatedClick(const String& url, IntPoint documentPoint, IntPoint screenPoint)
 {
     Frame* mainFrame = m_mainFrame->coreFrame();
     Document* mainFrameDocument = mainFrame->document();

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (184440 => 184441)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2015-05-16 23:24:00 UTC (rev 184440)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2015-05-17 00:24:43 UTC (rev 184441)
@@ -944,7 +944,7 @@
     void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL, const String& provisionalLoadErrorURL, const UserData&);
     void loadPlainTextString(const String&, const UserData&);
     void loadWebArchiveData(const IPC::DataReference&, const UserData&);
-    void navigateToURLWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
+    void navigateToPDFLinkWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
     void reload(uint64_t navigationID, bool reloadFromOrigin, const SandboxExtension::Handle&);
     void goForward(uint64_t navigationID, uint64_t);
     void goBack(uint64_t navigationID, uint64_t);

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (184440 => 184441)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2015-05-16 23:24:00 UTC (rev 184440)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2015-05-17 00:24:43 UTC (rev 184441)
@@ -134,7 +134,7 @@
     LoadAlternateHTMLString(String htmlString, String baseURL, String unreachableURL, String provisionalLoadErrorURL, WebKit::UserData userData)
     LoadPlainTextString(String string, WebKit::UserData userData)
     LoadWebArchiveData(IPC::DataReference webArchiveData, WebKit::UserData userData)
-    NavigateToURLWithSimulatedClick(String url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint)
+    NavigateToPDFLinkWithSimulatedClick(String url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint)
 
     Reload(uint64_t navigationID, bool reloadFromOrigin, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
     StopLoading()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to