WebKit Bugzilla
Attachment 349715 Details for
Bug 189602
: PSON: window.open() with 'noopener' should only process-swap cross-site, not cross-origin
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
WIP Patch
189602_realWindowOpenSupport2_wip.patch (text/plain), 24.47 KB, created by
Chris Dumez
on 2018-09-13 16:56:26 PDT
(
hide
)
Description:
WIP Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2018-09-13 16:56:26 PDT
Size:
24.47 KB
patch
obsolete
>diff --git a/Source/WebCore/loader/FrameLoadRequest.h b/Source/WebCore/loader/FrameLoadRequest.h >index 03177d38c60..3970ab995ee 100644 >--- a/Source/WebCore/loader/FrameLoadRequest.h >+++ b/Source/WebCore/loader/FrameLoadRequest.h >@@ -88,9 +88,6 @@ public: > > InitiatedByMainFrame initiatedByMainFrame() const { return m_initiatedByMainFrame; } > >- void setIsCrossOriginWindowOpenNavigation(bool value) { m_isCrossOriginWindowOpenNavigation = value; } >- bool isCrossOriginWindowOpenNavigation() const { return m_isCrossOriginWindowOpenNavigation; } >- > bool isSystemPreview() const { return m_systemPreviewInfo.isSystemPreview; } > const IntRect& systemPreviewRect() const { return m_systemPreviewInfo.systemPreviewRect; } > >@@ -112,7 +109,6 @@ private: > ShouldOpenExternalURLsPolicy m_shouldOpenExternalURLsPolicy { ShouldOpenExternalURLsPolicy::ShouldNotAllow }; > AtomicString m_downloadAttribute; > InitiatedByMainFrame m_initiatedByMainFrame { InitiatedByMainFrame::Unknown }; >- bool m_isCrossOriginWindowOpenNavigation { false }; > SystemPreviewInfo m_systemPreviewInfo; > ShouldSkipSafeBrowsingCheck m_shouldSkipSafeBrowsingCheck { ShouldSkipSafeBrowsingCheck::No }; > }; >diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp >index 20a1f784f0d..218e0bb92dc 100644 >--- a/Source/WebCore/loader/FrameLoader.cpp >+++ b/Source/WebCore/loader/FrameLoader.cpp >@@ -1363,7 +1363,6 @@ void FrameLoader::loadURL(FrameLoadRequest&& frameLoadRequest, const String& ref > return; > > NavigationAction action { frameLoadRequest.requester(), request, frameLoadRequest.initiatedByMainFrame(), newLoadType, isFormSubmission, event, frameLoadRequest.shouldOpenExternalURLsPolicy(), frameLoadRequest.downloadAttribute() }; >- action.setIsCrossOriginWindowOpenNavigation(frameLoadRequest.isCrossOriginWindowOpenNavigation()); > if (m_frame.page() && m_frame.page()->openedViaWindowOpenWithOpener()) > action.setOpenedViaWindowOpenWithOpener(); > action.setHasOpenedFrames(!m_openedFrames.isEmpty()); >diff --git a/Source/WebCore/loader/NavigationAction.h b/Source/WebCore/loader/NavigationAction.h >index 95bce229bc8..77269c2628e 100644 >--- a/Source/WebCore/loader/NavigationAction.h >+++ b/Source/WebCore/loader/NavigationAction.h >@@ -117,9 +117,6 @@ public: > > bool treatAsSameOriginNavigation() const { return m_treatAsSameOriginNavigation; } > >- void setIsCrossOriginWindowOpenNavigation(bool value) { m_isCrossOriginWindowOpenNavigation = value; } >- bool isCrossOriginWindowOpenNavigation() const { return m_isCrossOriginWindowOpenNavigation; } >- > void setOpener(std::optional<PageIDAndFrameIDPair>&& opener) { m_opener = WTFMove(opener); } > const std::optional<PageIDAndFrameIDPair>& opener() const { return m_opener; } > >@@ -145,7 +142,6 @@ private: > RefPtr<UserGestureToken> m_userGestureToken { UserGestureIndicator::currentUserGesture() }; > AtomicString m_downloadAttribute; > bool m_treatAsSameOriginNavigation; >- bool m_isCrossOriginWindowOpenNavigation { false }; > bool m_hasOpenedFrames { false }; > bool m_openedViaWindowOpenWithOpener { false }; > std::optional<PageIDAndFrameIDPair> m_opener; >diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp >index fb68507db18..2d423b6b052 100644 >--- a/Source/WebCore/page/DOMWindow.cpp >+++ b/Source/WebCore/page/DOMWindow.cpp >@@ -2280,8 +2280,6 @@ ExceptionOr<RefPtr<Frame>> DOMWindow::createWindow(const String& urlString, cons > ResourceRequest resourceRequest { completedURL, referrer, ResourceRequestCachePolicy::UseProtocolCachePolicy }; > FrameLoader::addSameSiteInfoToRequestIfNeeded(resourceRequest, openerFrame.document()); > FrameLoadRequest frameLoadRequest { *activeWindow.document(), activeWindow.document()->securityOrigin(), resourceRequest, "_self"_s, LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, activeDocument->shouldOpenExternalURLsPolicyToPropagate(), initiatedByMainFrame }; >- if (openerFrame.document() && !protocolHostAndPortAreEqual(openerFrame.document()->url(), frameLoadRequest.resourceRequest().url())) >- frameLoadRequest.setIsCrossOriginWindowOpenNavigation(true); > newFrame->loader().changeLocation(WTFMove(frameLoadRequest)); > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >diff --git a/Source/WebKit/Shared/NavigationActionData.cpp b/Source/WebKit/Shared/NavigationActionData.cpp >index 95496dab0c7..394361db04b 100644 >--- a/Source/WebKit/Shared/NavigationActionData.cpp >+++ b/Source/WebKit/Shared/NavigationActionData.cpp >@@ -46,10 +46,10 @@ void NavigationActionData::encode(IPC::Encoder& encoder) const > encoder << clickLocationInRootViewCoordinates; > encoder << isRedirect; > encoder << treatAsSameOriginNavigation; >- encoder << isCrossOriginWindowOpenNavigation; > encoder << hasOpenedFrames; > encoder << openedViaWindowOpenWithOpener; > encoder << opener; >+ encoder << requesterOrigin; > encoder << targetBackForwardItemIdentifier; > } > >@@ -104,11 +104,6 @@ std::optional<NavigationActionData> NavigationActionData::decode(IPC::Decoder& d > if (!treatAsSameOriginNavigation) > return std::nullopt; > >- std::optional<bool> isCrossOriginWindowOpenNavigation; >- decoder >> isCrossOriginWindowOpenNavigation; >- if (!isCrossOriginWindowOpenNavigation) >- return std::nullopt; >- > std::optional<bool> hasOpenedFrames; > decoder >> hasOpenedFrames; > if (!hasOpenedFrames) >@@ -124,6 +119,11 @@ std::optional<NavigationActionData> NavigationActionData::decode(IPC::Decoder& d > if (!opener) > return std::nullopt; > >+ std::optional<WebCore::SecurityOriginData> requesterOrigin; >+ decoder >> requesterOrigin; >+ if (!opener) >+ return std::nullopt; >+ > std::optional<std::optional<WebCore::BackForwardItemIdentifier>> targetBackForwardItemIdentifier; > decoder >> targetBackForwardItemIdentifier; > if (!targetBackForwardItemIdentifier) >@@ -131,7 +131,8 @@ std::optional<NavigationActionData> NavigationActionData::decode(IPC::Decoder& d > > return {{ WTFMove(navigationType), WTFMove(modifiers), WTFMove(mouseButton), WTFMove(syntheticClickType), WTFMove(*userGestureTokenIdentifier), > WTFMove(*canHandleRequest), WTFMove(shouldOpenExternalURLsPolicy), WTFMove(*downloadAttribute), WTFMove(clickLocationInRootViewCoordinates), >- WTFMove(*isRedirect), *treatAsSameOriginNavigation, *isCrossOriginWindowOpenNavigation, *hasOpenedFrames, *openedViaWindowOpenWithOpener, WTFMove(*opener), WTFMove(*targetBackForwardItemIdentifier) }}; >+ WTFMove(*isRedirect), *treatAsSameOriginNavigation, *hasOpenedFrames, *openedViaWindowOpenWithOpener, WTFMove(*opener), WTFMove(*requesterOrigin), >+ WTFMove(*targetBackForwardItemIdentifier) }}; > } > > } // namespace WebKit >diff --git a/Source/WebKit/Shared/NavigationActionData.h b/Source/WebKit/Shared/NavigationActionData.h >index 79008d84561..0839f1f4b5d 100644 >--- a/Source/WebKit/Shared/NavigationActionData.h >+++ b/Source/WebKit/Shared/NavigationActionData.h >@@ -29,6 +29,7 @@ > #include <WebCore/BackForwardItemIdentifier.h> > #include <WebCore/FloatPoint.h> > #include <WebCore/FrameLoaderTypes.h> >+#include <WebCore/SecurityOriginData.h> > > namespace IPC { > class Decoder; >@@ -52,10 +53,10 @@ struct NavigationActionData { > WebCore::FloatPoint clickLocationInRootViewCoordinates; > bool isRedirect { false }; > bool treatAsSameOriginNavigation { false }; >- bool isCrossOriginWindowOpenNavigation { false }; > bool hasOpenedFrames { false }; > bool openedViaWindowOpenWithOpener { false }; > std::optional<std::pair<uint64_t, uint64_t>> opener; >+ WebCore::SecurityOriginData requesterOrigin; > std::optional<WebCore::BackForwardItemIdentifier> targetBackForwardItemIdentifier; > }; > >diff --git a/Source/WebKit/UIProcess/API/APINavigation.h b/Source/WebKit/UIProcess/API/APINavigation.h >index abd85c73eba..97ee96ddd6e 100644 >--- a/Source/WebKit/UIProcess/API/APINavigation.h >+++ b/Source/WebKit/UIProcess/API/APINavigation.h >@@ -29,6 +29,7 @@ > #include "WebBackForwardListItem.h" > #include <WebCore/Process.h> > #include <WebCore/ResourceRequest.h> >+#include <WebCore/SecurityOriginData.h> > #include <wtf/Ref.h> > > namespace WebCore { >@@ -88,9 +89,6 @@ public: > void setTreatAsSameOriginNavigation(bool value) { m_treatAsSameOriginNavigation = value; } > bool treatAsSameOriginNavigation() const { return m_treatAsSameOriginNavigation; } > >- void setIsCrossOriginWindowOpenNavigation(bool value) { m_isCrossOriginWindowOpenNavigation = value; } >- bool isCrossOriginWindowOpenNavigation() const { return m_isCrossOriginWindowOpenNavigation; } >- > void setHasOpenedFrames(bool value) { m_hasOpenedFrames = value; } > bool hasOpenedFrames() const { return m_hasOpenedFrames; } > >@@ -100,6 +98,9 @@ public: > void setOpener(const std::optional<std::pair<uint64_t, uint64_t>>& opener) { m_opener = opener; } > const std::optional<std::pair<uint64_t, uint64_t>>& opener() const { return m_opener; } > >+ void setRequesterOrigin(const WebCore::SecurityOriginData& origin) { m_requesterOrigin = origin; } >+ const WebCore::SecurityOriginData& requesterOrigin() const { return m_requesterOrigin; } >+ > #if !LOG_DISABLED > const char* loggingString() const; > #endif >@@ -122,10 +123,10 @@ private: > RefPtr<WebKit::WebBackForwardListItem> m_fromItem; > std::optional<WebCore::FrameLoadType> m_backForwardFrameLoadType; > bool m_treatAsSameOriginNavigation { false }; >- bool m_isCrossOriginWindowOpenNavigation { false }; > bool m_hasOpenedFrames { false }; > bool m_openedViaWindowOpenWithOpener { false }; > std::optional<std::pair<uint64_t, uint64_t>> m_opener; >+ WebCore::SecurityOriginData m_requesterOrigin; > }; > > } // namespace API >diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp >index 7ab55914d71..7190eabed99 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.cpp >+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp >@@ -2523,7 +2523,8 @@ void WebPageProxy::continueNavigationInNewProcess(API::Navigation& navigation, R > }; > } > >- if (!navigation.isCrossOriginWindowOpenNavigation() || !navigatedFrameIdentifierInPreviousProcess) >+ bool isInitialNavigationInNewWindow = openedByDOM() && !hasCommittedAnyProvisionalLoads(); >+ if (!isInitialNavigationInNewWindow || !navigatedFrameIdentifierInPreviousProcess) > return; > > m_mainFrameWindowCreationHandler = [this, previousProcess = WTFMove(previousProcess), navigatedFrameIdentifierInPreviousProcess = *navigatedFrameIdentifierInPreviousProcess](const GlobalWindowIdentifier& windowIdentifier) { >@@ -3628,6 +3629,7 @@ void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, uint64_t navigationID > if (frame->isMainFrame() && navigationID) > navigation = &navigationState().navigation(navigationID); > >+ m_hasCommittedAnyProvisionalLoads = true; > m_process->didCommitProvisionalLoad(); > > #if PLATFORM(IOS) >@@ -4020,11 +4022,11 @@ void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, const WebCo > navigation->setCurrentRequest(ResourceRequest(request), m_process->coreProcessIdentifier()); > navigation->setCurrentRequestIsRedirect(navigationActionData.isRedirect); > navigation->setTreatAsSameOriginNavigation(navigationActionData.treatAsSameOriginNavigation); >- navigation->setIsCrossOriginWindowOpenNavigation(navigationActionData.isCrossOriginWindowOpenNavigation); > navigation->setHasOpenedFrames(navigationActionData.hasOpenedFrames); > if (navigationActionData.openedViaWindowOpenWithOpener) > navigation->setOpenedViaWindowOpenWithOpener(); > navigation->setOpener(navigationActionData.opener); >+ navigation->setRequesterOrigin(navigationActionData.requesterOrigin); > > #if ENABLE(CONTENT_FILTERING) > if (frame->didHandleContentFilterUnblockNavigation(request)) >@@ -4272,6 +4274,8 @@ void WebPageProxy::createNewPage(const FrameInfoData& originatingFrameInfoData, > return; > } > >+ newPage->setOpenedByDOM(); >+ > reply(newPage->pageID(), newPage->creationParameters()); > > WebsiteDataStore::cloneSessionData(*this, *newPage); >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index a9d3072975c..f4e5419c00c 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -440,6 +440,11 @@ public: > bool tryClose(); > bool isClosed() const { return m_isClosed; } > >+ void setOpenedByDOM() { m_openedByDOM = true; } >+ bool openedByDOM() const { return m_openedByDOM; } >+ >+ bool hasCommittedAnyProvisionalLoads() const { return m_hasCommittedAnyProvisionalLoads; } >+ > void setIsUsingHighPerformanceWebGL(bool value) { m_isUsingHighPerformanceWebGL = value; } > bool isUsingHighPerformanceWebGL() const { return m_isUsingHighPerformanceWebGL; } > >@@ -2210,6 +2215,8 @@ private: > #endif > > bool m_isUsingHighPerformanceWebGL { false }; >+ bool m_openedByDOM { false }; >+ bool m_hasCommittedAnyProvisionalLoads { false }; > > HashMap<String, Ref<WebURLSchemeHandler>> m_urlSchemeHandlersByScheme; > HashMap<uint64_t, Ref<WebURLSchemeHandler>> m_urlSchemeHandlersByIdentifier; >diff --git a/Source/WebKit/UIProcess/WebProcessPool.cpp b/Source/WebKit/UIProcess/WebProcessPool.cpp >index 00826c8e56c..d3c27f2cca0 100644 >--- a/Source/WebKit/UIProcess/WebProcessPool.cpp >+++ b/Source/WebKit/UIProcess/WebProcessPool.cpp >@@ -2120,6 +2120,11 @@ Ref<WebProcessProxy> WebProcessPool::processForNavigation(WebPageProxy& page, co > return process; > } > >+static inline bool shouldUseSameProcessBasedOnURLs(const URL& url, const URL& targetURL) >+{ >+ return !url.isValid() || !targetURL.isValid() || url.isEmpty() || url.isBlankURL() || registrableDomainsAreEqual(url, targetURL); >+} >+ > Ref<WebProcessProxy> WebProcessPool::processForNavigationInternal(WebPageProxy& page, const API::Navigation& navigation, ProcessSwapRequestedByClient processSwapRequestedByClient, PolicyAction& action, String& reason) > { > if (!m_configuration->processSwapsOnNavigation() && processSwapRequestedByClient == ProcessSwapRequestedByClient::No) { >@@ -2137,22 +2142,32 @@ Ref<WebProcessProxy> WebProcessPool::processForNavigationInternal(WebPageProxy& > return page.process(); > } > >- if (!page.process().hasCommittedAnyProvisionalLoads()) { >- reason = "Process has not yet committed any provisional loads"_s; >- return page.process(); >- } >- >- if (navigation.isCrossOriginWindowOpenNavigation()) { >+ auto targetURL = navigation.currentRequest().url(); >+ if (page.openedByDOM() && !page.hasCommittedAnyProvisionalLoads()) { >+ // Initial load in a new window created by the DOM, opener does not have a handle to us since openedViaWindowOpenWithOpener is false. > if (navigation.opener() && !m_configuration->processSwapsOnWindowOpenWithOpener()) { > reason = "Browsing context has an opener"_s; > return page.process(); > } > >+ // We swap process if the new window's initial load is cross-site with regards to the requester. >+ if (!navigation.requesterOrigin().isEmpty()) { >+ auto requesterURL = URL { URL(), navigation.requesterOrigin().toString() }; >+ if (shouldUseSameProcessBasedOnURLs(requesterURL, targetURL)) { >+ reason = "New window's initial navigation is same-site with requester"_s; >+ return page.process(); >+ } >+ } > reason = "Initial navigation is cross-site in a newly opened window"_s; > action = PolicyAction::Ignore; > return createNewWebProcess(page.websiteDataStore()); > } > >+ if (!page.process().hasCommittedAnyProvisionalLoads()) { >+ reason = "Process has not yet committed any provisional loads"_s; >+ return page.process(); >+ } >+ > // FIXME: We should support process swap when a window has been opened via window.open() without 'noopener'. > // The issue is that the opener has a handle to the WindowProxy. > if (navigation.openedViaWindowOpenWithOpener()) { >@@ -2190,7 +2205,6 @@ Ref<WebProcessProxy> WebProcessPool::processForNavigationInternal(WebPageProxy& > } > } > >- auto targetURL = navigation.currentRequest().url(); > if (processSwapRequestedByClient == ProcessSwapRequestedByClient::No) { > if (navigation.treatAsSameOriginNavigation()) { > reason = "The treatAsSameOriginNavigation flag is set"_s; >@@ -2198,7 +2212,7 @@ Ref<WebProcessProxy> WebProcessPool::processForNavigationInternal(WebPageProxy& > } > > auto url = URL { ParsedURLString, page.pageLoadState().url() }; >- if (!url.isValid() || !targetURL.isValid() || url.isEmpty() || url.isBlankURL() || registrableDomainsAreEqual(url, targetURL)) { >+ if (shouldUseSameProcessBasedOnURLs(url, targetURL)) { > reason = "Navigation is same-site"_s; > return page.process(); > } >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp >index 5b1f37a79ec..703a8a04af8 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp >@@ -866,10 +866,11 @@ void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const Navigat > navigationActionData.downloadAttribute = navigationAction.downloadAttribute(); > navigationActionData.isRedirect = !redirectResponse.isNull(); > navigationActionData.treatAsSameOriginNavigation = navigationAction.treatAsSameOriginNavigation(); >- navigationActionData.isCrossOriginWindowOpenNavigation = navigationAction.isCrossOriginWindowOpenNavigation(); > navigationActionData.hasOpenedFrames = navigationAction.hasOpenedFrames(); > navigationActionData.openedViaWindowOpenWithOpener = navigationAction.openedViaWindowOpenWithOpener(); > navigationActionData.opener = navigationAction.opener(); >+ if (auto& requester = navigationAction.requester()) >+ navigationActionData.requesterOrigin = requester->securityOrigin().data(); > navigationActionData.targetBackForwardItemIdentifier = navigationAction.targetBackForwardItemIdentifier(); > > WebCore::Frame* coreFrame = m_frame->coreFrame(); >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm >index f70d11f1fa5..ed4b4983cdf 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm >@@ -247,7 +247,7 @@ window.onpageshow = function(evt) { > > #if PLATFORM(MAC) > >-static const char* windowOpenCrossOriginNoOpenerTestBytes = R"PSONRESOURCE( >+static const char* windowOpenCrossSiteNoOpenerTestBytes = R"PSONRESOURCE( > <script> > window.onload = function() { > window.open("pson://www.apple.com/main.html", "_blank", "noopener"); >@@ -255,7 +255,15 @@ window.onload = function() { > </script> > )PSONRESOURCE"; > >-static const char* windowOpenCrossOriginWithOpenerTestBytes = R"PSONRESOURCE( >+static const char* windowOpenCrossOriginButSameSiteNoOpenerTestBytes = R"PSONRESOURCE( >+<script> >+window.onload = function() { >+ window.open("pson://www.webkit.org:8080/main.html", "_blank", "noopener"); >+} >+</script> >+)PSONRESOURCE"; >+ >+static const char* windowOpenCrossSiteWithOpenerTestBytes = R"PSONRESOURCE( > <script> > window.onload = function() { > window.open("pson://www.apple.com/main.html"); >@@ -263,7 +271,7 @@ window.onload = function() { > </script> > )PSONRESOURCE"; > >-static const char* windowOpenSameOriginNoOpenerTestBytes = R"PSONRESOURCE( >+static const char* windowOpenSameSiteNoOpenerTestBytes = R"PSONRESOURCE( > <script> > window.onload = function() { > if (!opener) >@@ -479,7 +487,7 @@ TEST(ProcessSwap, BackWithoutSuspendedPage) > > #if PLATFORM(MAC) > >-TEST(ProcessSwap, CrossOriginWindowOpenNoOpener) >+TEST(ProcessSwap, CrossSiteWindowOpenNoOpener) > { > auto processPoolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]); > processPoolConfiguration.get().processSwapsOnNavigation = YES; >@@ -488,7 +496,7 @@ TEST(ProcessSwap, CrossOriginWindowOpenNoOpener) > auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]); > [webViewConfiguration setProcessPool:processPool.get()]; > auto handler = adoptNS([[PSONScheme alloc] init]); >- [handler addMappingFromURLString:@"pson://www.webkit.org/main.html" toData:windowOpenCrossOriginNoOpenerTestBytes]; >+ [handler addMappingFromURLString:@"pson://www.webkit.org/main.html" toData:windowOpenCrossSiteNoOpenerTestBytes]; > [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"]; > > auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]); >@@ -519,7 +527,47 @@ TEST(ProcessSwap, CrossOriginWindowOpenNoOpener) > EXPECT_NE(pid1, pid2); > } > >-TEST(ProcessSwap, CrossOriginWindowOpenWithOpener) >+TEST(ProcessSwap, CrossSiteButSameOriginWindowOpenNoOpener) >+{ >+ auto processPoolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]); >+ processPoolConfiguration.get().processSwapsOnNavigation = YES; >+ auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]); >+ >+ auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]); >+ [webViewConfiguration setProcessPool:processPool.get()]; >+ auto handler = adoptNS([[PSONScheme alloc] init]); >+ [handler addMappingFromURLString:@"pson://www.webkit.org/main.html" toData:windowOpenCrossOriginButSameSiteNoOpenerTestBytes]; >+ [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"]; >+ >+ auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]); >+ auto navigationDelegate = adoptNS([[PSONNavigationDelegate alloc] init]); >+ [webView setNavigationDelegate:navigationDelegate.get()]; >+ auto uiDelegate = adoptNS([[PSONUIDelegate alloc] initWithNavigationDelegate:navigationDelegate.get()]); >+ [webView setUIDelegate:uiDelegate.get()]; >+ >+ numberOfDecidePolicyCalls = 0; >+ NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main.html"]]; >+ [webView loadRequest:request]; >+ >+ TestWebKitAPI::Util::run(&done); >+ done = false; >+ >+ TestWebKitAPI::Util::run(&didCreateWebView); >+ didCreateWebView = false; >+ >+ TestWebKitAPI::Util::run(&done); >+ >+ EXPECT_EQ(2, numberOfDecidePolicyCalls); >+ >+ auto pid1 = [webView _webProcessIdentifier]; >+ EXPECT_TRUE(!!pid1); >+ auto pid2 = [createdWebView _webProcessIdentifier]; >+ EXPECT_TRUE(!!pid2); >+ >+ EXPECT_EQ(pid1, pid2); >+} >+ >+TEST(ProcessSwap, CrossSiteWindowOpenWithOpener) > { > auto processPoolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]); > processPoolConfiguration.get().processSwapsOnNavigation = YES; >@@ -529,7 +577,7 @@ TEST(ProcessSwap, CrossOriginWindowOpenWithOpener) > auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]); > [webViewConfiguration setProcessPool:processPool.get()]; > auto handler = adoptNS([[PSONScheme alloc] init]); >- [handler addMappingFromURLString:@"pson://www.webkit.org/main.html" toData:windowOpenCrossOriginWithOpenerTestBytes]; >+ [handler addMappingFromURLString:@"pson://www.webkit.org/main.html" toData:windowOpenCrossSiteWithOpenerTestBytes]; > [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"]; > > auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]); >@@ -560,7 +608,7 @@ TEST(ProcessSwap, CrossOriginWindowOpenWithOpener) > EXPECT_NE(pid1, pid2); > } > >-TEST(ProcessSwap, SameOriginWindowOpenNoOpener) >+TEST(ProcessSwap, SameSiteWindowOpenNoOpener) > { > auto processPoolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]); > processPoolConfiguration.get().processSwapsOnNavigation = YES; >@@ -568,7 +616,7 @@ TEST(ProcessSwap, SameOriginWindowOpenNoOpener) > > auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]); > [webViewConfiguration setProcessPool:processPool.get()]; >- auto handler = adoptNS([[PSONScheme alloc] initWithBytes:windowOpenSameOriginNoOpenerTestBytes]); >+ auto handler = adoptNS([[PSONScheme alloc] initWithBytes:windowOpenSameSiteNoOpenerTestBytes]); > [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"]; > > auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189602
:
349715
|
349719
|
349723
|
349730
|
349769
|
349895