Changeset 141909 in webkit


Ignore:
Timestamp:
Feb 5, 2013 11:47:33 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, rolling out r141905.
http://trac.webkit.org/changeset/141905
https://bugs.webkit.org/show_bug.cgi?id=108963

"Broke mac build" (Requested by tonyg-cr on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2013-02-05

Source/WebCore:

  • html/parser/BackgroundHTMLParser.cpp:

(WebCore::BackgroundHTMLParser::pumpTokenizer):

  • html/parser/CompactHTMLToken.cpp:

(SameSizeAsCompactHTMLToken):
(WebCore::isStringSafeToSendToAnotherThread):
(WebCore::CompactHTMLToken::isSafeToSendToAnotherThread):

  • html/parser/CompactHTMLToken.h:

(WebCore):
(CompactHTMLToken):

  • html/parser/HTMLDocumentParser.cpp:

(WebCore::HTMLDocumentParser::processParsedChunkFromBackgroundParser):
(WebCore::HTMLDocumentParser::pumpTokenizer):

  • html/parser/XSSAuditor.cpp:

(WebCore::XSSAuditor::filterToken):

  • html/parser/XSSAuditor.h:

(WebCore):
(XSSAuditor):

  • html/parser/XSSAuditorDelegate.cpp:

(WebCore::XSSAuditorDelegate::didBlockScript):

  • html/parser/XSSAuditorDelegate.h:

(WebCore::DidBlockScriptRequest::create):
(WebCore::DidBlockScriptRequest::DidBlockScriptRequest):
(XSSAuditorDelegate):

  • platform/KURL.cpp:
  • platform/KURL.h:

(KURL):

  • platform/KURLGoogle.cpp:

(WebCore::KURLGooglePrivate::reportMemoryUsage):

  • platform/KURLGooglePrivate.h:

(KURLGooglePrivate):

  • platform/KURLWTFURLImpl.h:

(WebCore::KURLWTFURLImpl::reportMemoryUsage):

Source/WTF:

  • wtf/text/CString.cpp:
  • wtf/text/CString.h:
  • wtf/text/WTFString.cpp:
  • wtf/text/WTFString.h:

(String):

  • wtf/url/api/ParsedURL.h:

(ParsedURL):

  • wtf/url/api/URLString.h:
Location:
trunk/Source
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r141905 r141909  
     12013-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
    1182013-02-05  Tony Gentilcore  <tonyg@chromium.org>
    219
  • trunk/Source/WTF/wtf/text/CString.cpp

    r141905 r141909  
    100100}
    101101
    102 bool CString::isSafeToSendToAnotherThread() const
    103 {
    104     return !m_buffer || m_buffer->hasOneRef();
    105 }
    106 
    107102bool operator==(const CString& a, const CString& b)
    108103{
  • trunk/Source/WTF/wtf/text/CString.h

    r141905 r141909  
    7373
    7474    bool isNull() const { return !m_buffer; }
    75     bool isSafeToSendToAnotherThread() const;
    7675
    7776    CStringBuffer* buffer() const { return m_buffer.get(); }
  • trunk/Source/WTF/wtf/text/WTFString.cpp

    r141905 r141909  
    662662}
    663663
    664 bool String::isSafeToSendToAnotherThread() const
    665 {
    666     if (!impl())
    667         return true;
    668     if (impl()->hasOneRef())
    669         return true;
    670     if (isEmpty())
    671         return true;
    672     return false;
    673 }
    674 
    675664void String::split(const String& separator, bool allowEmptyEntries, Vector<String>& result) const
    676665{
  • trunk/Source/WTF/wtf/text/WTFString.h

    r141905 r141909  
    395395
    396396    WTF_EXPORT_STRING_API String isolatedCopy() const;
    397     bool isSafeToSendToAnotherThread() const;
    398397
    399398    // 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  
    5050
    5151    WTF_EXPORT_PRIVATE ParsedURL isolatedCopy() const;
    52     bool isSafeToSendToAnotherThread() const { return m_spec.isSafeToSendToAnotherThread(); }
    5352
    5453    bool isValid() const { return !m_spec.string().isNull(); }
  • trunk/Source/WTF/wtf/url/api/URLString.h

    r141905 r141909  
    4040
    4141    const String& string() const { return m_string;}
    42     bool isSafeToSendToAnotherThread() const { return m_string.isSafeToSendToAnotherThread(); }
    4342
    4443#ifndef NDEBUG
  • trunk/Source/WebCore/ChangeLog

    r141908 r141909  
     12013-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
    1422013-02-05  Dominik Röttsches  <dominik.rottsches@intel.com>
    243
  • trunk/Source/WebCore/html/parser/BackgroundHTMLParser.cpp

    r141905 r141909  
    154154{
    155155    while (m_tokenizer->nextToken(m_input.current(), *m_token.get())) {
    156         // FIXME: Call m_xssAuditor.filterToken(m_token) and put resulting XSSInfo into CompactHTMLToken.
     156        // FIXME: Call m_xssAuditor.filterToken(m_token) and put resulting DidBlockScriptRequest into CompactHTMLToken.
    157157        m_pendingTokens->append(CompactHTMLToken(m_token.get(), TextPosition(m_input.current().currentLine(), m_input.current().currentColumn())));
    158158        m_token->clear();
  • trunk/Source/WebCore/html/parser/CompactHTMLToken.cpp

    r141905 r141909  
    3131
    3232#include "HTMLToken.h"
    33 #include "XSSAuditorDelegate.h"
    3433
    3534namespace WebCore {
     
    4039    Vector<CompactAttribute> vector;
    4140    TextPosition textPosition;
    42     OwnPtr<XSSInfo> xssInfo;
    4341};
    4442
     
    8987}
    9088
    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())
     89static bool isStringSafeToSendToAnotherThread(const String& string)
    9690{
    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;
    9999}
    100100
     
    102102{
    103103    for (Vector<CompactAttribute>::const_iterator it = m_attributes.begin(); it != m_attributes.end(); ++it) {
    104         if (!it->name().isSafeToSendToAnotherThread())
     104        if (!isStringSafeToSendToAnotherThread(it->name()))
    105105            return false;
    106         if (!it->value().isSafeToSendToAnotherThread())
     106        if (!isStringSafeToSendToAnotherThread(it->value()))
    107107            return false;
    108108    }
    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);
    122110}
    123111
  • trunk/Source/WebCore/html/parser/CompactHTMLToken.h

    r141905 r141909  
    3030
    3131#include "HTMLTokenTypes.h"
    32 #include <wtf/OwnPtr.h>
    33 #include <wtf/PassOwnPtr.h>
    3432#include <wtf/RefCounted.h>
    3533#include <wtf/RefPtr.h>
     
    4139
    4240class HTMLToken;
    43 class XSSInfo;
    4441
    4542class CompactAttribute {
     
    6259public:
    6360    CompactHTMLToken(const HTMLToken*, const TextPosition&);
    64     CompactHTMLToken(const CompactHTMLToken&);
    6561
    6662    bool isSafeToSendToAnotherThread() const;
     
    7874    const String& systemIdentifier() const { return m_attributes[0].value(); }
    7975    bool doctypeForcesQuirks() const { return m_doctypeForcesQuirks; }
    80     XSSInfo* xssInfo() const;
    81     void setXSSInfo(PassOwnPtr<XSSInfo>);
    8276
    8377private:
     
    9084    Vector<CompactAttribute> m_attributes;
    9185    TextPosition m_textPosition;
    92     OwnPtr<XSSInfo> m_xssInfo;
    9386};
    9487
     
    9790}
    9891
    99 namespace WTF {
    100 // This is required for a struct with OwnPtr. We know CompactHTMLToken is simple enough that
    101 // initializing to 0 and moving with memcpy (and then not destructing the original) will work.
    102 template<> struct VectorTraits<WebCore::CompactHTMLToken> : SimpleClassVectorTraits { };
    103 }
    104 
    10592#endif // ENABLE(THREADED_HTML_PARSER)
    10693
  • trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp

    r141905 r141909  
    303303    ASSERT(shouldUseThreading());
    304304
    305     // This method can cause this parser to be detached from the Document,
     305    // didReceiveTokensFromBackgroundParser can cause this parser to be detached from the Document,
    306306    // but we need to ensure it isn't deleted yet.
    307307    RefPtr<HTMLDocumentParser> protect(this);
     
    317317        ASSERT(!isWaitingForScripts());
    318318
     319        // FIXME: Call m_xssAuditorDelegate.didBlockScript() with DidBlockScriptRequest from the CompactHTMLToken.
    319320        m_textPosition = it->textPosition();
    320 
    321         if (XSSInfo* xssInfo = it->xssInfo())
    322             m_xssAuditorDelegate.didBlockScript(*xssInfo);
    323321        constructTreeFromCompactHTMLToken(*it);
    324322
     
    381379            // We do not XSS filter innerHTML, which means we (intentionally) fail
    382380            // 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());
    386384        }
    387385
  • trunk/Source/WebCore/html/parser/XSSAuditor.cpp

    r141905 r141909  
    279279}
    280280
    281 PassOwnPtr<XSSInfo> XSSAuditor::filterToken(const FilterTokenRequest& request)
     281PassOwnPtr<DidBlockScriptRequest> XSSAuditor::filterToken(const FilterTokenRequest& request)
    282282{
    283283    ASSERT(m_state == Initialized);
     
    297297    if (didBlockScript) {
    298298        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);
    300300        if (!m_reportURL.isEmpty()) {
    301301            m_reportURL = KURL();
     
    303303            m_originalHTTPBody = String();
    304304        }
    305         return xssInfo.release();
     305        return didBlockScriptRequest.release();
    306306    }
    307307    return nullptr;
  • trunk/Source/WebCore/html/parser/XSSAuditor.h

    r141905 r141909  
    3434namespace WebCore {
    3535
     36class DidBlockScriptRequest;
    3637class Document;
    3738class HTMLDocumentParser;
    3839class HTMLSourceTracker;
    3940class TextResourceDecoder;
    40 class XSSInfo;
    4141
    4242struct FilterTokenRequest {
     
    5858
    5959    void init(Document*);
    60     PassOwnPtr<XSSInfo> filterToken(const FilterTokenRequest&);
     60    PassOwnPtr<DidBlockScriptRequest> filterToken(const FilterTokenRequest&);
    6161
    6262private:
  • trunk/Source/WebCore/html/parser/XSSAuditorDelegate.cpp

    r141905 r141909  
    3333#include "Frame.h"
    3434#include "FrameLoaderClient.h"
    35 #include "HTMLParserIdioms.h"
    3635#include "InspectorValues.h"
    3736#include "PingLoader.h"
     
    3938
    4039namespace WebCore {
    41 
    42 bool XSSInfo::isSafeToSendToAnotherThread() const
    43 {
    44     return m_reportURL.isSafeToSendToAnotherThread()
    45         && m_originalURL.isSafeToSendToAnotherThread()
    46         && m_originalHTTPBody.isSafeToSendToAnotherThread();
    47 }
    4840
    4941XSSAuditorDelegate::XSSAuditorDelegate(Document* document)
     
    5547}
    5648
    57 void XSSAuditorDelegate::didBlockScript(const XSSInfo& xssInfo)
     49void XSSAuditorDelegate::didBlockScript(PassOwnPtr<DidBlockScriptRequest> request)
    5850{
    5951    ASSERT(isMainThread());
     
    6355    m_document->addConsoleMessage(JSMessageSource, ErrorMessageLevel, consoleMessage);
    6456
    65     if (xssInfo.m_didBlockEntirePage)
     57    if (request->m_didBlockEntirePage)
    6658        m_document->frame()->loader()->stopAllLoaders();
    6759
    6860    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);
    7062        m_didNotifyClient = true;
    7163    }
    7264
    73     if (!xssInfo.m_reportURL.isEmpty()) {
     65    if (!request->m_reportURL.isEmpty()) {
    7466        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);
    7769
    7870        RefPtr<InspectorObject> reportObject = InspectorObject::create();
     
    8072
    8173        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);
    8375    }
    8476
    85     if (xssInfo.m_didBlockEntirePage)
     77    if (request->m_didBlockEntirePage)
    8678        m_document->frame()->navigationScheduler()->scheduleLocationChange(m_document->securityOrigin(), blankURL(), String());
    8779}
  • trunk/Source/WebCore/html/parser/XSSAuditorDelegate.h

    r141905 r141909  
    3535class Document;
    3636
    37 class XSSInfo {
     37class DidBlockScriptRequest {
    3838public:
    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)
    4040    {
    41         return adoptPtr(new XSSInfo(reportURL, originalURL, originalHTTPBody, didBlockEntirePage));
     41        return adoptPtr(new DidBlockScriptRequest(reportURL, originalURL, originalHTTPBody, didBlockEntirePage));
    4242    }
    43 
    44     bool isSafeToSendToAnotherThread() const;
    4543
    4644    KURL m_reportURL;
     
    5048
    5149private:
    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)
    5351        : m_reportURL(reportURL)
    5452        , m_originalURL(originalURL)
     
    6361    explicit XSSAuditorDelegate(Document*);
    6462
    65     void didBlockScript(const XSSInfo&);
     63    void didBlockScript(PassOwnPtr<DidBlockScriptRequest>);
    6664
    6765private:
  • trunk/Source/WebCore/platform/KURL.cpp

    r141905 r141909  
    19361936}
    19371937
    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  
    228228
    229229    void reportMemoryUsage(MemoryObjectInfo*) const;
    230     bool isSafeToSendToAnotherThread() const;
    231230
    232231private:
  • trunk/Source/WebCore/platform/KURLGoogle.cpp

    r141905 r141909  
    400400    info.addMember(m_parsed, "parsed");
    401401}
    402 
    403 bool KURLGooglePrivate::isSafeToSendToAnotherThread() const
    404 {
    405     return m_string.isSafeToSendToAnotherThread()
    406         && m_utf8.isSafeToSendToAnotherThread()
    407         && (!m_innerURL || m_innerURL->isSafeToSendToAnotherThread());
    408 }
    409 
    410402// KURL ------------------------------------------------------------------------
    411403
  • trunk/Source/WebCore/platform/KURLGooglePrivate.h

    r141905 r141909  
    102102
    103103        void reportMemoryUsage(MemoryObjectInfo*) const;
    104         bool isSafeToSendToAnotherThread() const;
    105104
    106105    private:
  • trunk/Source/WebCore/platform/KURLWTFURLImpl.h

    r141905 r141909  
    5050        info.addMember(m_invalidUrlString, "invalidUrlString");
    5151    }
    52     bool isSafeToSendToAnotherThread() const
    53     {
    54         return m_invalidUrlString.isSafeToSendToAnotherThread()
    55             && m_parsedURL.isSafeToSendToAnotherThread();
    56     }
    5752    PassRefPtr<KURLWTFURLImpl> copy() const;
    5853};
Note: See TracChangeset for help on using the changeset viewer.