[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Wed Apr 7 23:13:13 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 9d201ca0d49260028123b38b80209d5f4787aa5b
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 28 19:52:41 2009 +0000

    2009-10-28  Eric Z. Ayers  <zundel at google.com>
    
            Reviewed by Pavel Feldman.
    
            Adds InspectorTimelineAgent  instrumentation for encountering a
            <SCRIPT> tag when parsing an HTML document.
    
            https://bugs.webkit.org/show_bug.cgi?id=30861
    
            * bindings/js/ScriptSourceCode.h:
            (WebCore::ScriptSourceCode::ScriptSourceCode):
            (WebCore::ScriptSourceCode::startLine):
            (WebCore::ScriptSourceCode::url):
            * html/HTMLTokenizer.cpp:
            (WebCore::HTMLTokenizer::scriptHandler):
            (WebCore::HTMLTokenizer::scriptExecution):
            * inspector/InspectorTimelineAgent.cpp:
            (WebCore::InspectorTimelineAgent::willLoadXHR):
            (WebCore::InspectorTimelineAgent::willScriptTag):
            (WebCore::InspectorTimelineAgent::didScriptTag):
            * inspector/InspectorTimelineAgent.h:
            (WebCore::):
            * inspector/TimelineRecordFactory.cpp:
            (WebCore::TimelineRecordFactory::createScriptTagTimelineRecord):
            * inspector/TimelineRecordFactory.h:
            * inspector/front-end/TimelineAgent.js:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50230 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 4aaa6f4..1a20297 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,30 @@
+2009-10-28  Eric Z. Ayers  <zundel at google.com>
+
+        Reviewed by Pavel Feldman.
+
+        Adds InspectorTimelineAgent  instrumentation for encountering a
+        <SCRIPT> tag when parsing an HTML document. 
+
+        https://bugs.webkit.org/show_bug.cgi?id=30861
+
+        * bindings/js/ScriptSourceCode.h:
+        (WebCore::ScriptSourceCode::ScriptSourceCode):
+        (WebCore::ScriptSourceCode::startLine):
+        (WebCore::ScriptSourceCode::url):
+        * html/HTMLTokenizer.cpp:
+        (WebCore::HTMLTokenizer::scriptHandler):
+        (WebCore::HTMLTokenizer::scriptExecution):
+        * inspector/InspectorTimelineAgent.cpp:
+        (WebCore::InspectorTimelineAgent::willLoadXHR):
+        (WebCore::InspectorTimelineAgent::willScriptTag):
+        (WebCore::InspectorTimelineAgent::didScriptTag):
+        * inspector/InspectorTimelineAgent.h:
+        (WebCore::):
+        * inspector/TimelineRecordFactory.cpp:
+        (WebCore::TimelineRecordFactory::createScriptTagTimelineRecord):
+        * inspector/TimelineRecordFactory.h:
+        * inspector/front-end/TimelineAgent.js:
+
 2009-10-28  Steve Block  <steveblock at google.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/bindings/js/ScriptSourceCode.h b/WebCore/bindings/js/ScriptSourceCode.h
index 1b05ded..32d6298 100644
--- a/WebCore/bindings/js/ScriptSourceCode.h
+++ b/WebCore/bindings/js/ScriptSourceCode.h
@@ -44,6 +44,7 @@ public:
     ScriptSourceCode(const String& source, const KURL& url = KURL(), int startLine = 1)
         : m_provider(StringSourceProvider::create(source, url.isNull() ? String() : url.string()))
         , m_code(m_provider, startLine)
+        , m_url(url)
     {
     }
 
@@ -59,10 +60,17 @@ public:
 
     const String& source() const { return m_provider->source(); }
 
+    int startLine() const { return m_code.firstLine(); }
+
+    const KURL& url() const { return m_url; }
+    
 private:
     RefPtr<ScriptSourceProvider> m_provider;
     
     JSC::SourceCode m_code;
+    
+    KURL m_url;
+
 };
 
 } // namespace WebCore
