Changeset 64704 in webkit


Ignore:
Timestamp:
Aug 4, 2010 7:22:44 PM (14 years ago)
Author:
abarth@webkit.org
Message:

2010-08-04 Sheriff Bot <webkit.review.bot@gmail.com>

Unreviewed, rolling out r64674.
http://trac.webkit.org/changeset/64674
https://bugs.webkit.org/show_bug.cgi?id=43532

Doesn't work with HTML5 tree builder (Requested by tonyg-cr on
#webkit).

  • fast/dom/HTMLScriptElement/defer-double-defer-write-expected.txt: Removed.
  • fast/dom/HTMLScriptElement/defer-double-defer-write.html: Removed.
  • fast/dom/HTMLScriptElement/defer-double-write-expected.txt: Removed.
  • fast/dom/HTMLScriptElement/defer-double-write.html: Removed.
  • fast/dom/HTMLScriptElement/defer-inline-script-expected.txt: Removed.
  • fast/dom/HTMLScriptElement/defer-inline-script.html: Removed.
  • fast/dom/HTMLScriptElement/defer-onbeforeload-expected.txt: Removed.
  • fast/dom/HTMLScriptElement/defer-onbeforeload.html: Removed.
  • fast/dom/HTMLScriptElement/defer-script-invalid-url-expected.txt: Removed.
  • fast/dom/HTMLScriptElement/defer-script-invalid-url.html: Removed.
  • fast/dom/HTMLScriptElement/resources/defer.js: Removed.
  • fast/dom/HTMLScriptElement/resources/external.js: Removed.
  • fast/dom/HTMLScriptElement/resources/shouldnotexecute.js: Removed.
  • http/tests/misc/resources/defer-script.js: Removed.
  • http/tests/misc/resources/external-script.js: Removed.
  • http/tests/misc/resources/script-debug-body-background.js: Removed.
  • http/tests/misc/resources/script-write-slow-stylesheet.js: Removed.
  • http/tests/misc/resources/slow-defer-script.cgi: Removed.
  • http/tests/misc/resources/slow-stylesheet.cgi: Removed.
  • http/tests/misc/script-defer-after-slow-stylesheet-expected.txt: Removed.
  • http/tests/misc/script-defer-after-slow-stylesheet.html: Removed.
  • http/tests/misc/script-defer-expected.txt: Removed.
  • http/tests/misc/script-defer-write-slow-stylesheet-expected.txt: Removed.
  • http/tests/misc/script-defer-write-slow-stylesheet.html: Removed.
  • http/tests/misc/script-defer.html: Removed.

2010-08-04 Sheriff Bot <webkit.review.bot@gmail.com>

Unreviewed, rolling out r64674.
http://trac.webkit.org/changeset/64674
https://bugs.webkit.org/show_bug.cgi?id=43532

Doesn't work with HTML5 tree builder (Requested by tonyg-cr on
#webkit).

  • html/HTMLDocumentParser.cpp: (WebCore::HTMLDocumentParser::attemptToEnd): (WebCore::HTMLDocumentParser::endIfDelayed):
  • html/HTMLDocumentParser.h:
  • html/HTMLScriptRunner.cpp: (WebCore::HTMLScriptRunner::requestScript): (WebCore::HTMLScriptRunner::runScript):
  • html/HTMLScriptRunner.h:
