Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: Source/WebKit/chromium/src/WebFrameImpl.cpp

Issue 8223012: Merge 97087 - ScriptController::executeIfJavaScriptURL gets confused by synchronous frame loads (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/874/
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/WebCore/loader/DocumentWriter.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 2241 matching lines...) Expand 10 before | Expand all | Expand 10 after
2252 // Unfortunately, we cannot just use that method since it is private, and 2252 // Unfortunately, we cannot just use that method since it is private, and
2253 // it also doesn't quite behave as we require it to for bookmarklets. The 2253 // it also doesn't quite behave as we require it to for bookmarklets. The
2254 // key difference is that we need to suppress loading the string result 2254 // key difference is that we need to suppress loading the string result
2255 // from evaluating the JS URL if executing the JS URL resulted in a 2255 // from evaluating the JS URL if executing the JS URL resulted in a
2256 // location change. We also allow a JS URL to be loaded even if scripts on 2256 // location change. We also allow a JS URL to be loaded even if scripts on
2257 // the page are otherwise disabled. 2257 // the page are otherwise disabled.
2258 2258
2259 if (!m_frame->document() || !m_frame->page()) 2259 if (!m_frame->document() || !m_frame->page())
2260 return; 2260 return;
2261 2261
2262 RefPtr<Document> ownerDocument(m_frame->document());
2263
2262 // Protect privileged pages against bookmarklets and other javascript manipu lations. 2264 // Protect privileged pages against bookmarklets and other javascript manipu lations.
2263 if (SchemeRegistry::shouldTreatURLSchemeAsNotAllowingJavascriptURLs(m_frame- >document()->url().protocol())) 2265 if (SchemeRegistry::shouldTreatURLSchemeAsNotAllowingJavascriptURLs(m_frame- >document()->url().protocol()))
2264 return; 2266 return;
2265 2267
2266 String script = decodeURLEscapeSequences(url.string().substring(strlen("java script:"))); 2268 String script = decodeURLEscapeSequences(url.string().substring(strlen("java script:")));
2267 ScriptValue result = m_frame->script()->executeScript(script, true); 2269 ScriptValue result = m_frame->script()->executeScript(script, true);
2268 2270
2269 String scriptResult; 2271 String scriptResult;
2270 if (!result.getString(scriptResult)) 2272 if (!result.getString(scriptResult))
2271 return; 2273 return;
2272 2274
2273 if (!m_frame->navigationScheduler()->locationChangePending()) 2275 if (!m_frame->navigationScheduler()->locationChangePending())
2274 m_frame->document()->loader()->writer()->replaceDocument(scriptResult); 2276 m_frame->document()->loader()->writer()->replaceDocument(scriptResult, o wnerDocument.get());
2275 } 2277 }
2276 2278
2277 } // namespace WebKit 2279 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/WebCore/loader/DocumentWriter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698