Changeset 83033 in webkit


Ignore:
Timestamp:
Apr 6, 2011 1:24:28 AM (13 years ago)
Author:
caseq@chromium.org
Message:

2011-04-06 Andrey Kosyakov <caseq@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: [Extensions API] remove inspectedPage.* events
https://bugs.webkit.org/show_bug.cgi?id=57763

  • Removed webInspector.inspectedPage.* events
  • moved onNavigated to webInspector.resources
  • inspector/front-end/ExtensionAPI.js: (WebInspector.injectedExtensionAPI): (WebInspector.injectedExtensionAPI.InspectedWindow):
  • inspector/front-end/ExtensionAPISchema.json:
  • inspector/front-end/ExtensionServer.js: (WebInspector.ExtensionServer.prototype.notifyInspectedURLChanged):
  • inspector/front-end/inspector.js: (WebInspector.domContentEventFired): (WebInspector.loadEventFired): (WebInspector.inspectedURLChanged):

2011-04-06 Andrey Kosyakov <caseq@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: [Extensions API] remove inspectedPage.* events
https://bugs.webkit.org/show_bug.cgi?id=57763

  • Removed webInspector.inspectedPage.* events
  • moved onNavigated to webInspector.resources
  • http/tests/inspector/extensions-test.js: (initialize_ExtensionsTest.runWhenPageLoads):
  • http/tests/inspector/inspector-test.js: (initialize_InspectorTest.InspectorTest.runWhenPageLoads.chainedCallback): (initialize_InspectorTest.InspectorTest.runWhenPageLoads):
  • inspector/extensions/extensions-api-expected.txt:
  • inspector/extensions/extensions-events-expected.txt:
  • inspector/extensions/extensions-events.html:
Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r83031 r83033  
     12011-04-05  Andrey Kosyakov  <caseq@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: [Extensions API] remove inspectedPage.* events
     6        https://bugs.webkit.org/show_bug.cgi?id=57763
     7
     8        - Removed webInspector.inspectedPage.* events
     9        - moved onNavigated to webInspector.resources
     10
     11        * http/tests/inspector/extensions-test.js:
     12        (initialize_ExtensionsTest.runWhenPageLoads):
     13        * http/tests/inspector/inspector-test.js:
     14        (initialize_InspectorTest.InspectorTest.runWhenPageLoads.chainedCallback):
     15        (initialize_InspectorTest.InspectorTest.runWhenPageLoads):
     16        * inspector/extensions/extensions-api-expected.txt:
     17        * inspector/extensions/extensions-events-expected.txt:
     18        * inspector/extensions/extensions-events.html:
     19
    1202011-04-05  Mikhail Naganov  <mnaganov@chromium.org>
    221
  • trunk/LayoutTests/http/tests/inspector/extensions-test.js

    r82832 r83033  
    8585InspectorTest.dispatchOnMessage("reload", reloadPage, true);
    8686
     87function runWhenPageLoads(data, port)
     88{
     89    InspectorTest.runWhenPageLoads(function() {
     90        port.postMessage("");
     91    });
     92}
     93InspectorTest.dispatchOnMessage("run-when-page-loads", runWhenPageLoads, true);
     94
    8795}
    8896
  • trunk/LayoutTests/http/tests/inspector/inspector-test.js

    r83031 r83033  
    152152}
    153153
     154InspectorTest.runWhenPageLoads = function(callback)
     155{
     156    var oldCallback = InspectorTest._reloadPageCallback;
     157    function chainedCallback()
     158    {
     159        if (oldCallback)
     160            oldCallback();
     161        callback();
     162    }
     163    InspectorTest._reloadPageCallback = InspectorTest.safeWrap(chainedCallback);
     164}
     165
    154166InspectorTest.runAfterPendingDispatches = function(callback)
    155167{
  • trunk/LayoutTests/inspector/extensions/extensions-api-expected.txt

    r82832 r83033  
    99    }
    1010    inspectedWindow : {
    11         onDOMContentLoaded : {
    12             addListener : <function>
    13             removeListener : <function>
    14         }
    15         onLoaded : {
    16             addListener : <function>
    17             removeListener : <function>
    18         }
    19         onNavigated : {
    20             addListener : <function>
    21             removeListener : <function>
    22         }
    2311        reload : <function>
    2412        eval : <function>
     
    4735            removeListener : <function>
    4836        }
     37        onNavigated : {
     38            addListener : <function>
     39            removeListener : <function>
     40        }
    4941        getHAR : <function>
    5042        addRequestHeaders : <function>
  • trunk/LayoutTests/inspector/extensions/extensions-events-expected.txt

    r82832 r83033  
    33Started extension.
    44Running tests...
     5RUNNING TEST: extension_testOnNavigated
     6Page reloaded.
     7Page reloaded.
     8Navigated to: extensions-events.html?navigated
     9Navigated to: extensions-events.html
    510RUNNING TEST: extension_testOnResourceFinished
    611onFinished fired
    712RUNNING TEST: extension_testOnSelectionChanged
    813onSelectionChanged fired
    9 RUNNING TEST: extension_testPageLoadEvents
    10 Page reloaded.
    11 onDOMContentLoaded fired: number
    12 onLoaded fired: number
    1314RUNNING TEST: extension_testPanelShowHide
    1415Got onHidden event for panel elements
  • trunk/LayoutTests/inspector/extensions/extensions-events.html

    r82832 r83033  
    2929}
    3030
    31 function extension_testPageLoadEvents(nextTest)
     31function extension_testOnNavigated(nextTest)
    3232{
    33     var queuedOutput = [];
     33    var urls = [];
     34    var loadCount = 0;
    3435
    35     // Logging on onLoaded is tricky due to race conditions with output("Page reloaded") in page initialization code.
    36     // So only log when we're sure all handlers are called and reload is done.
    37     function queueOutputAndContinue(message)
     36    function onLoad()
    3837    {
    39         queuedOutput.push(message);
    40         if (queuedOutput.length != 3)
     38        ++loadCount;
     39        processEvent();
     40    }
     41    function processEvent()
     42    {
     43        if (loadCount !== urls.length)
    4144            return;
    42         for (i = 0; i < queuedOutput.length; ++i) {
    43             if (queuedOutput[i])
    44                 output(queuedOutput[i]);
     45        if (loadCount === 1) {
     46            dispatchOnFrontend({ command: "run-when-page-loads" }, onLoad);
     47            webInspector.inspectedWindow.eval("location.href = location.origin + location.pathname");
    4548        }
    46         nextTest();
     49        else {
     50            webInspector.resources.onNavigated.removeListener(onNavigated);
     51            for (var i = 0; i < urls.length; ++i)
     52                output("Navigated to: " + urls[i]);
     53            nextTest();
     54        }
    4755    }
    48 
    49     webInspector.inspectedWindow.onDOMContentLoaded.addListener(function(time) {
    50         queueOutputAndContinue("onDOMContentLoaded fired: " + typeof time);
    51     });
    52 
    53     webInspector.inspectedWindow.onLoaded.addListener(function(time) {
    54         queueOutputAndContinue("onLoaded fired: " + typeof time);
    55     });
    56     dispatchOnFrontend({ command: "reload" }, queueOutputAndContinue);
     56    function onNavigated(url)
     57    {
     58        urls.push(url.replace(/^(.*\/)*/, ""));
     59        processEvent();
     60    }
     61    webInspector.resources.onNavigated.addListener(onNavigated);
     62    dispatchOnFrontend({ command: "run-when-page-loads" }, onLoad);
     63    webInspector.inspectedWindow.eval("location.href = location.href + '?navigated'");
    5764}
    5865
  • trunk/Source/WebCore/ChangeLog

    r83032 r83033  
     12011-04-06  Andrey Kosyakov  <caseq@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: [Extensions API] remove inspectedPage.* events
     6        https://bugs.webkit.org/show_bug.cgi?id=57763
     7
     8        - Removed webInspector.inspectedPage.* events
     9        - moved onNavigated to webInspector.resources
     10
     11        * inspector/front-end/ExtensionAPI.js:
     12        (WebInspector.injectedExtensionAPI):
     13        (WebInspector.injectedExtensionAPI.InspectedWindow):
     14        * inspector/front-end/ExtensionAPISchema.json:
     15        * inspector/front-end/ExtensionServer.js:
     16        (WebInspector.ExtensionServer.prototype.notifyInspectedURLChanged):
     17        * inspector/front-end/inspector.js:
     18        (WebInspector.domContentEventFired):
     19        (WebInspector.loadEventFired):
     20        (WebInspector.inspectedURLChanged):
     21
    1222011-04-06  Joseph Pecoraro  <joepeck@webkit.org>
    223
  • trunk/Source/WebCore/inspector/front-end/ExtensionAPI.js

    r82832 r83033  
    112112    }
    113113    this.onFinished = new EventSink("resource-finished", resourceDispatch);
     114    this.onNavigated = new EventSink("inspectedURLChanged");
    114115}
    115116
     
    357358function InspectedWindow()
    358359{
    359     this.onDOMContentLoaded = new EventSink("inspectedPageDOMContentLoaded");
    360     this.onLoaded = new EventSink("inspectedPageLoaded");
    361     this.onNavigated = new EventSink("inspectedURLChanged");
    362360}
    363361
  • trunk/Source/WebCore/inspector/front-end/ExtensionAPISchema.json

    r82806 r83033  
    166166            "type": "string",
    167167            "description": "An URL of the page that represents this panel."
    168           }
    169         ],
    170         "returns" : {
    171           "$ref": "ExtensionPanel",
    172           "description": "A panel that was created."
    173         }
     168          },
     169          {
     170            "name": "callback",
     171            "type": "function",
     172            "description": "A function that is called upon request completion.",
     173            "parameters": [
     174              {
     175                "name": "panel",
     176                "description": "An ExtensionPanel object representing the created panel.",
     177                "$ref": "ExtensionPanel"
     178              }
     179            ]
     180          }
     181        ]
    174182      }
    175183    ]
     
    239247          { "name": "resource", "$ref": "Resource" }
    240248        ]
     249      },
     250      {
     251        "name": "onNavigation",
     252        "type": "function",
     253        "description": "Fired when an inspected window navigates to a new URL.",
     254        "parameters": [
     255          {
     256            "name": "url",
     257            "type": "stirng",
     258            "description": "URL of the new page."
     259          }
     260        ]
    241261      }
    242262    ]
  • trunk/Source/WebCore/inspector/front-end/ExtensionServer.js

    r82832 r83033  
    8080    },
    8181
    82     notifyPageLoaded: function(milliseconds)
    83     {
    84         this._postNotification("inspectedPageLoaded", milliseconds);
    85     },
    86 
    87     notifyPageDOMContentLoaded: function(milliseconds)
    88     {
    89         this._postNotification("inspectedPageDOMContentLoaded", milliseconds);
    90     },
    91 
    92     notifyInspectedURLChanged: function()
    93     {
    94         this._postNotification("inspectedURLChanged");
     82    notifyInspectedURLChanged: function(url)
     83    {
     84        this._postNotification("inspectedURLChanged", url);
    9585    },
    9686
  • trunk/Source/WebCore/inspector/front-end/inspector.js

    r82685 r83033  
    990990    if (this.panels.network)
    991991        this.panels.network.mainResourceDOMContentTime = time;
    992     this.extensionServer.notifyPageDOMContentLoaded((time - WebInspector.mainResource.startTime) * 1000);
    993992    this.mainResourceDOMContentTime = time;
    994993}
     
    999998    this.panels.network.mainResourceLoadTime = time;
    1000999    this.panels.resources.loadEventFired();
    1001     this.extensionServer.notifyPageLoaded((time - WebInspector.mainResource.startTime) * 1000);
    10021000    this.mainResourceLoadTime = time;
    10031001}
     
    10391037    InspectorFrontendHost.inspectedURLChanged(url);
    10401038    this.settings.inspectedURLChanged(url);
    1041     this.extensionServer.notifyInspectedURLChanged();
     1039    this.extensionServer.notifyInspectedURLChanged(url);
    10421040}
    10431041
Note: See TracChangeset for help on using the changeset viewer.