Changeset 97270 in webkit
- Timestamp:
- Oct 12, 2011, 10:05:41 AM (15 years ago)
- Location:
- trunk/Source
- Files:
-
- 6 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/bindings/ScriptControllerBase.cpp (modified) (2 diffs)
-
WebCore/loader/DocumentWriter.cpp (modified) (3 diffs)
-
WebCore/loader/DocumentWriter.h (modified) (1 diff)
-
WebKit/chromium/ChangeLog (modified) (1 diff)
-
WebKit/chromium/src/WebFrameImpl.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r97267 r97270 1 2011-10-12 Sergey Glazunov <serg.glazunov@gmail.com> 2 3 ScriptController::executeIfJavaScriptURL gets confused by synchronous frame loads 4 https://bugs.webkit.org/show_bug.cgi?id=69777 5 6 Reviewed by Adam Barth. 7 8 Test: http/tests/security/xss-DENIED-synchronous-frame-load-in-javascript-url.html 9 10 * bindings/ScriptControllerBase.cpp: 11 (WebCore::ScriptController::executeIfJavaScriptURL): 12 * loader/DocumentWriter.cpp: 13 (WebCore::DocumentWriter::replaceDocument): 14 (WebCore::DocumentWriter::begin): 15 * loader/DocumentWriter.h: 16 1 17 2011-10-12 Vsevolod Vlasov <vsevik@chromium.org> 2 18 -
trunk/Source/WebCore/bindings/ScriptControllerBase.cpp
r97110 r97270 94 94 // destroy the frame. 95 95 RefPtr<Frame> protector(m_frame); 96 RefPtr<Document> ownerDocument(m_frame->document()); 96 97 97 98 const int javascriptSchemeLength = sizeof("javascript:") - 1; … … 126 127 // so protect it with a RefPtr. 127 128 if (RefPtr<DocumentLoader> loader = m_frame->document()->loader()) 128 loader->writer()->replaceDocument(scriptResult );129 loader->writer()->replaceDocument(scriptResult, ownerDocument.get()); 129 130 } 130 131 return true; -
trunk/Source/WebCore/loader/DocumentWriter.cpp
r97110 r97270 65 65 // and always contains the result of evaluating a javascript: url. 66 66 // This is the <iframe src="javascript:'html'"> case. 67 void DocumentWriter::replaceDocument(const String& source )67 void DocumentWriter::replaceDocument(const String& source, Document* ownerDocument) 68 68 { 69 69 m_frame->loader()->stopAllLoaders(); 70 begin(m_frame->document()->url(), true, InheritSecurityOrigin);70 begin(m_frame->document()->url(), true, ownerDocument); 71 71 72 72 if (!source.isNull()) { … … 107 107 } 108 108 109 void DocumentWriter::begin(const KURL& urlReference, bool dispatch, SecurityOriginSource originSource) 110 { 111 RefPtr<Document> oldDocument = m_frame->document(); 112 109 void DocumentWriter::begin(const KURL& urlReference, bool dispatch, Document* ownerDocument) 110 { 113 111 // We grab a local copy of the URL because it's easy for callers to supply 114 112 // a URL that will be deallocated during the execution of this function. … … 138 136 if (m_decoder) 139 137 document->setDecoder(m_decoder.get()); 140 if (o riginSource == InheritSecurityOrigin) {141 document->setCookieURL(o ldDocument->cookieURL());142 document->setSecurityOrigin(o ldDocument->securityOrigin());138 if (ownerDocument) { 139 document->setCookieURL(ownerDocument->cookieURL()); 140 document->setSecurityOrigin(ownerDocument->securityOrigin()); 143 141 } 144 142 -
trunk/Source/WebCore/loader/DocumentWriter.h
r97110 r97270 48 48 // This is only called by ScriptController::executeIfJavaScriptURL 49 49 // and always contains the result of evaluating a javascript: url. 50 void replaceDocument(const String&); 51 52 enum SecurityOriginSource { CreateNewSecurityOrigin, InheritSecurityOrigin }; 50 void replaceDocument(const String&, Document* ownerDocument); 53 51 54 52 void begin(); 55 void begin(const KURL&, bool dispatchWindowObjectAvailable = true, SecurityOriginSource = CreateNewSecurityOrigin);53 void begin(const KURL&, bool dispatchWindowObjectAvailable = true, Document* ownerDocument = 0); 56 54 void addData(const char* bytes, size_t length); 57 55 void end(); -
trunk/Source/WebKit/chromium/ChangeLog
r97266 r97270 1 2011-10-12 Sergey Glazunov <serg.glazunov@gmail.com> 2 3 ScriptController::executeIfJavaScriptURL gets confused by synchronous frame loads 4 https://bugs.webkit.org/show_bug.cgi?id=69777 5 6 Reviewed by Adam Barth. 7 8 * src/WebFrameImpl.cpp: 9 (WebKit::WebFrameImpl::loadJavaScriptURL): 10 1 11 2011-10-12 Yury Semikhatsky <yurys@chromium.org> 2 12 -
trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp
r97257 r97270 2274 2274 return; 2275 2275 2276 RefPtr<Document> ownerDocument(m_frame->document()); 2277 2276 2278 // Protect privileged pages against bookmarklets and other javascript manipulations. 2277 2279 if (SchemeRegistry::shouldTreatURLSchemeAsNotAllowingJavascriptURLs(m_frame->document()->url().protocol())) … … 2286 2288 2287 2289 if (!m_frame->navigationScheduler()->locationChangePending()) 2288 m_frame->document()->loader()->writer()->replaceDocument(scriptResult );2290 m_frame->document()->loader()->writer()->replaceDocument(scriptResult, ownerDocument.get()); 2289 2291 } 2290 2292
Note:
See TracChangeset
for help on using the changeset viewer.