Location:
trunk
Files:
25 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r64702 r64704  
     12010-08-04  Sheriff Bot  <webkit.review.bot@gmail.com>
     2
     3        Unreviewed, rolling out r64674.
     4        http://trac.webkit.org/changeset/64674
     5        https://bugs.webkit.org/show_bug.cgi?id=43532
     6
     7        Doesn't work with HTML5 tree builder (Requested by tonyg-cr on
     8        #webkit).
     9
     10        * fast/dom/HTMLScriptElement/defer-double-defer-write-expected.txt: Removed.
     11        * fast/dom/HTMLScriptElement/defer-double-defer-write.html: Removed.
     12        * fast/dom/HTMLScriptElement/defer-double-write-expected.txt: Removed.
     13        * fast/dom/HTMLScriptElement/defer-double-write.html: Removed.
     14        * fast/dom/HTMLScriptElement/defer-inline-script-expected.txt: Removed.
     15        * fast/dom/HTMLScriptElement/defer-inline-script.html: Removed.
     16        * fast/dom/HTMLScriptElement/defer-onbeforeload-expected.txt: Removed.
     17        * fast/dom/HTMLScriptElement/defer-onbeforeload.html: Removed.
     18        * fast/dom/HTMLScriptElement/defer-script-invalid-url-expected.txt: Removed.
     19        * fast/dom/HTMLScriptElement/defer-script-invalid-url.html: Removed.
     20        * fast/dom/HTMLScriptElement/resources/defer.js: Removed.
     21        * fast/dom/HTMLScriptElement/resources/external.js: Removed.
     22        * fast/dom/HTMLScriptElement/resources/shouldnotexecute.js: Removed.
     23        * http/tests/misc/resources/defer-script.js: Removed.
     24        * http/tests/misc/resources/external-script.js: Removed.
     25        * http/tests/misc/resources/script-debug-body-background.js: Removed.
     26        * http/tests/misc/resources/script-write-slow-stylesheet.js: Removed.
     27        * http/tests/misc/resources/slow-defer-script.cgi: Removed.
     28        * http/tests/misc/resources/slow-stylesheet.cgi: Removed.
     29        * http/tests/misc/script-defer-after-slow-stylesheet-expected.txt: Removed.
     30        * http/tests/misc/script-defer-after-slow-stylesheet.html: Removed.
     31        * http/tests/misc/script-defer-expected.txt: Removed.
     32        * http/tests/misc/script-defer-write-slow-stylesheet-expected.txt: Removed.
     33        * http/tests/misc/script-defer-write-slow-stylesheet.html: Removed.
     34        * http/tests/misc/script-defer.html: Removed.
     35
    1362010-08-04  Adam Barth  <abarth@webkit.org>
    237
  • trunk/WebCore/ChangeLog

    r64702 r64704  
     12010-08-04  Sheriff Bot  <webkit.review.bot@gmail.com>
     2
     3        Unreviewed, rolling out r64674.
     4        http://trac.webkit.org/changeset/64674
     5        https://bugs.webkit.org/show_bug.cgi?id=43532
     6
     7        Doesn't work with HTML5 tree builder (Requested by tonyg-cr on
     8        #webkit).
     9
     10        * html/HTMLDocumentParser.cpp:
     11        (WebCore::HTMLDocumentParser::attemptToEnd):
     12        (WebCore::HTMLDocumentParser::endIfDelayed):
     13        * html/HTMLDocumentParser.h:
     14        * html/HTMLScriptRunner.cpp:
     15        (WebCore::HTMLScriptRunner::requestScript):
     16        (WebCore::HTMLScriptRunner::runScript):
     17        * html/HTMLScriptRunner.h:
     18
    1192010-08-04  Adam Barth  <abarth@webkit.org>
    220
  • trunk/WebCore/html/HTMLDocumentParser.cpp

    r64674 r64704  
    282282        return;
    283283    }
    284     executeScriptsWaitingForParsingAndEnd();
     284    end();
    285285}
    286286
     
    291291
    292292    m_endWasDelayed = false;
    293     executeScriptsWaitingForParsingAndEnd();
    294 }
    295 
    296 void HTMLDocumentParser::executeScriptsWaitingForParsingAndEnd()
    297 {
    298     if (m_scriptRunner) {
    299         bool continueParsing = m_scriptRunner->executeScriptsWaitingForParsing();
    300         if (!continueParsing) {
    301             m_treeBuilder->setPaused(true);
    302             m_endWasDelayed = true;
    303             return;
    304         }
    305     }
    306293    end();
    307294}
  • trunk/WebCore/html/HTMLDocumentParser.h

    r64674 r64704  
    106106    void attemptToEnd();
    107107    void endIfDelayed();
    108     void executeScriptsWaitingForParsingAndEnd();
    109108    void end();
    110109
  • trunk/WebCore/html/HTMLScriptRunner.cpp

    r64674 r64704  
    229229}
    230230
    231 bool HTMLScriptRunner::executeScriptsWaitingForParsing()
    232 {
    233     while (!m_scriptsToExecuteAfterParsing.isEmpty()) {
    234         ASSERT(!haveParsingBlockingScript());
    235         m_parsingBlockingScript = m_scriptsToExecuteAfterParsing.takeFirst();
    236         ASSERT(m_parsingBlockingScript.cachedScript());
    237         if (!m_parsingBlockingScript.cachedScript()->isLoaded()) {
    238             watchForLoad(m_parsingBlockingScript);
    239             return false;
    240         }
    241         if (!executeParsingBlockingScripts())
    242             return false;
    243     }
    244 
    245     return m_scriptsToExecuteAfterParsing.isEmpty();
    246 }
    247 
    248 bool HTMLScriptRunner::requestScript(PendingScript& pendingScript, Element* scriptElement)
    249 {
    250     ASSERT(!pendingScript.element);
    251     const AtomicString& srcValue = scriptElement->getAttribute(srcAttr);
     231void HTMLScriptRunner::requestScript(Element* script)
     232{
     233    ASSERT(!m_parsingBlockingScript.element);
     234    AtomicString srcValue = script->getAttribute(srcAttr);
     235    // Allow the host to disllow script loads (using the XSSAuditor, etc.)
    252236    if (!m_host->shouldLoadExternalScriptFromSrc(srcValue))
    253         return false;
     237        return;
    254238    // FIXME: We need to resolve the url relative to the element.
    255     if (!scriptElement->dispatchBeforeLoadEvent(srcValue))
    256         return false;
    257     pendingScript.element = scriptElement;
     239    if (!script->dispatchBeforeLoadEvent(srcValue))
     240        return;
     241    m_parsingBlockingScript.element = script;
    258242    // This should correctly return 0 for empty or invalid srcValues.
    259     CachedScript* cachedScript = m_document->docLoader()->requestScript(srcValue, toScriptElement(scriptElement)->scriptCharset());
     243    CachedScript* cachedScript = m_document->docLoader()->requestScript(srcValue, toScriptElement(script)->scriptCharset());
    260244    if (!cachedScript) {
    261245        notImplemented(); // Dispatch error event.
    262         return false;
    263     }
    264 
    265     pendingScript.setCachedScript(cachedScript);
    266     return true;
    267 }
    268 
    269 void HTMLScriptRunner::requestParsingBlockingScript(Element* scriptElement)
    270 {
    271     if (!requestScript(m_parsingBlockingScript, scriptElement))
    272         return;
    273 
    274     ASSERT(m_parsingBlockingScript.cachedScript());
     246        return;
     247    }
     248
     249    m_parsingBlockingScript.setCachedScript(cachedScript);
    275250
    276251    // We only care about a load callback if cachedScript is not already
     
    281256}
    282257
    283 void HTMLScriptRunner::requestDeferredScript(Element* scriptElement)
    284 {
    285     PendingScript pendingScript;
    286     if (!requestScript(pendingScript, scriptElement))
    287         return;
    288 
    289     ASSERT(pendingScript.cachedScript());
    290     m_scriptsToExecuteAfterParsing.append(pendingScript);
    291 }
    292 
    293258// This method is meant to match the HTML5 definition of "running a script"
    294259// http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.html#running-a-script
     
    303268
    304269        if (script->hasAttribute(srcAttr)) {
    305             // FIXME: Handle async
    306             if (script->hasAttribute(deferAttr))
    307                 requestDeferredScript(script);
    308             else
    309                 requestParsingBlockingScript(script);
     270            // FIXME: Handle defer and async
     271            requestScript(script);
    310272        } else {
    311273            // FIXME: We do not block inline <script> tags on stylesheets to match the
  • trunk/WebCore/html/HTMLScriptRunner.h

    r64674 r64704  
    2929#include "CachedResourceClient.h"
    3030#include "CachedResourceHandle.h"
    31 #include <wtf/Deque.h>
    3231#include <wtf/Noncopyable.h>
    3332#include <wtf/PassRefPtr.h>
     
    5453    bool hasScriptsWaitingForStylesheets() const { return m_hasScriptsWaitingForStylesheets; }
    5554    bool executeScriptsWaitingForStylesheets();
    56     bool executeScriptsWaitingForParsing();
    5755
    5856    bool isExecutingScript() { return !!m_scriptNestingLevel; }
     
    6664    //
    6765    // FIXME: Finish turning this into a proper class.
    68     class PendingScript : public CachedResourceClient {
     66    class PendingScript : public CachedResourceClient, Noncopyable {
    6967    public:
    7068        PendingScript()
     
    7270            , m_watchingForLoad(false)
    7371        {
    74         }
    75 
    76         PendingScript(const PendingScript& other)
    77             : CachedResourceClient(other)
    78             , element(other.element)
    79             , startingLineNumber(other.startingLineNumber)
    80             , m_watchingForLoad(other.m_watchingForLoad)
    81         {
    82             setCachedScript(other.cachedScript());
    83         }
    84 
    85         PendingScript& operator=(const PendingScript& other)
    86         {
    87             if (this == &other)
    88                 return *this;
    89 
    90             element = other.element;
    91             startingLineNumber = other.startingLineNumber;
    92             m_watchingForLoad = other.m_watchingForLoad;
    93             setCachedScript(other.cachedScript());
    94 
    95             return *this;
    9672        }
    9773
     
    126102    void executePendingScript();
    127103
    128     bool requestScript(PendingScript&, Element*);
    129     void requestParsingBlockingScript(Element*);
    130     void requestDeferredScript(Element*);
     104    void requestScript(Element*);
    131105    void runScript(Element*, int startingLineNumber);
    132106
     
    142116    HTMLScriptRunnerHost* m_host;
    143117    PendingScript m_parsingBlockingScript;
    144     Deque<PendingScript> m_scriptsToExecuteAfterParsing;
    145118    unsigned m_scriptNestingLevel;
    146119
Note: See TracChangeset for help on using the changeset viewer.