Diff
Modified: trunk/Source/WebCore/ChangeLog (187961 => 187962)
--- trunk/Source/WebCore/ChangeLog 2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Source/WebCore/ChangeLog 2015-08-05 16:05:55 UTC (rev 187962)
@@ -1,3 +1,33 @@
+2015-08-05 Daniel Bates <daba...@apple.com>
+
+ REGRESSION (r185111): Clicking phone numbers doesn't prompt to call sometimes
+ https://bugs.webkit.org/show_bug.cgi?id=147678
+ <rdar://problem/21827815>
+
+ Reviewed by Brady Eidson.
+
+ Fixes an issue where a non-user-initiated navigation of the main frame to a phone link (tel URL)
+ may be ignored. The navigation is ignored if the page was reloaded as a result of a web content
+ process crash, its lifetime exceeded the back-forward cache expiration interval, or a person
+ quits and opens Safari again, among other scenarios.
+
+ * history/HistoryItem.cpp:
+ (WebCore::HistoryItem::setShouldOpenExternalURLsPolicy): Added.
+ (WebCore::HistoryItem::shouldOpenExternalURLsPolicy): Added.
+ * history/HistoryItem.h:
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::loadDifferentDocumentItem): Apply the "should open external URLs" policy
+ from the history item, if applicable. Also, be more explicit when instantiating a NavigationAction
+ so as to help make it straightforward to reduce the number of NavigationAction constructors we have
+ in the future.
+ * loader/HistoryController.cpp:
+ (WebCore::HistoryController::saveDocumentState): Save the "should open external URLs" policy to
+ the history item.
+ (WebCore::HistoryController::restoreDocumentState): Apply the "should open external URLs" policy
+ from the history item to the document loader.
+ (WebCore::HistoryController::initializeItem): Update the "should open external URLs" policy of
+ the history item to reflect the policy of the document loader associated with the current frame.
+
2015-08-04 Wenson Hsieh <wenson_hs...@apple.com>
Checkboxes and radio buttons should scale when zooming or pinching to zoom
Modified: trunk/Source/WebCore/history/HistoryItem.cpp (187961 => 187962)
--- trunk/Source/WebCore/history/HistoryItem.cpp 2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Source/WebCore/history/HistoryItem.cpp 2015-08-05 16:05:55 UTC (rev 187962)
@@ -351,6 +351,16 @@
m_documentState.clear();
}
+void HistoryItem::setShouldOpenExternalURLsPolicy(ShouldOpenExternalURLsPolicy policy)
+{
+ m_shouldOpenExternalURLsPolicy = policy;
+}
+
+ShouldOpenExternalURLsPolicy HistoryItem::shouldOpenExternalURLsPolicy() const
+{
+ return m_shouldOpenExternalURLsPolicy;
+}
+
bool HistoryItem::isTargetItem() const
{
return m_isTargetItem;
Modified: trunk/Source/WebCore/history/HistoryItem.h (187961 => 187962)
--- trunk/Source/WebCore/history/HistoryItem.h 2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Source/WebCore/history/HistoryItem.h 2015-08-05 16:05:55 UTC (rev 187962)
@@ -28,6 +28,7 @@
#define HistoryItem_h
#include "FloatRect.h"
+#include "FrameLoaderTypes.h"
#include "IntPoint.h"
#include "IntRect.h"
#include "SerializedScriptValue.h"
@@ -117,6 +118,9 @@
WEBCORE_EXPORT void setDocumentState(const Vector<String>&);
void clearDocumentState();
+ WEBCORE_EXPORT void setShouldOpenExternalURLsPolicy(ShouldOpenExternalURLsPolicy);
+ WEBCORE_EXPORT ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy() const;
+
void setURL(const URL&);
WEBCORE_EXPORT void setURLString(const String&);
WEBCORE_EXPORT void setOriginalURLString(const String&);
@@ -231,6 +235,8 @@
IntPoint m_scrollPoint;
float m_pageScaleFactor;
Vector<String> m_documentState;
+
+ ShouldOpenExternalURLsPolicy m_shouldOpenExternalURLsPolicy { ShouldOpenExternalURLsPolicy::ShouldNotAllow };
HistoryItemVector m_children;
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (187961 => 187962)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2015-08-05 16:05:55 UTC (rev 187962)
@@ -3228,7 +3228,11 @@
if (!item.referrer().isNull())
request.setHTTPReferrer(item.referrer());
-
+
+ ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy = shouldOpenExternalURLsPolicyToApply(m_frame, item.shouldOpenExternalURLsPolicy());
+ bool isFormSubmission = false;
+ Event* event = nullptr;
+
// If this was a repost that failed the page cache, we might try to repost the form.
NavigationAction action;
if (formData) {
@@ -3254,10 +3258,10 @@
if (cacheLoadPolicy == MayAttemptCacheOnlyLoadForFormSubmissionItem) {
request.setCachePolicy(ReturnCacheDataDontLoad);
- action = "" loadType, false);
+ action = "" loadType, isFormSubmission, event, shouldOpenExternalURLsPolicy);
} else {
request.setCachePolicy(ReturnCacheDataElseLoad);
- action = "" NavigationType::FormResubmitted);
+ action = "" NavigationType::FormResubmitted, event, shouldOpenExternalURLsPolicy);
}
} else {
switch (loadType) {
@@ -3282,7 +3286,7 @@
ResourceRequest requestForOriginalURL(request);
requestForOriginalURL.setURL(itemOriginalURL);
- action = "" loadType, false);
+ action = "" loadType, isFormSubmission, event, shouldOpenExternalURLsPolicy);
}
loadWithNavigationAction(request, action, LockHistory::No, loadType, 0, AllowNavigationToInvalidURL::Yes);
Modified: trunk/Source/WebCore/loader/HistoryController.cpp (187961 => 187962)
--- trunk/Source/WebCore/loader/HistoryController.cpp 2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Source/WebCore/loader/HistoryController.cpp 2015-08-05 16:05:55 UTC (rev 187962)
@@ -191,6 +191,9 @@
ASSERT(m_frame.document());
Document& document = *m_frame.document();
if (item->isCurrentDocument(document) && document.hasLivingRenderTree()) {
+ if (DocumentLoader* documentLoader = document.loader())
+ item->setShouldOpenExternalURLsPolicy(documentLoader->shouldOpenExternalURLsPolicyToPropagate());
+
LOG(Loading, "WebCoreLoading %s: saving form state to %p", m_frame.tree().uniqueName().string().utf8().data(), item);
item->setDocumentState(document.formElementsState());
}
@@ -230,6 +233,8 @@
if (m_frame.loader().documentLoader()->isClientRedirect())
return;
+ m_frame.loader().documentLoader()->setShouldOpenExternalURLsPolicy(m_currentItem->shouldOpenExternalURLsPolicy());
+
LOG(Loading, "WebCoreLoading %s: restoring form state from %p", m_frame.tree().uniqueName().string().utf8().data(), m_currentItem.get());
m_frame.document()->setStateForNewFormElements(m_currentItem->documentState());
}
@@ -648,6 +653,8 @@
if (!unreachableURL.isEmpty() || documentLoader->response().httpStatusCode() >= 400)
item.setLastVisitWasFailure(true);
+ item.setShouldOpenExternalURLsPolicy(documentLoader->shouldOpenExternalURLsPolicyToPropagate());
+
// Save form state if this is a POST
item.setFormInfoFromRequest(documentLoader->request());
}
Modified: trunk/Source/WebKit2/ChangeLog (187961 => 187962)
--- trunk/Source/WebKit2/ChangeLog 2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Source/WebKit2/ChangeLog 2015-08-05 16:05:55 UTC (rev 187962)
@@ -1,3 +1,28 @@
+2015-08-05 Daniel Bates <daba...@apple.com>
+
+ REGRESSION (r185111): Clicking phone numbers doesn't prompt to call sometimes
+ https://bugs.webkit.org/show_bug.cgi?id=147678
+ <rdar://problem/21827815>
+
+ Reviewed by Brady Eidson.
+
+ Teach WebKit to save and restore the "should open external URLs" policy.
+
+ * Shared/SessionState.cpp:
+ (WebKit::isValidEnum): Added.
+ (WebKit::PageState::encode): Modified to encode the "should open external URLs" policy.
+ (WebKit::PageState::decode): Modified to decode the "should open external URLs" policy.
+ * Shared/SessionState.h: Added ShouldOpenExternalURLsPolicy to PageState (defaults to WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow).
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _killWebContentProcessAndResetState]): Added; used in the unit test TestWebKitAPI/Tests/WebKit2Cocoa/ShouldOpenExternalURLsInNewWindowActions.mm.
+ * UIProcess/API/Cocoa/WKWebViewPrivate.h: Declare -[WKWebView _killWebContentProcessAndResetState].
+ * UIProcess/mac/LegacySessionStateCoding.cpp: Defined constant sessionHistoryEntryShouldOpenExternalURLsPolicyKey.
+ (WebKit::encodeSessionHistory): Modified to encode the "should open external URLs" policy.
+ (WebKit::decodeSessionHistoryEntry): Modified to decode the "should open external URLs" policy.
+ * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
+ (WebKit::toPageState): Copy "should open external URLs" policy from specified history item.
+ (WebKit::toHistoryItem): Apply "should open external URLs" policy from PageState to HistoryItem.
+
2015-08-04 Antti Koivisto <an...@apple.com>
Network cache fetches should have timeout
Modified: trunk/Source/WebKit2/Shared/SessionState.cpp (187961 => 187962)
--- trunk/Source/WebKit2/Shared/SessionState.cpp 2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Source/WebKit2/Shared/SessionState.cpp 2015-08-05 16:05:55 UTC (rev 187962)
@@ -30,6 +30,17 @@
namespace WebKit {
+bool isValidEnum(WebCore::ShouldOpenExternalURLsPolicy policy)
+{
+ switch (policy) {
+ case WebCore::ShouldOpenExternalURLsPolicy::ShouldAllow:
+ case WebCore::ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes:
+ case WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow:
+ return true;
+ }
+ return false;
+}
+
void HTTPBody::Element::encode(IPC::ArgumentEncoder& encoder) const
{
encoder.encodeEnum(type);
@@ -170,6 +181,7 @@
{
encoder << title;
encoder << mainFrameState;
+ encoder.encodeEnum(shouldOpenExternalURLsPolicy);
}
bool PageState::decode(IPC::ArgumentDecoder& decoder, PageState& result)
@@ -178,6 +190,8 @@
return false;
if (!decoder.decode(result.mainFrameState))
return false;
+ if (!decoder.decodeEnum(result.shouldOpenExternalURLsPolicy) || !isValidEnum(result.shouldOpenExternalURLsPolicy))
+ return false;
return true;
}
Modified: trunk/Source/WebKit2/Shared/SessionState.h (187961 => 187962)
--- trunk/Source/WebKit2/Shared/SessionState.h 2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Source/WebKit2/Shared/SessionState.h 2015-08-05 16:05:55 UTC (rev 187962)
@@ -31,6 +31,7 @@
#endif
#include <WebCore/FloatRect.h>
+#include <WebCore/FrameLoaderTypes.h>
#include <WebCore/IntRect.h>
#include <WebCore/URL.h>
#include <wtf/Optional.h>
@@ -44,6 +45,8 @@
namespace WebKit {
+bool isValidEnum(WebCore::ShouldOpenExternalURLsPolicy);
+
struct HTTPBody {
struct Element {
void encode(IPC::ArgumentEncoder&) const;
@@ -115,6 +118,7 @@
String title;
FrameState mainFrameState;
+ WebCore::ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy { WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow };
};
struct BackForwardListItemState {
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (187961 => 187962)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2015-08-05 16:05:55 UTC (rev 187962)
@@ -2046,6 +2046,11 @@
_page->process().terminate();
}
+- (void)_killWebContentProcessAndResetState
+{
+ _page->terminateProcess();
+}
+
#if PLATFORM(IOS)
static WebCore::FloatSize activeMinimumLayoutSize(WKWebView *webView, const CGRect& bounds)
{
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (187961 => 187962)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h 2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h 2015-08-05 16:05:55 UTC (rev 187962)
@@ -175,6 +175,8 @@
@property (nonatomic, setter=_setOverrideDeviceScaleFactor:) CGFloat _overrideDeviceScaleFactor WK_AVAILABLE(WK_MAC_TBA, NA);
#endif
+- (void)_killWebContentProcessAndResetState;
+
- (void)_getMainResourceDataWithCompletionHandler:(void (^)(NSData *, NSError *))completionHandler;
- (void)_getWebArchiveDataWithCompletionHandler:(void (^)(NSData *, NSError *))completionHandler;
Modified: trunk/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp (187961 => 187962)
--- trunk/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp 2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp 2015-08-05 16:05:55 UTC (rev 187962)
@@ -54,6 +54,7 @@
static const CFStringRef sessionHistoryEntryTitleKey = CFSTR("SessionHistoryEntryTitle");
static const CFStringRef sessionHistoryEntryOriginalURLKey = CFSTR("SessionHistoryEntryOriginalURL");
static const CFStringRef sessionHistoryEntryDataKey = CFSTR("SessionHistoryEntryData");
+static const CFStringRef sessionHistoryEntryShouldOpenExternalURLsPolicyKey = CFSTR("SessionHistoryEntryShouldOpenExternalURLsPolicyKey");
// Session history entry data.
const uint32_t sessionHistoryEntryDataVersion = 2;
@@ -426,12 +427,15 @@
auto title = item.pageState.title.createCFString();
auto originalURL = item.pageState.mainFrameState.originalURLString.createCFString();
auto data = ""
+ auto shouldOpenExternalURLsPolicyValue = static_cast<uint64_t>(item.pageState.shouldOpenExternalURLsPolicy);
+ auto shouldOpenExternalURLsPolicy = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &shouldOpenExternalURLsPolicyValue));
auto entryDictionary = createDictionary({
{ sessionHistoryEntryURLKey, url.get() },
{ sessionHistoryEntryTitleKey, title.get() },
{ sessionHistoryEntryOriginalURLKey, originalURL.get() },
{ sessionHistoryEntryDataKey, data.get() },
+ { sessionHistoryEntryShouldOpenExternalURLsPolicyKey, shouldOpenExternalURLsPolicy.get() },
});
CFArrayAppendValue(entries.get(), entryDictionary.get());
@@ -965,10 +969,20 @@
if (!historyEntryData)
return false;
+ auto rawShouldOpenExternalURLsPolicy = dynamic_cf_cast<CFNumberRef>(CFDictionaryGetValue(entryDictionary, sessionHistoryEntryShouldOpenExternalURLsPolicyKey));
+ WebCore::ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy;
+ if (rawShouldOpenExternalURLsPolicy) {
+ uint64_t value;
+ CFNumberGetValue(rawShouldOpenExternalURLsPolicy, kCFNumberSInt64Type, &value);
+ shouldOpenExternalURLsPolicy = static_cast<WebCore::ShouldOpenExternalURLsPolicy>(value);
+ } else
+ shouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes;
+
if (!decodeSessionHistoryEntryData(historyEntryData, backForwardListItemState.pageState.mainFrameState))
return false;
backForwardListItemState.pageState.title = title;
+ backForwardListItemState.pageState.shouldOpenExternalURLsPolicy = shouldOpenExternalURLsPolicy;
backForwardListItemState.pageState.mainFrameState.urlString = urlString;
backForwardListItemState.pageState.mainFrameState.originalURLString = originalURLString;
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.cpp (187961 => 187962)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.cpp 2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.cpp 2015-08-05 16:05:55 UTC (rev 187962)
@@ -116,6 +116,7 @@
pageState.title = historyItem.title();
pageState.mainFrameState = toFrameState(historyItem);
+ pageState.shouldOpenExternalURLsPolicy = historyItem.shouldOpenExternalURLsPolicy();
return pageState;
}
@@ -188,6 +189,7 @@
Ref<HistoryItem> toHistoryItem(const PageState& pageState)
{
Ref<HistoryItem> historyItem = HistoryItem::create(pageState.mainFrameState.urlString, pageState.title);
+ historyItem->setShouldOpenExternalURLsPolicy(pageState.shouldOpenExternalURLsPolicy);
applyFrameState(historyItem, pageState.mainFrameState);
return historyItem;
Modified: trunk/Tools/ChangeLog (187961 => 187962)
--- trunk/Tools/ChangeLog 2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Tools/ChangeLog 2015-08-05 16:05:55 UTC (rev 187962)
@@ -1,3 +1,19 @@
+2015-08-05 Daniel Bates <daba...@apple.com>
+
+ REGRESSION (r185111): Clicking phone numbers doesn't prompt to call sometimes
+ https://bugs.webkit.org/show_bug.cgi?id=147678
+ <rdar://problem/21827815>
+
+ Reviewed by Brady Eidson.
+
+ Add a test to ensure that we restore the "should open external URLs" policy on
+ page reload after the web content process crashes.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2/should-open-external-schemes.html: Added.
+ * TestWebKitAPI/Tests/WebKit2Cocoa/ShouldOpenExternalURLsInNewWindowActions.mm:
+ (TEST):
+
2015-08-04 Hunseop Jeong <hs85.je...@samsung.com>
[EFL] Editing tests have been broken since r186694
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (187961 => 187962)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2015-08-05 16:05:55 UTC (rev 187962)
@@ -298,6 +298,7 @@
CE3524F91B1441C40028A7C5 /* TextFieldDidBeginAndEndEditing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE3524F11B142B8D0028A7C5 /* TextFieldDidBeginAndEndEditing.cpp */; };
CE3524FA1B1443890028A7C5 /* input-focus-blur.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CE3524F51B142BBB0028A7C5 /* input-focus-blur.html */; };
CEA6CF2819CCF69D0064F5A7 /* open-and-close-window.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CEA6CF2719CCF69D0064F5A7 /* open-and-close-window.html */; };
+ CEBABD491B71687C0051210A /* should-open-external-schemes.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CEBABD481B71687C0051210A /* should-open-external-schemes.html */; };
E1220DCA155B28AA0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E1220DC9155B287D0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html */; };
E194E1BD177E53C7009C4D4E /* StopLoadingFromDidReceiveResponse.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E194E1BC177E534A009C4D4E /* StopLoadingFromDidReceiveResponse.html */; };
E19DB9791B32137C00DB38D4 /* NavigatorLanguage.mm in Sources */ = {isa = PBXBuildFile; fileRef = E19DB9781B32137C00DB38D4 /* NavigatorLanguage.mm */; };
@@ -403,6 +404,7 @@
51E5C7021919C3B200D8B3E1 /* simple2.html in Copy Resources */,
51E5C7031919C3B200D8B3E1 /* simple3.html in Copy Resources */,
C01A23F21266156700C9ED55 /* spacebar-scrolling.html in Copy Resources */,
+ CEBABD491B71687C0051210A /* should-open-external-schemes.html in Copy Resources */,
E194E1BD177E53C7009C4D4E /* StopLoadingFromDidReceiveResponse.html in Copy Resources */,
CD59F53519E9110D00CF1835 /* test-mse.mp4 in Copy Resources */,
524BBCA119E30C77002F1AF1 /* test.mp4 in Copy Resources */,
@@ -726,6 +728,7 @@
CE3524F51B142BBB0028A7C5 /* input-focus-blur.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "input-focus-blur.html"; sourceTree = "<group>"; };
CEA6CF2219CCF5BD0064F5A7 /* OpenAndCloseWindow.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OpenAndCloseWindow.mm; sourceTree = "<group>"; };
CEA6CF2719CCF69D0064F5A7 /* open-and-close-window.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "open-and-close-window.html"; sourceTree = "<group>"; };
+ CEBABD481B71687C0051210A /* should-open-external-schemes.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "should-open-external-schemes.html"; sourceTree = "<group>"; };
E1220D9F155B25480013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MemoryCacheDisableWithinResourceLoadDelegate.mm; sourceTree = "<group>"; };
E1220DC9155B287D0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = MemoryCacheDisableWithinResourceLoadDelegate.html; sourceTree = "<group>"; };
E194E1BA177E5145009C4D4E /* StopLoadingFromDidReceiveResponse.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StopLoadingFromDidReceiveResponse.mm; sourceTree = "<group>"; };
@@ -1163,6 +1166,7 @@
BC909778125571AB00083756 /* simple.html */,
51E780361919AFF8001829A2 /* simple2.html */,
51E780371919AFF8001829A2 /* simple3.html */,
+ CEBABD481B71687C0051210A /* should-open-external-schemes.html */,
C02B7882126615410026BF0F /* spacebar-scrolling.html */,
CD59F53319E910BC00CF1835 /* test-mse.mp4 */,
524BBCA019E30C63002F1AF1 /* test.mp4 */,
Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/should-open-external-schemes.html (0 => 187962)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/should-open-external-schemes.html (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/should-open-external-schemes.html 2015-08-05 16:05:55 UTC (rev 187962)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function navigateToTelURL()
+{
+ window.location.href = "" (408) 996-1010";
+}
+
+function navigateToTelURLInZeroTimer()
+{
+ window.setTimeout(navigateToTelURL, 0);
+}
+
+function navigateToTelURLInNestedZeroTimer()
+{
+ window.setTimeout(navigateToTelURLInZeroTimer, 0);
+}
+</script>
+</head>
+</html>
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ShouldOpenExternalURLsInNewWindowActions.mm (187961 => 187962)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ShouldOpenExternalURLsInNewWindowActions.mm 2015-08-05 16:03:06 UTC (rev 187961)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ShouldOpenExternalURLsInNewWindowActions.mm 2015-08-05 16:05:55 UTC (rev 187962)
@@ -29,6 +29,7 @@
#import "PlatformUtilities.h"
#import <WebKit/WKNavigationActionPrivate.h>
+#import <WebKit/WKWebViewPrivate.h>
#import <wtf/RetainPtr.h>
#if WK_API_ENABLED
@@ -206,6 +207,48 @@
action = ""
}
+TEST(WebKit2, RestoreShouldOpenExternalURLsPolicyAfterCrash)
+{
+ auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+ auto window = adoptNS([[NSWindow alloc] initWithContentRect:[webView frame] styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]);
+ [[window contentView] addSubview:webView.get()];
+ auto controller = adoptNS([[ShouldOpenExternalURLsInNewWindowActionsController alloc] init]);
+ [webView setNavigationDelegate:controller.get()];
+ [webView setUIDelegate:controller.get()];
+
+ finishedNavigation = false;
+ NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"should-open-external-schemes" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
+ [webView loadRequest:request];
+ TestWebKitAPI::Util::run(&finishedNavigation);
+ finishedNavigation = false;
+
+ // Before crash
+ decidedPolicy = false;
+ [webView evaluateJavaScript:@"navigateToTelURLInNestedZeroTimer()" completionHandler:nil]; // Non-user initiated navigation because it is performed in a nested timer callback.
+ TestWebKitAPI::Util::run(&decidedPolicy);
+ decidedPolicy = false;
+
+ ASSERT_TRUE([action _shouldOpenExternalSchemes]);
+ ASSERT_FALSE([action _shouldOpenAppLinks]);
+
+ // Crash
+ [webView _killWebContentProcessAndResetState];
+ [webView reload];
+
+ finishedNavigation = false;
+ TestWebKitAPI::Util::run(&finishedNavigation);
+ finishedNavigation = false;
+
+ // After crash
+ decidedPolicy = false;
+ [webView evaluateJavaScript:@"navigateToTelURLInNestedZeroTimer()" completionHandler:nil]; // Non-user initiated navigation because it is performed in a nested timer callback.
+ TestWebKitAPI::Util::run(&decidedPolicy);
+ decidedPolicy = false;
+
+ ASSERT_TRUE([action _shouldOpenExternalSchemes]);
+ ASSERT_FALSE([action _shouldOpenAppLinks]);
+};
+
#endif
#endif