Changeset 141909 in webkit
- Timestamp:
- Feb 5, 2013 11:47:33 AM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r141905 r141909 1 2013-02-05 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r141905. 4 http://trac.webkit.org/changeset/141905 5 https://bugs.webkit.org/show_bug.cgi?id=108963 6 7 "Broke mac build" (Requested by tonyg-cr on #webkit). 8 9 * wtf/text/CString.cpp: 10 * wtf/text/CString.h: 11 * wtf/text/WTFString.cpp: 12 * wtf/text/WTFString.h: 13 (String): 14 * wtf/url/api/ParsedURL.h: 15 (ParsedURL): 16 * wtf/url/api/URLString.h: 17 1 18 2013-02-05 Tony Gentilcore <tonyg@chromium.org> 2 19 -
trunk/Source/WTF/wtf/text/CString.cpp
r141905 r141909 100 100 } 101 101 102 bool CString::isSafeToSendToAnotherThread() const103 {104 return !m_buffer || m_buffer->hasOneRef();105 }106 107 102 bool operator==(const CString& a, const CString& b) 108 103 { -
trunk/Source/WTF/wtf/text/CString.h
r141905 r141909 73 73 74 74 bool isNull() const { return !m_buffer; } 75 bool isSafeToSendToAnotherThread() const;76 75 77 76 CStringBuffer* buffer() const { return m_buffer.get(); } -
trunk/Source/WTF/wtf/text/WTFString.cpp
r141905 r141909 662 662 } 663 663 664 bool String::isSafeToSendToAnotherThread() const665 {666 if (!impl())667 return true;668 if (impl()->hasOneRef())669 return true;670 if (isEmpty())671 return true;672 return false;673 }674 675 664 void String::split(const String& separator, bool allowEmptyEntries, Vector<String>& result) const 676 665 { -
trunk/Source/WTF/wtf/text/WTFString.h
r141905 r141909 395 395 396 396 WTF_EXPORT_STRING_API String isolatedCopy() const; 397 bool isSafeToSendToAnotherThread() const;398 397 399 398 // Prevent Strings from being implicitly convertable to bool as it will be ambiguous on any platform that -
trunk/Source/WTF/wtf/url/api/ParsedURL.h
r141905 r141909 50 50 51 51 WTF_EXPORT_PRIVATE ParsedURL isolatedCopy() const; 52 bool isSafeToSendToAnotherThread() const { return m_spec.isSafeToSendToAnotherThread(); }53 52 54 53 bool isValid() const { return !m_spec.string().isNull(); } -
trunk/Source/WTF/wtf/url/api/URLString.h
r141905 r141909 40 40 41 41 const String& string() const { return m_string;} 42 bool isSafeToSendToAnotherThread() const { return m_string.isSafeToSendToAnotherThread(); }43 42 44 43 #ifndef NDEBUG -
trunk/Source/WebCore/ChangeLog
r141908 r141909 1 2013-02-05 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r141905. 4 http://trac.webkit.org/changeset/141905 5 https://bugs.webkit.org/show_bug.cgi?id=108963 6 7 "Broke mac build" (Requested by tonyg-cr on #webkit). 8 9 * html/parser/BackgroundHTMLParser.cpp: 10 (WebCore::BackgroundHTMLParser::pumpTokenizer): 11 * html/parser/CompactHTMLToken.cpp: 12 (SameSizeAsCompactHTMLToken): 13 (WebCore::isStringSafeToSendToAnotherThread): 14 (WebCore::CompactHTMLToken::isSafeToSendToAnotherThread): 15 * html/parser/CompactHTMLToken.h: 16 (WebCore): 17 (CompactHTMLToken): 18 * html/parser/HTMLDocumentParser.cpp: 19 (WebCore::HTMLDocumentParser::processParsedChunkFromBackgroundParser): 20 (WebCore::HTMLDocumentParser::pumpTokenizer): 21 * html/parser/XSSAuditor.cpp: 22 (WebCore::XSSAuditor::filterToken): 23 * html/parser/XSSAuditor.h: 24 (WebCore): 25 (XSSAuditor): 26 * html/parser/XSSAuditorDelegate.cpp: 27 (WebCore::XSSAuditorDelegate::didBlockScript): 28 * html/parser/XSSAuditorDelegate.h: 29 (WebCore::DidBlockScriptRequest::create): 30 (WebCore::DidBlockScriptRequest::DidBlockScriptRequest): 31 (XSSAuditorDelegate): 32 * platform/KURL.cpp: 33 * platform/KURL.h: 34 (KURL): 35 * platform/KURLGoogle.cpp: 36 (WebCore::KURLGooglePrivate::reportMemoryUsage): 37 * platform/KURLGooglePrivate.h: 38 (KURLGooglePrivate): 39 * platform/KURLWTFURLImpl.h: 40 (WebCore::KURLWTFURLImpl::reportMemoryUsage): 41 1 42 2013-02-05 Dominik Röttsches <dominik.rottsches@intel.com> 2 43 -
trunk/Source/WebCore/html/parser/BackgroundHTMLParser.cpp
r141905 r141909 154 154 { 155 155 while (m_tokenizer->nextToken(m_input.current(), *m_token.get())) { 156 // FIXME: Call m_xssAuditor.filterToken(m_token) and put resulting XSSInfointo CompactHTMLToken.156 // FIXME: Call m_xssAuditor.filterToken(m_token) and put resulting DidBlockScriptRequest into CompactHTMLToken. 157 157 m_pendingTokens->append(CompactHTMLToken(m_token.get(), TextPosition(m_input.current().currentLine(), m_input.current().currentColumn()))); 158 158 m_token->clear(); -
trunk/Source/WebCore/html/parser/CompactHTMLToken.cpp
r141905 r141909 31 31 32 32 #include "HTMLToken.h" 33 #include "XSSAuditorDelegate.h"34 33 35 34 namespace WebCore { … … 40 39 Vector<CompactAttribute> vector; 41 40 TextPosition textPosition; 42 OwnPtr<XSSInfo> xssInfo;43 41 }; 44 42 … … 89 87 } 90 88 91 CompactHTMLToken::CompactHTMLToken(const CompactHTMLToken& other) 92 : m_type(other.type()) 93 , m_isAll8BitData(other.isAll8BitData()) 94 , m_doctypeForcesQuirks(other.doctypeForcesQuirks()) 95 , m_textPosition(other.textPosition()) 89 static bool isStringSafeToSendToAnotherThread(const String& string) 96 90 { 97 if (other.xssInfo()) 98 m_xssInfo = adoptPtr(new XSSInfo(*other.xssInfo())); 91 StringImpl* impl = string.impl(); 92 if (!impl) 93 return true; 94 if (impl->hasOneRef()) 95 return true; 96 if (string.isEmpty()) 97 return true; 98 return false; 99 99 } 100 100 … … 102 102 { 103 103 for (Vector<CompactAttribute>::const_iterator it = m_attributes.begin(); it != m_attributes.end(); ++it) { 104 if (!i t->name().isSafeToSendToAnotherThread())104 if (!isStringSafeToSendToAnotherThread(it->name())) 105 105 return false; 106 if (!i t->value().isSafeToSendToAnotherThread())106 if (!isStringSafeToSendToAnotherThread(it->value())) 107 107 return false; 108 108 } 109 if (m_xssInfo && !m_xssInfo->isSafeToSendToAnotherThread()) 110 return false; 111 return m_data.isSafeToSendToAnotherThread(); 112 } 113 114 XSSInfo* CompactHTMLToken::xssInfo() const 115 { 116 return m_xssInfo.get(); 117 } 118 119 void CompactHTMLToken::setXSSInfo(PassOwnPtr<XSSInfo> xssInfo) 120 { 121 m_xssInfo = xssInfo; 109 return isStringSafeToSendToAnotherThread(m_data); 122 110 } 123 111 -
trunk/Source/WebCore/html/parser/CompactHTMLToken.h
r141905 r141909 30 30 31 31 #include "HTMLTokenTypes.h" 32 #include <wtf/OwnPtr.h>33 #include <wtf/PassOwnPtr.h>34 32 #include <wtf/RefCounted.h> 35 33 #include <wtf/RefPtr.h> … … 41 39 42 40 class HTMLToken; 43 class XSSInfo;44 41 45 42 class CompactAttribute { … … 62 59 public: 63 60 CompactHTMLToken(const HTMLToken*, const TextPosition&); 64 CompactHTMLToken(const CompactHTMLToken&);65 61 66 62 bool isSafeToSendToAnotherThread() const; … … 78 74 const String& systemIdentifier() const { return m_attributes[0].value(); } 79 75 bool doctypeForcesQuirks() const { return m_doctypeForcesQuirks; } 80 XSSInfo* xssInfo() const;81 void setXSSInfo(PassOwnPtr<XSSInfo>);82 76 83 77 private: … … 90 84 Vector<CompactAttribute> m_attributes; 91 85 TextPosition m_textPosition; 92 OwnPtr<XSSInfo> m_xssInfo;93 86 }; 94 87 … … 97 90 } 98 91 99 namespace WTF {100 // This is required for a struct with OwnPtr. We know CompactHTMLToken is simple enough that101 // initializing to 0 and moving with memcpy (and then not destructing the original) will work.102 template<> struct VectorTraits<WebCore::CompactHTMLToken> : SimpleClassVectorTraits { };103 }104 105 92 #endif // ENABLE(THREADED_HTML_PARSER) 106 93 -
trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp
r141905 r141909 303 303 ASSERT(shouldUseThreading()); 304 304 305 // This methodcan cause this parser to be detached from the Document,305 // didReceiveTokensFromBackgroundParser can cause this parser to be detached from the Document, 306 306 // but we need to ensure it isn't deleted yet. 307 307 RefPtr<HTMLDocumentParser> protect(this); … … 317 317 ASSERT(!isWaitingForScripts()); 318 318 319 // FIXME: Call m_xssAuditorDelegate.didBlockScript() with DidBlockScriptRequest from the CompactHTMLToken. 319 320 m_textPosition = it->textPosition(); 320 321 if (XSSInfo* xssInfo = it->xssInfo())322 m_xssAuditorDelegate.didBlockScript(*xssInfo);323 321 constructTreeFromCompactHTMLToken(*it); 324 322 … … 381 379 // We do not XSS filter innerHTML, which means we (intentionally) fail 382 380 // http/tests/security/xssAuditor/dom-write-innerHTML.html 383 OwnPtr< XSSInfo> xssInfo= m_xssAuditor.filterToken(FilterTokenRequest(token(), m_sourceTracker, document()->decoder()));384 if ( xssInfo)385 m_xssAuditorDelegate.didBlockScript( *xssInfo);381 OwnPtr<DidBlockScriptRequest> request = m_xssAuditor.filterToken(FilterTokenRequest(token(), m_sourceTracker, document()->decoder())); 382 if (request) 383 m_xssAuditorDelegate.didBlockScript(request.release()); 386 384 } 387 385 -
trunk/Source/WebCore/html/parser/XSSAuditor.cpp
r141905 r141909 279 279 } 280 280 281 PassOwnPtr< XSSInfo> XSSAuditor::filterToken(const FilterTokenRequest& request)281 PassOwnPtr<DidBlockScriptRequest> XSSAuditor::filterToken(const FilterTokenRequest& request) 282 282 { 283 283 ASSERT(m_state == Initialized); … … 297 297 if (didBlockScript) { 298 298 bool didBlockEntirePage = (m_xssProtection == XSSProtectionBlockEnabled); 299 OwnPtr< XSSInfo> xssInfo = XSSInfo::create(m_reportURL, m_originalURL, m_originalHTTPBody, didBlockEntirePage);299 OwnPtr<DidBlockScriptRequest> didBlockScriptRequest = DidBlockScriptRequest::create(m_reportURL, m_originalURL, m_originalHTTPBody, didBlockEntirePage); 300 300 if (!m_reportURL.isEmpty()) { 301 301 m_reportURL = KURL(); … … 303 303 m_originalHTTPBody = String(); 304 304 } 305 return xssInfo.release();305 return didBlockScriptRequest.release(); 306 306 } 307 307 return nullptr; -
trunk/Source/WebCore/html/parser/XSSAuditor.h
r141905 r141909 34 34 namespace WebCore { 35 35 36 class DidBlockScriptRequest; 36 37 class Document; 37 38 class HTMLDocumentParser; 38 39 class HTMLSourceTracker; 39 40 class TextResourceDecoder; 40 class XSSInfo;41 41 42 42 struct FilterTokenRequest { … … 58 58 59 59 void init(Document*); 60 PassOwnPtr< XSSInfo> filterToken(const FilterTokenRequest&);60 PassOwnPtr<DidBlockScriptRequest> filterToken(const FilterTokenRequest&); 61 61 62 62 private: -
trunk/Source/WebCore/html/parser/XSSAuditorDelegate.cpp
r141905 r141909 33 33 #include "Frame.h" 34 34 #include "FrameLoaderClient.h" 35 #include "HTMLParserIdioms.h"36 35 #include "InspectorValues.h" 37 36 #include "PingLoader.h" … … 39 38 40 39 namespace WebCore { 41 42 bool XSSInfo::isSafeToSendToAnotherThread() const43 {44 return m_reportURL.isSafeToSendToAnotherThread()45 && m_originalURL.isSafeToSendToAnotherThread()46 && m_originalHTTPBody.isSafeToSendToAnotherThread();47 }48 40 49 41 XSSAuditorDelegate::XSSAuditorDelegate(Document* document) … … 55 47 } 56 48 57 void XSSAuditorDelegate::didBlockScript( const XSSInfo& xssInfo)49 void XSSAuditorDelegate::didBlockScript(PassOwnPtr<DidBlockScriptRequest> request) 58 50 { 59 51 ASSERT(isMainThread()); … … 63 55 m_document->addConsoleMessage(JSMessageSource, ErrorMessageLevel, consoleMessage); 64 56 65 if ( xssInfo.m_didBlockEntirePage)57 if (request->m_didBlockEntirePage) 66 58 m_document->frame()->loader()->stopAllLoaders(); 67 59 68 60 if (!m_didNotifyClient) { 69 m_document->frame()->loader()->client()->didDetectXSS(m_document->url(), xssInfo.m_didBlockEntirePage);61 m_document->frame()->loader()->client()->didDetectXSS(m_document->url(), request->m_didBlockEntirePage); 70 62 m_didNotifyClient = true; 71 63 } 72 64 73 if (! xssInfo.m_reportURL.isEmpty()) {65 if (!request->m_reportURL.isEmpty()) { 74 66 RefPtr<InspectorObject> reportDetails = InspectorObject::create(); 75 reportDetails->setString("request-url", xssInfo.m_originalURL);76 reportDetails->setString("request-body", xssInfo.m_originalHTTPBody);67 reportDetails->setString("request-url", request->m_originalURL); 68 reportDetails->setString("request-body", request->m_originalHTTPBody); 77 69 78 70 RefPtr<InspectorObject> reportObject = InspectorObject::create(); … … 80 72 81 73 RefPtr<FormData> report = FormData::create(reportObject->toJSONString().utf8().data()); 82 PingLoader::sendViolationReport(m_document->frame(), xssInfo.m_reportURL, report);74 PingLoader::sendViolationReport(m_document->frame(), request->m_reportURL, report); 83 75 } 84 76 85 if ( xssInfo.m_didBlockEntirePage)77 if (request->m_didBlockEntirePage) 86 78 m_document->frame()->navigationScheduler()->scheduleLocationChange(m_document->securityOrigin(), blankURL(), String()); 87 79 } -
trunk/Source/WebCore/html/parser/XSSAuditorDelegate.h
r141905 r141909 35 35 class Document; 36 36 37 class XSSInfo{37 class DidBlockScriptRequest { 38 38 public: 39 static PassOwnPtr< XSSInfo> create(const KURL& reportURL, const String& originalURL, const String& originalHTTPBody, bool didBlockEntirePage)39 static PassOwnPtr<DidBlockScriptRequest> create(const KURL& reportURL, const String& originalURL, const String& originalHTTPBody, bool didBlockEntirePage) 40 40 { 41 return adoptPtr(new XSSInfo(reportURL, originalURL, originalHTTPBody, didBlockEntirePage));41 return adoptPtr(new DidBlockScriptRequest(reportURL, originalURL, originalHTTPBody, didBlockEntirePage)); 42 42 } 43 44 bool isSafeToSendToAnotherThread() const;45 43 46 44 KURL m_reportURL; … … 50 48 51 49 private: 52 XSSInfo(const KURL& reportURL, const String& originalURL, const String& originalHTTPBody, bool didBlockEntirePage)50 DidBlockScriptRequest(const KURL& reportURL, const String& originalURL, const String& originalHTTPBody, bool didBlockEntirePage) 53 51 : m_reportURL(reportURL) 54 52 , m_originalURL(originalURL) … … 63 61 explicit XSSAuditorDelegate(Document*); 64 62 65 void didBlockScript( const XSSInfo&);63 void didBlockScript(PassOwnPtr<DidBlockScriptRequest>); 66 64 67 65 private: -
trunk/Source/WebCore/platform/KURL.cpp
r141905 r141909 1936 1936 } 1937 1937 1938 bool KURL::isSafeToSendToAnotherThread() const 1939 { 1940 #if USE(GOOGLEURL) 1941 return m_url.isSafeToSendToAnotherThread(); 1942 #elif USE(WTFURL) 1943 return m_urlImpl.isSafeToSendToAnotherThread(); 1944 #else // !USE(GOOGLEURL) 1945 return m_string.isSafeToSendToAnotherThread(); 1946 #endif 1947 } 1948 1949 } 1938 } -
trunk/Source/WebCore/platform/KURL.h
r141905 r141909 228 228 229 229 void reportMemoryUsage(MemoryObjectInfo*) const; 230 bool isSafeToSendToAnotherThread() const;231 230 232 231 private: -
trunk/Source/WebCore/platform/KURLGoogle.cpp
r141905 r141909 400 400 info.addMember(m_parsed, "parsed"); 401 401 } 402 403 bool KURLGooglePrivate::isSafeToSendToAnotherThread() const404 {405 return m_string.isSafeToSendToAnotherThread()406 && m_utf8.isSafeToSendToAnotherThread()407 && (!m_innerURL || m_innerURL->isSafeToSendToAnotherThread());408 }409 410 402 // KURL ------------------------------------------------------------------------ 411 403 -
trunk/Source/WebCore/platform/KURLGooglePrivate.h
r141905 r141909 102 102 103 103 void reportMemoryUsage(MemoryObjectInfo*) const; 104 bool isSafeToSendToAnotherThread() const;105 104 106 105 private: -
trunk/Source/WebCore/platform/KURLWTFURLImpl.h
r141905 r141909 50 50 info.addMember(m_invalidUrlString, "invalidUrlString"); 51 51 } 52 bool isSafeToSendToAnotherThread() const53 {54 return m_invalidUrlString.isSafeToSendToAnotherThread()55 && m_parsedURL.isSafeToSendToAnotherThread();56 }57 52 PassRefPtr<KURLWTFURLImpl> copy() const; 58 53 };
Note: See TracChangeset
for help on using the changeset viewer.