diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-13 21:50:11 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-13 21:50:11 +0000 |
commit | 80ba44ab061af8c4177dffc5f57ccf153293e95e (patch) | |
tree | f35fbf4d287e60a256e059dbd88eaad8585812e3 /webkit | |
parent | 13824be1b876ece8461e3179cf8ba2ad9faca19d (diff) | |
download | chromium_src-80ba44ab061af8c4177dffc5f57ccf153293e95e.zip chromium_src-80ba44ab061af8c4177dffc5f57ccf153293e95e.tar.gz chromium_src-80ba44ab061af8c4177dffc5f57ccf153293e95e.tar.bz2 |
Fix assignment of a javascript: URL to window.location.href
Covered by LayoutTests/fast/loader/javascript-url-encoding-2.html, which times out without this fix.
My fix is to just replicate what is done in JSLocationCustom.cpp.
R=fqian
Review URL: http://codereview.chromium.org/10700
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5380 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/port/page/Location.cpp | 24 | ||||
-rw-r--r-- | webkit/tools/layout_tests/test_lists/win/tests_fixable.txt | 1 |
2 files changed, 8 insertions, 17 deletions
diff --git a/webkit/port/page/Location.cpp b/webkit/port/page/Location.cpp index 6757b78..d17e5d9 100644 --- a/webkit/port/page/Location.cpp +++ b/webkit/port/page/Location.cpp @@ -147,7 +147,10 @@ static void navigateIfAllowed(Frame* frame, const KURL& url, bool lock_history) return; Frame* activeFrame = ScriptController::retrieveActiveFrame(); - if (activeFrame && !url.protocolIs("javascript")) { + if (!activeFrame) + return; + + if (!url.protocolIs("javascript") || ScriptController::isSafeScript(frame)) { bool user_gesture = activeFrame->script()->processingUserGesture(); frame->loader()->scheduleLocationChange(url.string(), activeFrame->loader()->outgoingReferrer(), lock_history, user_gesture); @@ -206,11 +209,7 @@ void Location::setHref(const String& value) { if (!active_frame->loader()->shouldAllowNavigation(m_frame)) return; - // Allows cross domain access except javascript url. - if (!parseURL(value).startsWith("javascript:", false) || - ScriptController::isSafeScript(m_frame)) { - navigateIfAllowed(m_frame, active_frame->loader()->completeURL(value), false); - } + navigateIfAllowed(m_frame, active_frame->loader()->completeURL(value), false); } void Location::setPathname(const String& pathname) { @@ -280,11 +279,7 @@ void Location::replace(const String& url) { if (!active_frame->loader()->shouldAllowNavigation(m_frame)) return; - // Allows cross domain access except javascript url. - if (!parseURL(url).startsWith("javascript:", false) || - ScriptController::isSafeScript(m_frame)) { - navigateIfAllowed(m_frame, active_frame->loader()->completeURL(url), true); - } + navigateIfAllowed(m_frame, active_frame->loader()->completeURL(url), true); } void Location::assign(const String& url) { @@ -298,12 +293,9 @@ void Location::assign(const String& url) { if (!active_frame->loader()->shouldAllowNavigation(m_frame)) return; - if (!parseURL(url).startsWith("javascript:", false) || - ScriptController::isSafeScript(m_frame)) { - navigateIfAllowed(m_frame, active_frame->loader()->completeURL(url), false); - } + navigateIfAllowed(m_frame, active_frame->loader()->completeURL(url), false); } -#endif // USE(V8) +#endif // USE(V8) } // namespace WebCore diff --git a/webkit/tools/layout_tests/test_lists/win/tests_fixable.txt b/webkit/tools/layout_tests/test_lists/win/tests_fixable.txt index e3ffc73..99c0ec8 100644 --- a/webkit/tools/layout_tests/test_lists/win/tests_fixable.txt +++ b/webkit/tools/layout_tests/test_lists/win/tests_fixable.txt @@ -1201,7 +1201,6 @@ V8 # LayoutTests/http/tests/security/originHeader/origin-header-for-data.html = V8 # LayoutTests/http/tests/security/originHeader/origin-header-for-get.html = FAIL | PASS // MERGE 38097:38305 REGRESSIONS -V8 # LayoutTests/fast/loader/javascript-url-encoding-2.html = TIMEOUT V8 # LayoutTests/editing/pasteboard/merge-end-blockquote.html = FAIL V8 # LayoutTests/editing/pasteboard/paste-blockquote-into-blockquote-2.html = FAIL V8 # LayoutTests/editing/pasteboard/paste-blockquote-into-blockquote.html = FAIL |