Changeset 61604 in webkit


Ignore:
Timestamp:
Jun 22, 2010 12:04:34 AM (14 years ago)
Author:
abarth@webkit.org
Message:

2010-06-21 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Save the insertion point before beforeload events
https://bugs.webkit.org/show_bug.cgi?id=40973

Update expected results to show the proper document.write order.

  • fast/tokenizer/write-before-load-expected.txt:

2010-06-21 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Save the insertion point before beforeload events
https://bugs.webkit.org/show_bug.cgi?id=40973

We need to save the insertion point before dispatching the beforeload
event in case someone decides to document.write during beforeload.
Prior to this patch, such writes would pump the lexer too much and
tokenize the rest of the document before executing the script.

  • html/HTML5DocumentParser.cpp: (WebCore::HTML5DocumentParser::dispatchBeforeLoad):
  • html/HTML5DocumentParser.h:
  • html/HTML5ScriptRunner.cpp: (WebCore::HTML5ScriptRunner::requestScript):
  • html/HTML5ScriptRunnerHost.h:
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r61602 r61604  
     12010-06-21  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Save the insertion point before beforeload events
     6        https://bugs.webkit.org/show_bug.cgi?id=40973
     7
     8        Update expected results to show the proper document.write order.
     9
     10        * fast/tokenizer/write-before-load-expected.txt:
     11
    1122010-06-21  Adam Barth  <abarth@webkit.org>
    213
  • trunk/LayoutTests/fast/tokenizer/write-before-load-expected.txt

    r61602 r61604  
    1 1 2 7 3456
     11 2 3 4 5 6 7
  • trunk/LayoutTests/fast/tokenizer/write-before-load.html

    r61602 r61604  
    77{
    88    document.write("<script>document.write(" + number + ")</scr" +
    9                    "ipt><script>document.write(" + (number + 1) + ")</scr" + "ipt>")
     9                   "ipt> <script>document.write(" + (number + 1) + ")</scr" + "ipt> ")
    1010}
    1111</script>
  • trunk/WebCore/ChangeLog

    r61602 r61604  
     12010-06-21  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Save the insertion point before beforeload events
     6        https://bugs.webkit.org/show_bug.cgi?id=40973
     7
     8        We need to save the insertion point before dispatching the beforeload
     9        event in case someone decides to document.write during beforeload.
     10        Prior to this patch, such writes would pump the lexer too much and
     11        tokenize the rest of the document before executing the script.
     12
     13        * html/HTML5DocumentParser.cpp:
     14        (WebCore::HTML5DocumentParser::dispatchBeforeLoad):
     15        * html/HTML5DocumentParser.h:
     16        * html/HTML5ScriptRunner.cpp:
     17        (WebCore::HTML5ScriptRunner::requestScript):
     18        * html/HTML5ScriptRunnerHost.h:
     19
    1202010-06-21  Adam Barth  <abarth@webkit.org>
    221
  • trunk/WebCore/html/HTML5DocumentParser.cpp

    r61470 r61604  
    404404}
    405405
     406bool HTML5DocumentParser::dispatchBeforeLoad(Element* script, const AtomicString& srcValue)
     407{
     408    InsertionPointRecord savedInsertionPoint(m_input);
     409    return script->dispatchBeforeLoadEvent(srcValue);
     410}
     411
    406412void HTML5DocumentParser::notifyFinished(CachedResource* cachedResource)
    407413{
  • trunk/WebCore/html/HTML5DocumentParser.h

    r61470 r61604  
    7373    virtual bool shouldLoadExternalScriptFromSrc(const AtomicString&);
    7474    virtual void executeScript(const ScriptSourceCode&);
     75    virtual bool dispatchBeforeLoad(Element* script, const AtomicString& srcValue);
    7576
    7677    // CachedResourceClient
  • trunk/WebCore/html/HTML5ScriptRunner.cpp

    r61602 r61604  
    233233    if (!m_host->shouldLoadExternalScriptFromSrc(srcValue))
    234234        return;
    235 
    236235    // FIXME: We need to resolve the url relative to the element.
    237     if (!script->dispatchBeforeLoadEvent(srcValue)) // Part of HTML5?
     236    if (!m_host->dispatchBeforeLoad(script, srcValue))
    238237        return;
    239238    m_parsingBlockingScript.element = script;
  • trunk/WebCore/html/HTML5ScriptRunnerHost.h

    r61374 r61604  
    3131class AtomicString;
    3232class CachedResource;
     33class Element;
    3334class ScriptSourceCode;
    3435
     
    4647    // Implementors should handle possible rentry before/after calling ScriptController::executeScript
    4748    virtual void executeScript(const ScriptSourceCode&) = 0;
     49    virtual bool dispatchBeforeLoad(Element* script, const AtomicString& srcValue) = 0;
    4850};
    4951
Note: See TracChangeset for help on using the changeset viewer.