diff --git a/WebCore/html/HTMLTokenizer.cpp b/WebCore/html/HTMLTokenizer.cpp
index 33af997..91285d9 100644
--- a/WebCore/html/HTMLTokenizer.cpp
+++ b/WebCore/html/HTMLTokenizer.cpp
@@ -416,13 +416,13 @@ HTMLTokenizer::State HTMLTokenizer::parseNonHTMLText(SegmentedString& src, State
 
     return state;
 }
-
+    
 HTMLTokenizer::State HTMLTokenizer::scriptHandler(State state)
 {
     // We are inside a <script>
     bool doScriptExec = false;
     int startLine = m_currentScriptTagStartLineNumber + 1; // Script line numbers are 1 based, HTMLTokenzier line numbers are 0 based
-
+    
     // Reset m_currentScriptTagStartLineNumber to indicate that we've finished parsing the current script element
     m_currentScriptTagStartLineNumber = 0;
 
@@ -551,7 +551,13 @@ HTMLTokenizer::State HTMLTokenizer::scriptExecution(const ScriptSourceCode& sour
     if (m_fragment || !m_doc->frame())
         return state;
     m_executingScript++;
-
+    
+#if ENABLE(INSPECTOR)
+    InspectorTimelineAgent* timelineAgent = m_doc->inspectorTimelineAgent();
+    if (timelineAgent)
+        timelineAgent->willEvaluateScriptTag(sourceCode.url().isNull() ? String() : sourceCode.url().string(), sourceCode.startLine());
+#endif
+    
     SegmentedString* savedPrependingSrc = m_currentPrependingSrc;
     SegmentedString prependingSrc;
     m_currentPrependingSrc = &prependingSrc;
@@ -608,7 +614,12 @@ HTMLTokenizer::State HTMLTokenizer::scriptExecution(const ScriptSourceCode& sour
     }
 
     m_currentPrependingSrc = savedPrependingSrc;
-
+    
+#if ENABLE(INSPECTOR)
+    if (timelineAgent)
+        timelineAgent->didEvaluateScriptTag();
+#endif
+    
     return state;
 }
 
@@ -1613,7 +1624,7 @@ inline bool HTMLTokenizer::continueProcessing(int& processedCount, double startT
     processedCount++;
     return true;
 }
-
+    
 void HTMLTokenizer::write(const SegmentedString& str, bool appendData)
 {
     if (!m_buffer)
diff --git a/WebCore/inspector/InspectorTimelineAgent.cpp b/WebCore/inspector/InspectorTimelineAgent.cpp
index 202cbba..6726474 100644
--- a/WebCore/inspector/InspectorTimelineAgent.cpp
+++ b/WebCore/inspector/InspectorTimelineAgent.cpp
@@ -100,7 +100,7 @@ void InspectorTimelineAgent::didWriteHTML()
 {
     didCompleteCurrentRecord(ParseHTMLTimelineRecordType);
 }
-
+   
 void InspectorTimelineAgent::didInstallTimer(int timerId, int timeout, bool singleShot)
 {
     addRecordToTimeline(TimelineRecordFactory::createTimerInstallRecord(m_frontend, currentTimeInMilliseconds(), timerId,
@@ -135,7 +135,8 @@ void InspectorTimelineAgent::didChangeXHRReadyState()
     didCompleteCurrentRecord(XHRReadyStateChangeRecordType);
 }
 
-void InspectorTimelineAgent::willLoadXHR(const String& url) {
+void InspectorTimelineAgent::willLoadXHR(const String& url) 
+{
     pushCurrentRecord(TimelineRecordFactory::createXHRLoadTimelineRecord(m_frontend, currentTimeInMilliseconds(), url), XHRLoadRecordType);
 }
 
@@ -144,6 +145,16 @@ void InspectorTimelineAgent::didLoadXHR()
     didCompleteCurrentRecord(XHRLoadRecordType);
 }
 
+void InspectorTimelineAgent::willEvaluateScriptTag(const String& url, int lineNumber)
+{
+    pushCurrentRecord(TimelineRecordFactory::createEvaluateScriptTagTimelineRecord(m_frontend, currentTimeInMilliseconds(), url, lineNumber), EvaluateScriptTagTimelineRecordType);
+}
+    
+void InspectorTimelineAgent::didEvaluateScriptTag()
+{
+    didCompleteCurrentRecord(EvaluateScriptTagTimelineRecordType);
+}
+
 void InspectorTimelineAgent::reset()
 {
     m_recordStack.clear();
diff --git a/WebCore/inspector/InspectorTimelineAgent.h b/WebCore/inspector/InspectorTimelineAgent.h
index e2e1e82..6cfde69 100644
--- a/WebCore/inspector/InspectorTimelineAgent.h
+++ b/WebCore/inspector/InspectorTimelineAgent.h
@@ -53,6 +53,7 @@ namespace WebCore {
         TimerFireTimelineRecordType = 7,
         XHRReadyStateChangeRecordType = 8,
         XHRLoadRecordType = 9,
+        EvaluateScriptTagTimelineRecordType = 10,
     };
 
     class InspectorTimelineAgent {
@@ -88,6 +89,9 @@ namespace WebCore {
         void willLoadXHR(const String&);
         void didLoadXHR();
 
+        void willEvaluateScriptTag(const String&, int);
+        void didEvaluateScriptTag();
+
         static InspectorTimelineAgent* retrieve(ScriptExecutionContext*);
     private:
         struct TimelineRecordEntry {
diff --git a/WebCore/inspector/TimelineRecordFactory.cpp b/WebCore/inspector/TimelineRecordFactory.cpp
index 3ccdaac..085bcd9 100644
--- a/WebCore/inspector/TimelineRecordFactory.cpp
+++ b/WebCore/inspector/TimelineRecordFactory.cpp
@@ -100,6 +100,17 @@ ScriptObject TimelineRecordFactory::createXHRLoadTimelineRecord(InspectorFronten
     return record;
 }
 
+// static
+ScriptObject TimelineRecordFactory::createEvaluateScriptTagTimelineRecord(InspectorFrontend* frontend, double startTime, const String& url, double lineNumber) 
+{
+    ScriptObject item = createGenericRecord(frontend, startTime);
+    ScriptObject data = frontend->newScriptObject();
+    data.set("url", url);
+    data.set("lineNumber", lineNumber);
+    item.set("data", data);
+    return item;
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(INSPECTOR)
diff --git a/WebCore/inspector/TimelineRecordFactory.h b/WebCore/inspector/TimelineRecordFactory.h
index f1a5fa5..3d36649 100644
--- a/WebCore/inspector/TimelineRecordFactory.h
+++ b/WebCore/inspector/TimelineRecordFactory.h
@@ -50,9 +50,10 @@ namespace WebCore {
         static ScriptObject createTimerInstallRecord(InspectorFrontend*, double startTime, int timerId, int timeout, bool singleShot);
 
         static ScriptObject createXHRReadyStateChangeTimelineRecord(InspectorFrontend*, double startTime, const String& url, int readyState);
-
         static ScriptObject createXHRLoadTimelineRecord(InspectorFrontend*, double startTime, const String& url);
         
+        static ScriptObject createEvaluateScriptTagTimelineRecord(InspectorFrontend*, double startTime, const String&, double lineNumber);
+
     private:
         TimelineRecordFactory() { }
     };
diff --git a/WebCore/inspector/front-end/TimelineAgent.js b/WebCore/inspector/front-end/TimelineAgent.js
index b8e1bf3..cbbb736 100644
--- a/WebCore/inspector/front-end/TimelineAgent.js
+++ b/WebCore/inspector/front-end/TimelineAgent.js
@@ -43,7 +43,8 @@ WebInspector.TimelineAgent.RecordType = {
     TimerRemove         : 6,
     TimerFire           : 7,
     XHRReadyStateChange : 8,
-    XHRLoad             : 9
+    XHRLoad             : 9,
+    EvaluateScriptTag   : 10
 };
 
 WebInspector.addRecordToTimeline = function(record) {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list