Changeset 69924 in webkit
- Timestamp:
- Oct 17, 2010 9:02:51 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r69923 r69924 1 2010-10-17 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Dimitri Glazkov. 4 5 FrameLoader doesn't need an explicit userGesture parameter 6 https://bugs.webkit.org/show_bug.cgi?id=47777 7 8 We used to pass around the user gesture state explicitly. Now we use 9 static state. Explicitly passing the user gesture state to FrameLoader 10 in these methods is pretty out-dated. 11 12 * bindings/ScriptControllerBase.cpp: 13 (WebCore::ScriptController::executeIfJavaScriptURL): 14 * bindings/generic/BindingDOMWindow.h: 15 (WebCore::::createWindow): 16 (WebCore::::open): 17 * bindings/js/JSDOMWindowCustom.cpp: 18 (WebCore::createWindow): 19 (WebCore::JSDOMWindow::open): 20 * bindings/js/JSDocumentCustom.cpp: 21 (WebCore::JSDocument::setLocation): 22 * bindings/js/ScriptController.h: 23 * bindings/v8/ScriptController.h: 24 * html/HTMLAnchorElement.cpp: 25 (WebCore::handleLinkClick): 26 * inspector/InspectorController.cpp: 27 (WebCore::InspectorController::openInInspectedWindow): 28 * loader/FrameLoader.cpp: 29 (WebCore::FrameLoader::changeLocation): 30 (WebCore::FrameLoader::urlSelected): 31 (WebCore::FrameLoader::submitForm): 32 * loader/FrameLoader.h: 33 * loader/NavigationScheduler.cpp: 34 (WebCore::ScheduledURLNavigation::fire): 35 (WebCore::ScheduledRefresh::fire): 36 (WebCore::ScheduledHistoryNavigation::fire): 37 (WebCore::NavigationScheduler::scheduleLocationChange): 38 1 39 2010-10-17 Sergey A. Sukiyazov <sergey.sukiyazov@gmail.com> 2 40 -
trunk/WebCore/bindings/ScriptControllerBase.cpp
r65381 r69924 68 68 } 69 69 70 bool ScriptController::executeIfJavaScriptURL(const KURL& url, bool userGesture,ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL)70 bool ScriptController::executeIfJavaScriptURL(const KURL& url, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL) 71 71 { 72 72 if (!protocolIsJavaScript(url)) … … 91 91 ScriptValue result; 92 92 if (xssAuditor()->canEvaluateJavaScriptURL(decodedURL)) 93 result = executeScript(decodedURL.substring(javascriptSchemeLength), userGesture, AllowXSS);93 result = executeScript(decodedURL.substring(javascriptSchemeLength), processingUserGesture(), AllowXSS); 94 94 95 95 // If executing script caused this frame to be removed from the page, we -
trunk/WebCore/bindings/generic/BindingDOMWindow.h
r69039 r69924 120 120 KURL completedUrl = 121 121 url.isEmpty() ? KURL(ParsedURLString, "") : completeURL(state, url); 122 bool userGesture = state->processingUserGesture();123 124 122 if (created) 125 newFrame->loader()->changeLocation(completedUrl, referrer, false, false , userGesture);123 newFrame->loader()->changeLocation(completedUrl, referrer, false, false); 126 124 else if (!url.isEmpty()) 127 newFrame->navigationScheduler()->scheduleLocationChange(completedUrl.string(), referrer, false, false , userGesture);125 newFrame->navigationScheduler()->scheduleLocationChange(completedUrl.string(), referrer, false, false); 128 126 } 129 127 … … 188 186 && (!protocolIsJavaScript(completedUrl) 189 187 || BindingSecurity<Binding>::canAccessFrame(state, frame, true))) { 190 bool userGesture = state->processingUserGesture();191 192 188 // For whatever reason, Firefox uses the first frame to determine 193 189 // the outgoingReferrer. We replicate that behavior here. 194 190 String referrer = firstFrame->loader()->outgoingReferrer(); 195 191 196 frame->navigationScheduler()->scheduleLocationChange(completedUrl, referrer, false, false , userGesture);192 frame->navigationScheduler()->scheduleLocationChange(completedUrl, referrer, false, false); 197 193 } 198 194 return frame->domWindow(); -
trunk/WebCore/bindings/js/JSDOMWindowCustom.cpp
r69782 r69924 701 701 if (!protocolIsJavaScript(url) || newWindow->allowsAccessFrom(exec)) { 702 702 KURL completedURL = url.isEmpty() ? KURL(ParsedURLString, "") : completeURL(exec, url); 703 bool userGesture = processingUserGesture();704 705 703 if (created) 706 newFrame->loader()->changeLocation(completedURL, referrer, false, false , userGesture);704 newFrame->loader()->changeLocation(completedURL, referrer, false, false); 707 705 else if (!url.isEmpty()) 708 newFrame->navigationScheduler()->scheduleLocationChange(completedURL.string(), referrer, !lexicalFrame->script()->anyPageIsProcessingUserGesture(), false , userGesture);706 newFrame->navigationScheduler()->scheduleLocationChange(completedURL.string(), referrer, !lexicalFrame->script()->anyPageIsProcessingUserGesture(), false); 709 707 } 710 708 … … 764 762 const JSDOMWindow* targetedWindow = toJSDOMWindow(frame, currentWorld(exec)); 765 763 if (!completedURL.isEmpty() && (!protocolIsJavaScript(completedURL) || (targetedWindow && targetedWindow->allowsAccessFrom(exec)))) { 766 bool userGesture = processingUserGesture();767 768 764 // For whatever reason, Firefox uses the dynamicGlobalObject to 769 765 // determine the outgoingReferrer. We replicate that behavior … … 771 767 String referrer = dynamicFrame->loader()->outgoingReferrer(); 772 768 773 frame->navigationScheduler()->scheduleLocationChange(completedURL, referrer, !lexicalFrame->script()->anyPageIsProcessingUserGesture(), false , userGesture);769 frame->navigationScheduler()->scheduleLocationChange(completedURL, referrer, !lexicalFrame->script()->anyPageIsProcessingUserGesture(), false); 774 770 } 775 771 return toJS(exec, frame->domWindow()); -
trunk/WebCore/bindings/js/JSDocumentCustom.cpp
r69039 r69924 89 89 str = activeFrame->document()->completeURL(str).string(); 90 90 91 bool userGesture = ScriptController::processingUserGesture(); 92 frame->navigationScheduler()->scheduleLocationChange(str, activeFrame->loader()->outgoingReferrer(), !activeFrame->script()->anyPageIsProcessingUserGesture(), false, userGesture); 91 frame->navigationScheduler()->scheduleLocationChange(str, activeFrame->loader()->outgoingReferrer(), !activeFrame->script()->anyPageIsProcessingUserGesture(), false); 93 92 } 94 93 -
trunk/WebCore/bindings/js/ScriptController.h
r65082 r69924 99 99 100 100 // Returns true if argument is a JavaScript URL. 101 bool executeIfJavaScriptURL(const KURL&, bool userGesture = false,ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL = ReplaceDocumentIfJavaScriptURL);101 bool executeIfJavaScriptURL(const KURL&, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL = ReplaceDocumentIfJavaScriptURL); 102 102 103 103 // This function must be called from the main thread. It is safe to call it repeatedly. -
trunk/WebCore/bindings/v8/ScriptController.h
r68630 r69924 77 77 78 78 // Returns true if argument is a JavaScript URL. 79 bool executeIfJavaScriptURL(const KURL&, bool userGesture = false,ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL = ReplaceDocumentIfJavaScriptURL);79 bool executeIfJavaScriptURL(const KURL&, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL = ReplaceDocumentIfJavaScriptURL); 80 80 81 81 // This function must be called from the main thread. It is safe to call it repeatedly. -
trunk/WebCore/html/HTMLAnchorElement.cpp
r69749 r69924 39 39 #include "ResourceHandle.h" 40 40 #include "Settings.h" 41 #include "UserGestureIndicator.h" 41 42 42 43 namespace WebCore { … … 551 552 if (!frame) 552 553 return; 553 frame->loader()->urlSelected(document->completeURL(url), target, event, false, false, true, hideReferrer ? NoReferrer : SendReferrer); 554 } 555 556 } 554 // FIXME: This seems wrong. Why are we manufactuing a user gesture? 555 UserGestureIndicator indicator(DefinitelyProcessingUserGesture); 556 frame->loader()->urlSelected(document->completeURL(url), target, event, false, false, hideReferrer ? NoReferrer : SendReferrer); 557 } 558 559 } -
trunk/WebCore/inspector/InspectorController.cpp
r69853 r69924 94 94 #include "TextEncoding.h" 95 95 #include "TextIterator.h" 96 #include "UserGestureIndicator.h" 96 97 #include "WindowFeatures.h" 97 98 #include <wtf/text/StringConcatenate.h> … … 1989 1990 return; 1990 1991 1992 UserGestureIndicator indicator(DefinitelyProcessingUserGesture); 1991 1993 newFrame->loader()->setOpener(mainFrame); 1992 1994 newFrame->page()->setOpenedByDOM(); 1993 newFrame->loader()->changeLocation(newFrame->loader()->completeURL(url), "", false, false , true);1995 newFrame->loader()->changeLocation(newFrame->loader()->completeURL(url), "", false, false); 1994 1996 } 1995 1997 -
trunk/WebCore/loader/FrameLoader.cpp
r69798 r69924 265 265 } 266 266 267 void FrameLoader::changeLocation(const KURL& url, const String& referrer, bool lockHistory, bool lockBackForwardList, bool userGesture, boolrefresh)267 void FrameLoader::changeLocation(const KURL& url, const String& referrer, bool lockHistory, bool lockBackForwardList, bool refresh) 268 268 { 269 269 RefPtr<Frame> protect(m_frame); … … 271 271 ResourceRequest request(url, referrer, refresh ? ReloadIgnoringCacheData : UseProtocolCachePolicy); 272 272 273 urlSelected(request, "_self", 0, lockHistory, lockBackForwardList, userGesture,SendReferrer, ReplaceDocumentIfJavaScriptURL);274 } 275 276 void FrameLoader::urlSelected(const KURL& url, const String& passedTarget, PassRefPtr<Event> triggeringEvent, bool lockHistory, bool lockBackForwardList, bool userGesture,ReferrerPolicy referrerPolicy)277 { 278 urlSelected(ResourceRequest(url), passedTarget, triggeringEvent, lockHistory, lockBackForwardList, userGesture,referrerPolicy, DoNotReplaceDocumentIfJavaScriptURL);273 urlSelected(request, "_self", 0, lockHistory, lockBackForwardList, SendReferrer, ReplaceDocumentIfJavaScriptURL); 274 } 275 276 void FrameLoader::urlSelected(const KURL& url, const String& passedTarget, PassRefPtr<Event> triggeringEvent, bool lockHistory, bool lockBackForwardList, ReferrerPolicy referrerPolicy) 277 { 278 urlSelected(ResourceRequest(url), passedTarget, triggeringEvent, lockHistory, lockBackForwardList, referrerPolicy, DoNotReplaceDocumentIfJavaScriptURL); 279 279 } 280 280 281 281 // The shouldReplaceDocumentIfJavaScriptURL parameter will go away when the FIXME to eliminate the 282 282 // corresponding parameter from ScriptController::executeIfJavaScriptURL() is addressed. 283 void FrameLoader::urlSelected(const ResourceRequest& request, const String& passedTarget, PassRefPtr<Event> triggeringEvent, bool lockHistory, bool lockBackForwardList, bool userGesture,ReferrerPolicy referrerPolicy, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL)283 void FrameLoader::urlSelected(const ResourceRequest& request, const String& passedTarget, PassRefPtr<Event> triggeringEvent, bool lockHistory, bool lockBackForwardList, ReferrerPolicy referrerPolicy, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL) 284 284 { 285 285 ASSERT(!m_suppressOpenerInNewFrame); 286 286 287 if (m_frame->script()->executeIfJavaScriptURL(request.url(), userGesture,shouldReplaceDocumentIfJavaScriptURL))287 if (m_frame->script()->executeIfJavaScriptURL(request.url(), shouldReplaceDocumentIfJavaScriptURL)) 288 288 return; 289 289 … … 325 325 if (protocolIsJavaScript(submission->action())) { 326 326 m_isExecutingJavaScriptFormAction = true; 327 m_frame->script()->executeIfJavaScriptURL(submission->action(), false,DoNotReplaceDocumentIfJavaScriptURL);327 m_frame->script()->executeIfJavaScriptURL(submission->action(), DoNotReplaceDocumentIfJavaScriptURL); 328 328 m_isExecutingJavaScriptFormAction = false; 329 329 return; -
trunk/WebCore/loader/FrameLoader.h
r69688 r69924 212 212 void setDefersLoading(bool); 213 213 214 void changeLocation(const KURL&, const String& referrer, bool lockHistory = true, bool lockBackForwardList = true, bool userGesture = false, boolrefresh = false);215 void urlSelected(const KURL&, const String& target, PassRefPtr<Event>, bool lockHistory, bool lockBackForwardList, bool userGesture,ReferrerPolicy);214 void changeLocation(const KURL&, const String& referrer, bool lockHistory = true, bool lockBackForwardList = true, bool refresh = false); 215 void urlSelected(const KURL&, const String& target, PassRefPtr<Event>, bool lockHistory, bool lockBackForwardList, ReferrerPolicy); 216 216 217 217 void submitForm(PassRefPtr<FormSubmission>); … … 391 391 void dispatchDidCommitLoad(); 392 392 393 void urlSelected(const ResourceRequest&, const String& target, PassRefPtr<Event>, bool lockHistory, bool lockBackForwardList, bool userGesture,ReferrerPolicy, ShouldReplaceDocumentIfJavaScriptURL);393 void urlSelected(const ResourceRequest&, const String& target, PassRefPtr<Event>, bool lockHistory, bool lockBackForwardList, ReferrerPolicy, ShouldReplaceDocumentIfJavaScriptURL); 394 394 395 395 void loadWithDocumentLoader(DocumentLoader*, FrameLoadType, PassRefPtr<FormState>); // Calls continueLoadAfterNavigationPolicy -
trunk/WebCore/loader/NavigationScheduler.cpp
r69039 r69924 99 99 virtual void fire(Frame* frame) 100 100 { 101 frame->loader()->changeLocation(KURL(ParsedURLString, m_url), m_referrer, lockHistory(), lockBackForwardList(), wasUserGesture(), false); 101 UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture); 102 frame->loader()->changeLocation(KURL(ParsedURLString, m_url), m_referrer, lockHistory(), lockBackForwardList(), false); 102 103 } 103 104 … … 147 148 virtual void fire(Frame* frame) 148 149 { 149 frame->loader()->changeLocation(KURL(ParsedURLString, url()), referrer(), lockHistory(), lockBackForwardList(), wasUserGesture(), true); 150 UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture); 151 frame->loader()->changeLocation(KURL(ParsedURLString, url()), referrer(), lockHistory(), lockBackForwardList(), true); 150 152 } 151 153 }; … … 163 165 // Special case for go(0) from a frame -> reload only the frame 164 166 // To follow Firefox and IE's behavior, history reload can only navigate the self frame. 165 loader->urlSelected(loader->url(), "_self", 0, lockHistory(), lockBackForwardList(), wasUserGesture(),SendReferrer);167 loader->urlSelected(loader->url(), "_self", 0, lockHistory(), lockBackForwardList(), SendReferrer); 166 168 return; 167 169 } … … 293 295 KURL parsedURL(ParsedURLString, url); 294 296 if (parsedURL.hasFragmentIdentifier() && equalIgnoringFragmentIdentifier(loader->url(), parsedURL)) { 295 loader->changeLocation(loader->completeURL(url), referrer, lockHistory, lockBackForwardList , wasUserGesture);297 loader->changeLocation(loader->completeURL(url), referrer, lockHistory, lockBackForwardList); 296 298 return; 297 299 } -
trunk/WebKit/win/ChangeLog
r69900 r69924 1 2010-10-17 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Dimitri Glazkov. 4 5 FrameLoader doesn't need an explicit userGesture parameter 6 https://bugs.webkit.org/show_bug.cgi?id=47777 7 8 Update for the new API. 9 10 * WebCoreSupport/WebContextMenuClient.cpp: 11 (WebContextMenuClient::searchWithGoogle): 12 1 13 2010-10-15 Brian Weinstein <bweinstein@apple.com> 2 14 -
trunk/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp
r67122 r69924 27 27 #include "WebContextMenuClient.h" 28 28 29 #include "UserGestureIndicator.h" 29 30 #include "WebElementPropertyBag.h" 30 31 #include "WebLocalizableStrings.h" … … 141 142 url.append("&ie=UTF-8&oe=UTF-8"); 142 143 143 if (Page* page = frame->page()) 144 page->mainFrame()->loader()->urlSelected(KURL(ParsedURLString, url), String(), 0, false, false, true, SendReferrer); 144 if (Page* page = frame->page()) { 145 UserGestureIndicator indicator(DefinitelyProcessingUserGesture); 146 page->mainFrame()->loader()->urlSelected(KURL(ParsedURLString, url), String(), 0, false, false, SendReferrer); 147 } 145 148 } 146 149
Note: See TracChangeset
for help on using the changeset viewer.