WebKit Bugzilla
Attachment 372640 Details for
Bug 199114
: WebPageProxy::loadData should accept ShouldOpenExternalURLsPolicy
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-199114-20190621124145.patch (text/plain), 35.35 KB, created by
Jiewen Tan
on 2019-06-21 12:41:46 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Jiewen Tan
Created:
2019-06-21 12:41:46 PDT
Size:
35.35 KB
patch
obsolete
>Subversion Revision: 246612 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 49e261f0208047f8ba7857b21a08c0476b664562..0528f7c93aac75d9ab86e2bf843ababc6ae6d690 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,27 @@ >+2019-06-21 Jiewen Tan <jiewen_tan@apple.com> >+ >+ WebPageProxy::loadData should accept ShouldOpenExternalURLsPolicy >+ https://bugs.webkit.org/show_bug.cgi?id=199114 >+ <rdar://problem/51671674> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This patch teaches WebPageProxy::loadData to propagate ShouldOpenExternalURLsPolicy policy, >+ and then utilize it in RedirectSOAuthorizationSession. Therefore, navigations after successful >+ interceptions will be able to propagate this information from the last navigation. >+ >+ * UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm: >+ (WebKit::shouldOpenExternalURLsPolicy): >+ (WebKit::RedirectSOAuthorizationSession::completeInternal): >+ * UIProcess/WebPageProxy.cpp: >+ (WebKit::WebPageProxy::loadData): >+ (WebKit::WebPageProxy::loadDataWithNavigationShared): >+ * UIProcess/WebPageProxy.h: >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::WebPage::loadDataImpl): >+ (WebKit::WebPage::loadData): >+ * WebProcess/WebPage/WebPage.h: >+ > 2019-06-19 Sihui Liu <sihui_liu@apple.com> > > Remove unused originsWithCredentials from WebsiteData >diff --git a/Source/WebKit/UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm b/Source/WebKit/UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm >index ee9c029b682f8a4cbc5da40a6a3795ab12ffc9c7..4a4d34cefd21464020c678fc36e2195e72b92a66 100644 >--- a/Source/WebKit/UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm >+++ b/Source/WebKit/UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm >@@ -32,6 +32,12 @@ > #import <WebCore/ResourceResponse.h> > > namespace WebKit { >+using namespace WebCore; >+ >+inline ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy(bool shouldOpenExternalURLsPolicy) >+{ >+ return shouldOpenExternalURLsPolicy ? ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes : ShouldOpenExternalURLsPolicy::ShouldNotAllow; >+} > > Ref<SOAuthorizationSession> RedirectSOAuthorizationSession::create(SOAuthorization *soAuthorization, Ref<API::NavigationAction>&& navigationAction, WebPageProxy& page, Callback&& completionHandler) > { >@@ -53,8 +59,10 @@ void RedirectSOAuthorizationSession::abortInternal() > invokeCallback(true); > } > >-void RedirectSOAuthorizationSession::completeInternal(WebCore::ResourceResponse&& response, NSData *data) >+void RedirectSOAuthorizationSession::completeInternal(ResourceResponse&& response, NSData *data) > { >+ auto* navigationActionPtr = navigationAction(); >+ ASSERT(navigationActionPtr); > auto* pagePtr = page(); > if ((response.httpStatusCode() != 302 && response.httpStatusCode() != 200) || !pagePtr) { > fallBackToWebPathInternal(); >@@ -63,8 +71,6 @@ void RedirectSOAuthorizationSession::completeInternal(WebCore::ResourceResponse& > invokeCallback(true); > if (response.httpStatusCode() == 302) { > #if PLATFORM(IOS) >- auto* navigationActionPtr = navigationAction(); >- ASSERT(navigationActionPtr); > // MobileSafari has a WBSURLSpoofingMitigator, which will not display the provisional URL for navigations without user gestures. > // For slow loads that are initiated from the MobileSafari Favorites screen, the aforementioned behavior will create a period > // after authentication completion where the new request to the application site loads with a blank URL and blank page. To >@@ -73,17 +79,17 @@ void RedirectSOAuthorizationSession::completeInternal(WebCore::ResourceResponse& > // show an empty URL or a blank page. These changes ensure a relevant URL bar and useful page content during the load. > if (!navigationActionPtr->isProcessingUserGesture()) { > pagePtr->setShouldSuppressSOAuthorizationInNextNavigationPolicyDecision(); >- auto html = makeString("<script>location = '", response.httpHeaderFields().get(WebCore::HTTPHeaderName::Location), "'</script>").utf8(); >+ auto html = makeString("<script>location = '", response.httpHeaderFields().get(HTTPHeaderName::Location), "'</script>").utf8(); > auto data = IPC::DataReference(reinterpret_cast<const uint8_t*>(html.data()), html.length()); >- pagePtr->loadData(data, "text/html"_s, "UTF-8"_s, navigationActionPtr->request().url()); >+ pagePtr->loadData(data, "text/html"_s, "UTF-8"_s, navigationActionPtr->request().url(), nullptr, shouldOpenExternalURLsPolicy(navigationActionPtr->shouldOpenExternalSchemes())); > return; > } > #endif >- pagePtr->loadRequest(WebCore::ResourceRequest(response.httpHeaderFields().get(WebCore::HTTPHeaderName::Location))); >+ pagePtr->loadRequest(ResourceRequest(response.httpHeaderFields().get(HTTPHeaderName::Location))); > } > if (response.httpStatusCode() == 200) { > pagePtr->setShouldSuppressSOAuthorizationInNextNavigationPolicyDecision(); >- pagePtr->loadData(IPC::DataReference(static_cast<const uint8_t*>(data.bytes), data.length), "text/html"_s, "UTF-8"_s, response.url().string()); >+ pagePtr->loadData(IPC::DataReference(static_cast<const uint8_t*>(data.bytes), data.length), "text/html"_s, "UTF-8"_s, response.url().string(), nullptr, shouldOpenExternalURLsPolicy(navigationActionPtr->shouldOpenExternalSchemes())); > } > } > >diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp >index 1302a84e107fa6d380730da1b86939ff29bfc2dc..1254024225e83ba2db030121c7c314c1ee21f9c0 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.cpp >+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp >@@ -1175,7 +1175,7 @@ RefPtr<API::Navigation> WebPageProxy::loadFile(const String& fileURLString, cons > return navigation; > } > >-RefPtr<API::Navigation> WebPageProxy::loadData(const IPC::DataReference& data, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData) >+RefPtr<API::Navigation> WebPageProxy::loadData(const IPC::DataReference& data, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy) > { > RELEASE_LOG_IF_ALLOWED(Loading, "loadData: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID.toUInt64()); > >@@ -1188,11 +1188,11 @@ RefPtr<API::Navigation> WebPageProxy::loadData(const IPC::DataReference& data, c > launchProcess({ }); > > auto navigation = m_navigationState->createLoadDataNavigation(std::make_unique<API::SubstituteData>(data.vector(), MIMEType, encoding, baseURL, userData)); >- loadDataWithNavigationShared(m_process.copyRef(), navigation, data, MIMEType, encoding, baseURL, userData, ShouldTreatAsContinuingLoad::No); >+ loadDataWithNavigationShared(m_process.copyRef(), navigation, data, MIMEType, encoding, baseURL, userData, ShouldTreatAsContinuingLoad::No, WTF::nullopt, shouldOpenExternalURLsPolicy); > return navigation; > } > >-void WebPageProxy::loadDataWithNavigationShared(Ref<WebProcessProxy>&& process, API::Navigation& navigation, const IPC::DataReference& data, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData, ShouldTreatAsContinuingLoad shouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&& websitePolicies) >+void WebPageProxy::loadDataWithNavigationShared(Ref<WebProcessProxy>&& process, API::Navigation& navigation, const IPC::DataReference& data, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData, ShouldTreatAsContinuingLoad shouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&& websitePolicies, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy) > { > RELEASE_LOG_IF_ALLOWED(Loading, "loadDataWithNavigation: webPID = %i, pageID = %" PRIu64, process->processIdentifier(), m_pageID.toUInt64()); > >@@ -1211,6 +1211,7 @@ void WebPageProxy::loadDataWithNavigationShared(Ref<WebProcessProxy>&& process, > loadParameters.shouldTreatAsContinuingLoad = shouldTreatAsContinuingLoad == ShouldTreatAsContinuingLoad::Yes; > loadParameters.userData = UserData(process->transformObjectsToHandles(userData).get()); > loadParameters.websitePolicies = WTFMove(websitePolicies); >+ loadParameters.shouldOpenExternalURLsPolicy = (uint64_t)shouldOpenExternalURLsPolicy; > addPlatformLoadParameters(loadParameters); > > process->assumeReadAccessToBaseURL(*this, baseURL); >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index 5dd623b4732d0d55ed55340d963ee10e6aff9808..dc9706cef3c74e0473aa01d2cdee6899bc4bb002 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -528,7 +528,7 @@ public: > void addPlatformLoadParameters(LoadParameters&); > RefPtr<API::Navigation> loadRequest(WebCore::ResourceRequest&&, WebCore::ShouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes, API::Object* userData = nullptr); > RefPtr<API::Navigation> loadFile(const String& fileURL, const String& resourceDirectoryURL, API::Object* userData = nullptr); >- RefPtr<API::Navigation> loadData(const IPC::DataReference&, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData = nullptr); >+ RefPtr<API::Navigation> loadData(const IPC::DataReference&, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData = nullptr, WebCore::ShouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow); > void loadAlternateHTML(const IPC::DataReference&, const String& encoding, const URL& baseURL, const URL& unreachableURL, API::Object* userData = nullptr); > void loadWebArchiveData(API::Data*, API::Object* userData = nullptr); > void navigateToPDFLinkWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint); >@@ -1513,7 +1513,7 @@ public: > void decidePolicyForResponseShared(Ref<WebProcessProxy>&&, uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, WebCore::PolicyCheckIdentifier, > uint64_t navigationID, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, bool canShowMIMEType, const String& downloadAttribute, uint64_t listenerID, const UserData&); > void startURLSchemeTaskShared(Ref<WebProcessProxy>&&, URLSchemeTaskParameters&&); >- void loadDataWithNavigationShared(Ref<WebProcessProxy>&&, API::Navigation&, const IPC::DataReference&, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData, WebCore::ShouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&& = WTF::nullopt); >+ void loadDataWithNavigationShared(Ref<WebProcessProxy>&&, API::Navigation&, const IPC::DataReference&, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData, WebCore::ShouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&& = WTF::nullopt, WebCore::ShouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow); > void loadRequestWithNavigationShared(Ref<WebProcessProxy>&&, API::Navigation&, WebCore::ResourceRequest&&, WebCore::ShouldOpenExternalURLsPolicy, API::Object* userData, WebCore::ShouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&& = WTF::nullopt); > void backForwardGoToItemShared(Ref<WebProcessProxy>&&, const WebCore::BackForwardItemIdentifier&, CompletionHandler<void(SandboxExtension::Handle&&)>&&); > void decidePolicyForNavigationActionSyncShared(Ref<WebProcessProxy>&&, uint64_t frameID, bool isMainFrame, WebCore::SecurityOriginData&&, WebCore::PolicyCheckIdentifier, uint64_t navigationID, NavigationActionData&&, >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index 1c10ec15a0e75f8fd6ccb21b465801d1739388fb..c6de5de0462547cd038b0f93e87a7d9c44747670 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -1547,7 +1547,7 @@ void WebPage::loadRequest(LoadParameters&& loadParameters) > ASSERT(!m_pendingWebsitePolicies); > } > >-void WebPage::loadDataImpl(uint64_t navigationID, bool shouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&& websitePolicies, Ref<SharedBuffer>&& sharedBuffer, const String& MIMEType, const String& encodingName, const URL& baseURL, const URL& unreachableURL, const UserData& userData) >+void WebPage::loadDataImpl(uint64_t navigationID, bool shouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&& websitePolicies, Ref<SharedBuffer>&& sharedBuffer, const String& MIMEType, const String& encodingName, const URL& baseURL, const URL& unreachableURL, const UserData& userData, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy) > { > SendStopResponsivenessTimer stopper; > >@@ -1563,7 +1563,7 @@ void WebPage::loadDataImpl(uint64_t navigationID, bool shouldTreatAsContinuingLo > m_loaderClient->willLoadDataRequest(*this, request, const_cast<SharedBuffer*>(substituteData.content()), substituteData.mimeType(), substituteData.textEncoding(), substituteData.failingURL(), WebProcess::singleton().transformHandlesToObjects(userData.object()).get()); > > // Initate the load in WebCore. >- FrameLoadRequest frameLoadRequest(*m_mainFrame->coreFrame(), request, ShouldOpenExternalURLsPolicy::ShouldNotAllow, substituteData); >+ FrameLoadRequest frameLoadRequest(*m_mainFrame->coreFrame(), request, shouldOpenExternalURLsPolicy, substituteData); > frameLoadRequest.setShouldTreatAsContinuingLoad(shouldTreatAsContinuingLoad); > m_mainFrame->coreFrame()->loader().load(WTFMove(frameLoadRequest)); > } >@@ -1574,7 +1574,8 @@ void WebPage::loadData(LoadParameters&& loadParameters) > > auto sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(loadParameters.data.data()), loadParameters.data.size()); > URL baseURL = loadParameters.baseURLString.isEmpty() ? WTF::blankURL() : URL(URL(), loadParameters.baseURLString); >- loadDataImpl(loadParameters.navigationID, loadParameters.shouldTreatAsContinuingLoad, WTFMove(loadParameters.websitePolicies), WTFMove(sharedBuffer), loadParameters.MIMEType, loadParameters.encodingName, baseURL, URL(), loadParameters.userData); >+ ShouldOpenExternalURLsPolicy externalURLsPolicy = static_cast<ShouldOpenExternalURLsPolicy>(loadParameters.shouldOpenExternalURLsPolicy); >+ loadDataImpl(loadParameters.navigationID, loadParameters.shouldTreatAsContinuingLoad, WTFMove(loadParameters.websitePolicies), WTFMove(sharedBuffer), loadParameters.MIMEType, loadParameters.encodingName, baseURL, URL(), loadParameters.userData, externalURLsPolicy); > } > > void WebPage::loadAlternateHTML(LoadParameters&& loadParameters) >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index 0bba97df8b6db5fcfa11121d9bdc06c88f86315c..9d7b1f5f9476f9670aa01f95bc961ef9f77c25be 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -1286,7 +1286,7 @@ private: > > String sourceForFrame(WebFrame*); > >- void loadDataImpl(uint64_t navigationID, bool shouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&&, Ref<WebCore::SharedBuffer>&&, const String& MIMEType, const String& encodingName, const URL& baseURL, const URL& failingURL, const UserData&); >+ void loadDataImpl(uint64_t navigationID, bool shouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&&, Ref<WebCore::SharedBuffer>&&, const String& MIMEType, const String& encodingName, const URL& baseURL, const URL& failingURL, const UserData&, WebCore::ShouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow); > > // Actions > void tryClose(); >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index f876061551dcfdc7d86d2e552461e8004ba0d4ff..ab23bedef319d6e7b5c7e927e10d35899c37e6a9 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,17 @@ >+2019-06-21 Jiewen Tan <jiewen_tan@apple.com> >+ >+ WebPageProxy::loadData should accept ShouldOpenExternalURLsPolicy >+ https://bugs.webkit.org/show_bug.cgi?id=199114 >+ <rdar://problem/51671674> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * TestWebKitAPI/Tests/WebKitCocoa/TestSOAuthorization.mm: >+ (-[TestSOAuthorizationNavigationDelegate init]): >+ (-[TestSOAuthorizationNavigationDelegate webView:decidePolicyForNavigationAction:decisionHandler:]): >+ (configureSOAuthorizationWebView): >+ (TestWebKitAPI::TEST): >+ > 2019-06-19 Aakash Jain <aakash_jain@apple.com> > > [ews-build] Add step to analyze Compile WebKit failures >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/TestSOAuthorization.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/TestSOAuthorization.mm >index 8c947a5f17a62286791ec9709138175d05c6330d..d193cddd4b704d16eb025fdae250aa9dde281a08 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/TestSOAuthorization.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/TestSOAuthorization.mm >@@ -32,6 +32,7 @@ > #import "InstanceMethodSwizzler.h" > #import "PlatformUtilities.h" > #import "TestWKWebView.h" >+#import <WebKit/WKNavigationActionPrivate.h> > #import <WebKit/WKNavigationDelegatePrivate.h> > #import <WebKit/WKNavigationPrivate.h> > #import <pal/cocoa/AppSSOSoftLink.h> >@@ -121,6 +122,7 @@ static const char* samlResponse = > > @interface TestSOAuthorizationNavigationDelegate : NSObject <WKNavigationDelegate, WKUIDelegate> > @property bool isDefaultPolicy; >+@property bool shouldOpenExternalSchemes; > - (instancetype)init; > @end > >@@ -128,8 +130,10 @@ @implementation TestSOAuthorizationNavigationDelegate > > - (instancetype)init > { >- if (self = [super init]) >+ if (self = [super init]) { > self.isDefaultPolicy = true; >+ self.shouldOpenExternalSchemes = false; >+ } > return self; > } > >@@ -142,6 +146,7 @@ - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigat > > - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler > { >+ EXPECT_EQ(navigationAction._shouldOpenExternalSchemes, self.shouldOpenExternalSchemes); > if (self.isDefaultPolicy) { > decisionHandler(WKNavigationActionPolicyAllow); > return; >@@ -242,10 +247,11 @@ static void resetState() > gNewWindow = nullptr; > } > >-static void configureSOAuthorizationWebView(TestWKWebView *webView, TestSOAuthorizationNavigationDelegate *delegate) >+static void configureSOAuthorizationWebView(TestWKWebView *webView, TestSOAuthorizationNavigationDelegate *delegate, bool shouldOpenExternalSchemes = false) > { > [webView setNavigationDelegate:delegate]; > [webView setUIDelegate:delegate]; >+ delegate.shouldOpenExternalSchemes = shouldOpenExternalSchemes; > } > > static String generateHtml(const char* templateHtml, const String& substitute, const String& optionalSubstitute1 = emptyString(), const String& optionalSubstitute2 = emptyString()) >@@ -277,7 +283,7 @@ TEST(SOAuthorizationRedirect, NoInterceptions) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; > Util::run(&navigationCompleted); >@@ -294,7 +300,7 @@ TEST(SOAuthorizationRedirect, InterceptionError) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; > Util::run(&navigationCompleted); >@@ -313,7 +319,7 @@ TEST(SOAuthorizationRedirect, InterceptionDoNotHandle) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; > Util::run(&authorizationPerformed); >@@ -336,7 +342,7 @@ TEST(SOAuthorizationRedirect, InterceptionCancel) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; > Util::run(&authorizationPerformed); >@@ -359,7 +365,7 @@ TEST(SOAuthorizationRedirect, InterceptionCompleteWithoutData) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; > Util::run(&authorizationPerformed); >@@ -382,7 +388,7 @@ TEST(SOAuthorizationRedirect, InterceptionUnexpectedCompletion) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; > Util::run(&authorizationPerformed); >@@ -406,7 +412,7 @@ TEST(SOAuthorizationRedirect, InterceptionSucceed1) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; > Util::run(&authorizationPerformed); >@@ -433,7 +439,7 @@ TEST(SOAuthorizationRedirect, InterceptionSucceed2) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > // Force App Links with a request.URL that has a different host than the current one (empty host) and ShouldOpenExternalURLsPolicy::ShouldAllow. > auto testURL = URL(URL(), "https://www.example.com"); >@@ -467,7 +473,7 @@ TEST(SOAuthorizationRedirect, InterceptionSucceed3) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > // Force App Links with a request.URL that has a different host than the current one (empty host) and ShouldOpenExternalURLsPolicy::ShouldAllow. > auto testURL = URL(URL(), "https://www.example.com"); >@@ -504,7 +510,7 @@ TEST(SOAuthorizationRedirect, InterceptionSucceed4) > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > // A separate delegate that implements decidePolicyForNavigationAction. > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > [delegate setIsDefaultPolicy:false]; > > [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; >@@ -533,7 +539,7 @@ TEST(SOAuthorizationRedirect, InterceptionSucceedWithOtherHttpStatusCode) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; > Util::run(&authorizationPerformed); >@@ -557,7 +563,7 @@ TEST(SOAuthorizationRedirect, InterceptionSucceedWithCookie) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; > Util::run(&authorizationPerformed); >@@ -592,7 +598,7 @@ TEST(SOAuthorizationRedirect, InterceptionSucceedWithCookies) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; > Util::run(&authorizationPerformed); >@@ -626,7 +632,7 @@ TEST(SOAuthorizationRedirect, InterceptionSucceedWithRedirectionAndCookie) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > auto testURL = URL(URL(), "https://www.example.com"); > #if PLATFORM(MAC) >@@ -667,7 +673,7 @@ TEST(SOAuthorizationRedirect, InterceptionSucceedWithDifferentOrigin) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; > Util::run(&authorizationPerformed); >@@ -691,8 +697,7 @@ TEST(SOAuthorizationRedirect, InterceptionSucceedWithWaitingSession) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- [webView setNavigationDelegate:delegate.get()]; >- [webView setUIDelegate:delegate.get()]; >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > // The session will be waiting since the web view is is not int the window. > [webView removeFromSuperview]; >@@ -727,7 +732,7 @@ TEST(SOAuthorizationRedirect, InterceptionSucceedWithActiveSessionDidMoveWindow) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; > Util::run(&authorizationPerformed); >@@ -758,7 +763,7 @@ TEST(SOAuthorizationRedirect, InterceptionSucceedTwice) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > for (int i = 0; i < 2; i++) { > authorizationPerformed = false; >@@ -791,7 +796,7 @@ TEST(SOAuthorizationRedirect, InterceptionSucceedSuppressActiveSession) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; > Util::run(&authorizationPerformed); >@@ -826,8 +831,7 @@ TEST(SOAuthorizationRedirect, InterceptionSucceedSuppressWaitingSession) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- [webView setNavigationDelegate:delegate.get()]; >- [webView setUIDelegate:delegate.get()]; >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > // The session will be waiting since the web view is is not int the window. > [webView removeFromSuperview]; >@@ -867,7 +871,7 @@ TEST(SOAuthorizationRedirect, InterceptionSucceedSAML) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > // Add a http body to the request to mimic a SAML request. > auto request = adoptNS([NSMutableURLRequest requestWithURL:testURL.get()]); >@@ -897,6 +901,8 @@ TEST(SOAuthorizationRedirect, AuthorizationOptions) > > [webView loadHTMLString:@"" baseURL:(NSURL *)URL(URL(), "http://www.webkit.org")]; > Util::run(&navigationCompleted); >+ >+ [delegate setShouldOpenExternalSchemes:true]; > [webView evaluateJavaScript: @"location = 'http://www.example.com'" completionHandler:nil]; > Util::run(&authorizationPerformed); > checkAuthorizationOptions(true, "http://www.webkit.org", 0); >@@ -913,7 +919,7 @@ TEST(SOAuthorizationRedirect, InterceptionDidNotHandleTwice) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; > Util::run(&authorizationPerformed); >@@ -934,7 +940,7 @@ TEST(SOAuthorizationRedirect, InterceptionCompleteTwice) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; > Util::run(&authorizationPerformed); >@@ -959,7 +965,7 @@ TEST(SOAuthorizationRedirect, InterceptionSucceedWithUI) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; > Util::run(&authorizationPerformed); >@@ -992,7 +998,7 @@ TEST(SOAuthorizationRedirect, InterceptionCancelWithUI) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; > Util::run(&authorizationPerformed); >@@ -1024,7 +1030,7 @@ TEST(SOAuthorizationRedirect, InterceptionErrorWithUI) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; > Util::run(&authorizationPerformed); >@@ -1056,7 +1062,7 @@ TEST(SOAuthorizationRedirect, InterceptionSucceedSuppressActiveSessionWithUI) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; > Util::run(&authorizationPerformed); >@@ -1095,7 +1101,7 @@ TEST(SOAuthorizationRedirect, ShowUITwice) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; > Util::run(&authorizationPerformed); >@@ -1132,7 +1138,7 @@ TEST(SOAuthorizationRedirect, NSNotificationCenter) > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); > auto delegate = adoptNS([[TestSOAuthorizationNavigationDelegate alloc] init]); >- configureSOAuthorizationWebView(webView.get(), delegate.get()); >+ configureSOAuthorizationWebView(webView.get(), delegate.get(), true); > > [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; > Util::run(&authorizationPerformed); >@@ -1167,6 +1173,7 @@ TEST(SOAuthorizationPopUp, NoInterceptions) > [webView loadHTMLString:testHtml baseURL:testURL.get()]; > Util::run(&navigationCompleted); > >+ [delegate setShouldOpenExternalSchemes:true]; > navigationCompleted = false; > #if PLATFORM(MAC) > [webView sendClicksAtPoint:NSMakePoint(200, 200) numberOfClicks:1]; >@@ -1244,6 +1251,7 @@ TEST(SOAuthorizationPopUp, InterceptionError) > [webView loadHTMLString:testHtml baseURL:baseURL.get()]; > Util::run(&navigationCompleted); > >+ [delegate setShouldOpenExternalSchemes:true]; > #if PLATFORM(MAC) > [webView sendClicksAtPoint:NSMakePoint(200, 200) numberOfClicks:1]; > #elif PLATFORM(IOS) >@@ -1420,6 +1428,7 @@ TEST(SOAuthorizationPopUp, InterceptionSucceedWithOtherHttpStatusCode) > [webView loadHTMLString:testHtml baseURL:baseURL.get()]; > Util::run(&navigationCompleted); > >+ [delegate setShouldOpenExternalSchemes:true]; > #if PLATFORM(MAC) > [webView sendClicksAtPoint:NSMakePoint(200, 200) numberOfClicks:1]; > #elif PLATFORM(IOS)
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 199114
:
372640
|
372649
|
372657