Changeset 221122 in webkit
- Timestamp:
- Aug 23, 2017 5:31:22 PM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r221116 r221122 1 2017-08-23 Ryan Haddad <ryanhaddad@apple.com> 2 3 Unreviewed, rolling out r221109. 4 5 This change caused assertion failures on iOS and macOS debug 6 bots. 7 8 Reverted changeset: 9 10 "Stop using PolicyCallback for new window policies" 11 https://bugs.webkit.org/show_bug.cgi?id=175907 12 http://trac.webkit.org/changeset/221109 13 1 14 2017-08-23 Jer Noble <jer.noble@apple.com> 2 15 -
trunk/Source/WebCore/loader/FrameLoader.cpp
r221109 r221122 1295 1295 if (!targetFrame && !frameName.isEmpty()) { 1296 1296 action = action.copyWithShouldOpenExternalURLsPolicy(shouldOpenExternalURLsPolicyToApply(m_frame, frameLoadRequest)); 1297 policyChecker().checkNewWindowPolicy( WTFMove(action), request, formState, frameName, [this, allowNavigationToInvalidURL, openerPolicy] (const ResourceRequest& request, FormState* formState, const String& frameName, const NavigationAction& action, bool shouldContinue) {1297 policyChecker().checkNewWindowPolicy(action, request, formState, frameName, [this, allowNavigationToInvalidURL, openerPolicy] (const ResourceRequest& request, FormState* formState, const String& frameName, const NavigationAction& action, bool shouldContinue) { 1298 1298 continueLoadAfterNewWindowPolicy(request, formState, frameName, action, shouldContinue, allowNavigationToInvalidURL, openerPolicy); 1299 1299 }); … … 1365 1365 if (request.shouldCheckNewWindowPolicy()) { 1366 1366 NavigationAction action { request.requester(), request.resourceRequest(), InitiatedByMainFrame::Unknown, NavigationType::Other, request.shouldOpenExternalURLsPolicy() }; 1367 policyChecker().checkNewWindowPolicy( WTFMove(action), request.resourceRequest(), nullptr, request.frameName(), [this] (const ResourceRequest& request, FormState* formState, const String& frameName, const NavigationAction& action, bool shouldContinue) {1367 policyChecker().checkNewWindowPolicy(action, request.resourceRequest(), nullptr, request.frameName(), [this] (const ResourceRequest& request, FormState* formState, const String& frameName, const NavigationAction& action, bool shouldContinue) { 1368 1368 continueLoadAfterNewWindowPolicy(request, formState, frameName, action, shouldContinue, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Suppress); 1369 1369 }); … … 2770 2770 } 2771 2771 2772 policyChecker().checkNewWindowPolicy( WTFMove(action), workingResourceRequest, WTFMove(formState), frameName, [this, allowNavigationToInvalidURL, openerPolicy] (const ResourceRequest& request, FormState* formState, const String& frameName, const NavigationAction& action, bool shouldContinue) {2772 policyChecker().checkNewWindowPolicy(action, workingResourceRequest, WTFMove(formState), frameName, [this, allowNavigationToInvalidURL, openerPolicy] (const ResourceRequest& request, FormState* formState, const String& frameName, const NavigationAction& action, bool shouldContinue) { 2773 2773 continueLoadAfterNewWindowPolicy(request, formState, frameName, action, shouldContinue, allowNavigationToInvalidURL, openerPolicy); 2774 2774 }); -
trunk/Source/WebCore/loader/PolicyCallback.cpp
r221109 r221122 46 46 47 47 m_navigationFunction = WTFMove(function); 48 m_newWindowFunction = nullptr; 49 } 50 51 void PolicyCallback::set(const ResourceRequest& request, FormState* formState, const String& frameName, const NavigationAction& navigationAction, NewWindowPolicyDecisionFunction&& function) 52 { 53 m_request = request; 54 m_formState = formState; 55 m_frameName = frameName; 56 m_navigationAction = navigationAction; 57 58 m_navigationFunction = nullptr; 59 m_newWindowFunction = WTFMove(function); 48 60 } 49 61 … … 52 64 if (m_navigationFunction) 53 65 m_navigationFunction(m_request, m_formState.get(), shouldContinue); 66 if (m_newWindowFunction) 67 m_newWindowFunction(m_request, m_formState.get(), m_frameName, m_navigationAction, shouldContinue); 54 68 } 55 69 … … 66 80 if (m_navigationFunction) 67 81 m_navigationFunction(m_request, m_formState.get(), false); 82 if (m_newWindowFunction) 83 m_newWindowFunction(m_request, m_formState.get(), m_frameName, m_navigationAction, false); 68 84 } 69 85 -
trunk/Source/WebCore/loader/PolicyCallback.h
r221109 r221122 43 43 44 44 using NavigationPolicyDecisionFunction = Function<void(const ResourceRequest&, FormState*, bool shouldContinue)>; 45 using NewWindowPolicyDecisionFunction = Function<void(const ResourceRequest&, FormState*, const String& frameName, const NavigationAction&, bool shouldContinue)>; 45 46 46 47 class PolicyCallback { 47 48 public: 48 49 void set(const ResourceRequest&, FormState*, NavigationPolicyDecisionFunction&&); 50 void set(const ResourceRequest&, FormState*, const String& frameName, const NavigationAction&, NewWindowPolicyDecisionFunction&&); 49 51 50 52 const ResourceRequest& request() const { return m_request; } … … 61 63 62 64 NavigationPolicyDecisionFunction m_navigationFunction; 65 NewWindowPolicyDecisionFunction m_newWindowFunction; 63 66 }; 64 67 -
trunk/Source/WebCore/loader/PolicyChecker.cpp
r221109 r221122 154 154 } 155 155 156 void PolicyChecker::checkNewWindowPolicy( NavigationAction&& navigationAction, const ResourceRequest& request, FormState* formState, const String& frameName, NewWindowPolicyDecisionFunction function)156 void PolicyChecker::checkNewWindowPolicy(const NavigationAction& action, const ResourceRequest& request, FormState* formState, const String& frameName, NewWindowPolicyDecisionFunction function) 157 157 { 158 158 if (m_frame.document() && m_frame.document()->isSandboxed(SandboxPopups)) … … 162 162 return continueAfterNavigationPolicy(PolicyIgnore); 163 163 164 NavigationAction navigationActionCopy = navigationAction; 165 m_frame.loader().client().dispatchDecidePolicyForNewWindowAction(navigationActionCopy, request, formState, frameName, [frame = makeRef(m_frame), request, formState = makeRefPtr(formState), frameName, navigationAction = WTFMove(navigationAction), function = WTFMove(function)](PolicyAction policyAction) { 166 switch (policyAction) { 167 case PolicyDownload: 168 frame->loader().client().startDownload(request); 169 FALLTHROUGH; 170 case PolicyIgnore: 171 function({ }, nullptr, { }, { }, false); 172 break; 173 case PolicyUse: 174 function(request, formState.get(), frameName, navigationAction, true); 175 break; 176 } 177 ASSERT_NOT_REACHED(); 164 m_callback.set(request, formState, frameName, action, WTFMove(function)); 165 m_frame.loader().client().dispatchDecidePolicyForNewWindowAction(action, request, formState, frameName, [this](PolicyAction action) { 166 continueAfterNewWindowPolicy(action); 178 167 }); 179 168 } … … 236 225 } 237 226 227 void PolicyChecker::continueAfterNewWindowPolicy(PolicyAction policy) 228 { 229 PolicyCallback callback = WTFMove(m_callback); 230 231 switch (policy) { 232 case PolicyIgnore: 233 callback.clearRequest(); 234 break; 235 case PolicyDownload: 236 m_frame.loader().client().startDownload(callback.request()); 237 callback.clearRequest(); 238 break; 239 case PolicyUse: 240 break; 241 } 242 243 callback.call(policy == PolicyUse); 244 } 245 238 246 void PolicyChecker::handleUnimplementablePolicy(const ResourceError& error) 239 247 { -
trunk/Source/WebCore/loader/PolicyChecker.h
r221109 r221122 48 48 class ResourceResponse; 49 49 50 using NewWindowPolicyDecisionFunction = WTF::Function<void(const ResourceRequest&, FormState*, const String& frameName, const NavigationAction&, bool shouldContinue)>;51 52 50 class PolicyChecker { 53 51 WTF_MAKE_NONCOPYABLE(PolicyChecker); … … 58 56 void checkNavigationPolicy(const ResourceRequest&, bool didReceiveRedirectResponse, DocumentLoader*, FormState*, NavigationPolicyDecisionFunction); 59 57 void checkNavigationPolicy(const ResourceRequest&, bool didReceiveRedirectResponse, NavigationPolicyDecisionFunction); 60 void checkNewWindowPolicy( NavigationAction&&, const ResourceRequest&, FormState*, const String& frameName, NewWindowPolicyDecisionFunction);58 void checkNewWindowPolicy(const NavigationAction&, const ResourceRequest&, FormState*, const String& frameName, NewWindowPolicyDecisionFunction); 61 59 62 60 // FIXME: These are different. They could use better names. … … 87 85 private: 88 86 void continueAfterNavigationPolicy(PolicyAction); 87 void continueAfterNewWindowPolicy(PolicyAction); 89 88 90 89 void handleUnimplementablePolicy(const ResourceError&);
Note: See TracChangeset
for help on using the changeset viewer.