Title: [127417] trunk/Source/WebCore
Revision
127417
Author
[email protected]
Date
2012-09-03 06:20:02 -0700 (Mon, 03 Sep 2012)

Log Message

Web Inspector: rename _javascript_ContextManager to RuntimeModel for consistency.
https://bugs.webkit.org/show_bug.cgi?id=95677

Reviewed by Yury Semikhatsky.

- renamed the file and the usages
- renamed isolatedContextCreated to executionContextCreated for consistency.

* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* inspector/Inspector.json:
* inspector/PageRuntimeAgent.cpp:
(WebCore::PageRuntimeAgent::notifyContextCreated):
* inspector/compile-front-end.py:
* inspector/front-end/RuntimeModel.js: Renamed from Source/WebCore/inspector/front-end/_javascript_ContextManager.js.
(WebInspector.RuntimeModel):
(WebInspector.RuntimeModel.prototype._frameAdded):
(WebInspector.RuntimeModel.prototype._frameDetached):
(WebInspector.RuntimeModel.prototype._executionContextCreated):
(WebInspector.RuntimeDispatcher):
(WebInspector.RuntimeDispatcher.prototype.executionContextCreated):
* inspector/front-end/WebKit.qrc:
* inspector/front-end/inspector.html:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (127416 => 127417)


--- trunk/Source/WebCore/ChangeLog	2012-09-03 10:26:24 UTC (rev 127416)
+++ trunk/Source/WebCore/ChangeLog	2012-09-03 13:20:02 UTC (rev 127417)
@@ -1,3 +1,29 @@
+2012-09-03  Pavel Feldman  <[email protected]>
+
+        Web Inspector: rename _javascript_ContextManager to RuntimeModel for consistency.
+        https://bugs.webkit.org/show_bug.cgi?id=95677
+
+        Reviewed by Yury Semikhatsky.
+
+        - renamed the file and the usages
+        - renamed isolatedContextCreated to executionContextCreated for consistency.
+
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * inspector/Inspector.json:
+        * inspector/PageRuntimeAgent.cpp:
+        (WebCore::PageRuntimeAgent::notifyContextCreated):
+        * inspector/compile-front-end.py:
+        * inspector/front-end/RuntimeModel.js: Renamed from Source/WebCore/inspector/front-end/_javascript_ContextManager.js.
+        (WebInspector.RuntimeModel):
+        (WebInspector.RuntimeModel.prototype._frameAdded):
+        (WebInspector.RuntimeModel.prototype._frameDetached):
+        (WebInspector.RuntimeModel.prototype._executionContextCreated):
+        (WebInspector.RuntimeDispatcher):
+        (WebInspector.RuntimeDispatcher.prototype.executionContextCreated):
+        * inspector/front-end/WebKit.qrc:
+        * inspector/front-end/inspector.html:
+
 2012-09-03  Andrey Kosyakov  <[email protected]>
 
         Web Inspector: use linkifyResourceAsNode, not linkifyLocation when linkifying resources in Timeline

Modified: trunk/Source/WebCore/WebCore.gypi (127416 => 127417)


--- trunk/Source/WebCore/WebCore.gypi	2012-09-03 10:26:24 UTC (rev 127416)
+++ trunk/Source/WebCore/WebCore.gypi	2012-09-03 13:20:02 UTC (rev 127417)
@@ -6344,7 +6344,6 @@
             'inspector/front-end/InspectorFrontendHostStub.js',
             'inspector/front-end/InspectorView.js',
             'inspector/front-end/inspector.js',
-            'inspector/front-end/_javascript_ContextManager.js',
             'inspector/front-end/_javascript_Formatter.js',
             'inspector/front-end/_javascript_Source.js',
             'inspector/front-end/jsdifflib.js',
@@ -6374,6 +6373,7 @@
             'inspector/front-end/ResourceType.js',
             'inspector/front-end/ResourceUtils.js',
             'inspector/front-end/ResourceView.js',
+            'inspector/front-end/RuntimeModel.js',
             'inspector/front-end/SASSSourceMapping.js',
             'inspector/front-end/Script.js',
             'inspector/front-end/ScriptFormatter.js',

Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (127416 => 127417)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-09-03 10:26:24 UTC (rev 127416)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-09-03 13:20:02 UTC (rev 127417)
@@ -76234,10 +76234,6 @@
 					>
 				</File>
 				<File
-					RelativePath="..\inspector\front-end\_javascript_ContextManager.js"
-					>
-				</File>
-				<File
 					RelativePath="..\inspector\front-end\_javascript_Formatter.js"
 					>
 				</File>
@@ -76466,6 +76462,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\inspector\front-end\RuntimeModel.js"
+					>
+				</File>
+				<File
 					RelativePath="..\inspector\front-end\resourceView.css"
 					>
 				</File>

Modified: trunk/Source/WebCore/inspector/Inspector.json (127416 => 127417)


--- trunk/Source/WebCore/inspector/Inspector.json	2012-09-03 10:26:24 UTC (rev 127416)
+++ trunk/Source/WebCore/inspector/Inspector.json	2012-09-03 13:20:02 UTC (rev 127417)
@@ -594,17 +594,18 @@
                     { "name": "enabled", "type": "boolean", "description": "Reporting enabled state." }
                 ],
                 "hidden": true,
-                "description": "Enables reporting about creation of isolated contexts by means of <code>isolatedContextCreated</code> event. When the reporting gets enabled the event will be sent immediately for each existing isolated context."
+                "description": "Enables reporting about creation of execution contexts by means of <code>executionContextCreated</code> event. When the reporting gets enabled the event will be sent immediately for each existing execution context."
             }
 
         ],
         "events": [
             {
-                "name": "isolatedContextCreated",
+                "name": "executionContextCreated",
                 "parameters": [
-                    { "name": "context", "$ref": "ExecutionContextDescription", "description": "A newly created isolated contex." }
+                    { "name": "context", "$ref": "ExecutionContextDescription", "description": "A newly created execution contex." }
                 ],
-                "description": "Issued when new isolated context is created."
+                "hidden": true,
+                "description": "Issued when new execution context is created."
             }
         ]
     },

Modified: trunk/Source/WebCore/inspector/PageRuntimeAgent.cpp (127416 => 127417)


--- trunk/Source/WebCore/inspector/PageRuntimeAgent.cpp	2012-09-03 10:26:24 UTC (rev 127416)
+++ trunk/Source/WebCore/inspector/PageRuntimeAgent.cpp	2012-09-03 13:20:02 UTC (rev 127417)
@@ -160,7 +160,7 @@
     ASSERT(securityOrigin || isPageContext);
     int executionContextId = injectedScriptManager()->injectedScriptIdFor(scriptState);
     String name = securityOrigin ? securityOrigin->toString() : "";
-    m_frontend->isolatedContextCreated(ExecutionContextDescription::create()
+    m_frontend->executionContextCreated(ExecutionContextDescription::create()
         .setId(executionContextId)
         .setIsPageContext(isPageContext)
         .setName(name)

Modified: trunk/Source/WebCore/inspector/compile-front-end.py (127416 => 127417)


--- trunk/Source/WebCore/inspector/compile-front-end.py	2012-09-03 10:26:24 UTC (rev 127416)
+++ trunk/Source/WebCore/inspector/compile-front-end.py	2012-09-03 13:20:02 UTC (rev 127417)
@@ -169,9 +169,9 @@
             "FontView.js",
             "ImageView.js",
             "NativeBreakpointsSidebarPane.js",
-            "_javascript_ContextManager.js",
             "ObjectPopoverHelper.js",
             "ObjectPropertiesSection.js",
+            "RuntimeModel.js",
             "SourceFrame.js",
             "ResourceView.js",
         ]

Modified: trunk/Source/WebCore/inspector/front-end/ConsoleView.js (127416 => 127417)


--- trunk/Source/WebCore/inspector/front-end/ConsoleView.js	2012-09-03 10:26:24 UTC (rev 127416)
+++ trunk/Source/WebCore/inspector/front-end/ConsoleView.js	2012-09-03 13:20:02 UTC (rev 127417)
@@ -121,9 +121,9 @@
     this.prompt.proxyElement.addEventListener("keydown", this._promptKeyDown.bind(this), false);
     this.prompt.setHistoryData(WebInspector.settings.consoleHistory.get());
 
-    WebInspector._javascript_ContextManager.contextLists().forEach(this._addFrame, this);
-    WebInspector._javascript_ContextManager.addEventListener(WebInspector._javascript_ContextManager.Events.FrameExecutionContextListAdded, this._frameAdded, this);
-    WebInspector._javascript_ContextManager.addEventListener(WebInspector._javascript_ContextManager.Events.FrameExecutionContextListRemoved, this._frameRemoved, this);
+    WebInspector.runtimeModel.contextLists().forEach(this._addFrame, this);
+    WebInspector.runtimeModel.addEventListener(WebInspector.RuntimeModel.Events.FrameExecutionContextListAdded, this._frameAdded, this);
+    WebInspector.runtimeModel.addEventListener(WebInspector.RuntimeModel.Events.FrameExecutionContextListRemoved, this._frameRemoved, this);
 }
 
 WebInspector.ConsoleView.Events = {

Modified: trunk/Source/WebCore/inspector/front-end/ExtensionServer.js (127416 => 127417)


--- trunk/Source/WebCore/inspector/front-end/ExtensionServer.js	2012-09-03 10:26:24 UTC (rev 127416)
+++ trunk/Source/WebCore/inspector/front-end/ExtensionServer.js	2012-09-03 13:20:02 UTC (rev 127417)
@@ -767,7 +767,7 @@
             var mainFrame = WebInspector.resourceTreeModel.mainFrame;
             if (!mainFrame)
                 return this._status.E_FAILED("main frame not available yet");
-            var context = WebInspector._javascript_ContextManager.contextByFrameAndSecurityOrigin(mainFrame, securityOrigin);
+            var context = WebInspector.runtimeModel.contextByFrameAndSecurityOrigin(mainFrame, securityOrigin);
             if (!context)
                 return this._status.E_NOTFOUND(securityOrigin);
             contextId = context.id;

Deleted: trunk/Source/WebCore/inspector/front-end/_javascript_ContextManager.js (127416 => 127417)


--- trunk/Source/WebCore/inspector/front-end/_javascript_ContextManager.js	2012-09-03 10:26:24 UTC (rev 127416)
+++ trunk/Source/WebCore/inspector/front-end/_javascript_ContextManager.js	2012-09-03 13:20:02 UTC (rev 127417)
@@ -1,237 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @constructor
- * @extends {WebInspector.Object}
- * @param {WebInspector.ResourceTreeModel} resourceTreeModel
- */
-WebInspector._javascript_ContextManager = function(resourceTreeModel)
-{
-    resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameAdded, this._frameAdded, this);
-    resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated, this._frameNavigated, this);
-    resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameDetached, this._frameDetached, this);
-    resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.CachedResourcesLoaded, this._didLoadCachedResources, this);
-    this._frameIdToContextList = {};
-}
-
-WebInspector._javascript_ContextManager.Events = {
-    FrameExecutionContextListAdded: "FrameExecutionContextListAdded",
-    FrameExecutionContextListRemoved: "FrameExecutionContextListRemoved",
-}
-
-WebInspector._javascript_ContextManager.prototype = {
-    /**
-     * @return {Array.<WebInspector.FrameExecutionContextList>}
-     */
-    contextLists: function()
-    {
-        return Object.values(this._frameIdToContextList);
-    },
-
-    /**
-     * @param {WebInspector.ResourceTreeFrame} frame
-     * @param {string} securityOrigin
-     */
-    contextByFrameAndSecurityOrigin: function(frame, securityOrigin)
-    {
-        var frameContext = this._frameIdToContextList[frame.id];
-        return frameContext && frameContext.contextBySecurityOrigin(securityOrigin);
-    },
-
-    _frameAdded: function(event)
-    {
-        var frame = event.data;
-        var context = new WebInspector.FrameExecutionContextList(frame);
-        this._frameIdToContextList[frame.id] = context;
-        this.dispatchEventToListeners(WebInspector._javascript_ContextManager.Events.FrameExecutionContextListAdded, context);
-    },
-
-    _frameNavigated: function(event)
-    {
-        var frame = event.data;
-        var context = this._frameIdToContextList[frame.id];
-        if (context)
-            context._frameNavigated(frame);
-    },
-
-    _frameDetached: function(event)
-    {
-        var frame = event.data;
-        var context = this._frameIdToContextList[frame.id];
-        if (!context)
-            return;
-        this.dispatchEventToListeners(WebInspector._javascript_ContextManager.Events.FrameExecutionContextListRemoved, context);
-        delete this._frameIdToContextList[frame.id];
-    },
-
-    _didLoadCachedResources: function()
-    {
-        InspectorBackend.registerRuntimeDispatcher(new WebInspector.RuntimeDispatcher(this));
-        RuntimeAgent.setReportExecutionContextCreation(true);
-    },
-
-    isolatedContextCreated: function(context)
-    {
-        var contextList = this._frameIdToContextList[context.frameId];
-        // FIXME(85708): this should never happen
-        if (!contextList)
-            return;
-        contextList._addExecutionContext(new WebInspector.ExecutionContext(context.id, context.name, context.isPageContext));
-    }
-}
-
-WebInspector._javascript_ContextManager.prototype.__proto__ = WebInspector.Object.prototype;
-
-/**
- * @type {WebInspector._javascript_ContextManager}
- */
-WebInspector._javascript_ContextManager = null;
-
-/**
- * @constructor
- * @implements {RuntimeAgent.Dispatcher}
- * @param {WebInspector._javascript_ContextManager} contextManager
- */
-WebInspector.RuntimeDispatcher = function(contextManager)
-{
-    this._contextManager = contextManager;
-}
-
-WebInspector.RuntimeDispatcher.prototype = {
-    isolatedContextCreated: function(context)
-    {
-        this._contextManager.isolatedContextCreated(context);
-    }
-}
-
-/**
- * @constructor
- * @extends {WebInspector.Object}
- */
-WebInspector.ExecutionContext = function(id, name, isPageContext)
-{
-    this.id = id;
-    this.name = (isPageContext && !name) ? "<page context>" : name;
-    this.isMainWorldContext = isPageContext;
-}
-
-/**
- * @param {*} a
- * @param {*} b
- * @return {number}
- */
-WebInspector.ExecutionContext.comparator = function(a, b)
-{
-    // Main world context should always go first.
-    if (a.isMainWorldContext)
-        return -1;
-    if (b.isMainWorldContext)
-        return +1;
-    return a.name.localeCompare(b.name);
-}
-
-/**
- * @constructor
- * @extends {WebInspector.Object}
- */
-WebInspector.FrameExecutionContextList = function(frame)
-{
-    this._frame = frame;
-    this._executionContexts = [];
-}
-
-WebInspector.FrameExecutionContextList.EventTypes = {
-    ContextsUpdated: "ContextsUpdated",
-    ContextAdded: "ContextAdded"
-}
-
-WebInspector.FrameExecutionContextList.prototype =
-{
-    _frameNavigated: function(frame)
-    {
-        this._frame = frame;
-        this._executionContexts = [];
-        this.dispatchEventToListeners(WebInspector.FrameExecutionContextList.EventTypes.ContextsUpdated, this);
-    },
-
-    /**
-     * @param {WebInspector.ExecutionContext} context
-     */
-    _addExecutionContext: function(context)
-    {
-        var insertAt = insertionIndexForObjectInListSortedByFunction(context, this._executionContexts, WebInspector.ExecutionContext.comparator);
-        this._executionContexts.splice(insertAt, 0, context);
-        this.dispatchEventToListeners(WebInspector.FrameExecutionContextList.EventTypes.ContextAdded, this);
-    },
-
-    executionContexts: function()
-    {
-        return this._executionContexts;
-    },
-
-    /**
-     * @param {string} securityOrigin
-     */
-    contextBySecurityOrigin: function(securityOrigin)
-    {
-        for (var i = 0; i < this._executionContexts.length; ++i) {
-            var context = this._executionContexts[i];
-            if (!context.isMainWorldContext && context.name === securityOrigin)
-                return context; 
-        }
-    },
-
-    get frameId()
-    {
-        return this._frame.id;
-    },
-
-    get url()
-    {
-        return this._frame.url;
-    },
-
-    get displayName()
-    {
-        if (!this._frame.parentFrame)
-            return "<top frame>";
-        var name = this._frame.name || "";
-        var subtitle = new WebInspector.ParsedURL(this._frame.url).displayName;
-        if (subtitle) {
-            if (!name)
-                return subtitle;
-            return name + "( " + subtitle + " )";
-        }
-        return "<iframe>";
-    }
-}
-
-WebInspector.FrameExecutionContextList.prototype.__proto__ = WebInspector.Object.prototype;

Copied: trunk/Source/WebCore/inspector/front-end/RuntimeModel.js (from rev 127416, trunk/Source/WebCore/inspector/front-end/_javascript_ContextManager.js) (0 => 127417)


--- trunk/Source/WebCore/inspector/front-end/RuntimeModel.js	                        (rev 0)
+++ trunk/Source/WebCore/inspector/front-end/RuntimeModel.js	2012-09-03 13:20:02 UTC (rev 127417)
@@ -0,0 +1,237 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @constructor
+ * @extends {WebInspector.Object}
+ * @param {WebInspector.ResourceTreeModel} resourceTreeModel
+ */
+WebInspector.RuntimeModel = function(resourceTreeModel)
+{
+    resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameAdded, this._frameAdded, this);
+    resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated, this._frameNavigated, this);
+    resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameDetached, this._frameDetached, this);
+    resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.CachedResourcesLoaded, this._didLoadCachedResources, this);
+    this._frameIdToContextList = {};
+}
+
+WebInspector.RuntimeModel.Events = {
+    FrameExecutionContextListAdded: "FrameExecutionContextListAdded",
+    FrameExecutionContextListRemoved: "FrameExecutionContextListRemoved",
+}
+
+WebInspector.RuntimeModel.prototype = {
+    /**
+     * @return {Array.<WebInspector.FrameExecutionContextList>}
+     */
+    contextLists: function()
+    {
+        return Object.values(this._frameIdToContextList);
+    },
+
+    /**
+     * @param {WebInspector.ResourceTreeFrame} frame
+     * @param {string} securityOrigin
+     */
+    contextByFrameAndSecurityOrigin: function(frame, securityOrigin)
+    {
+        var frameContext = this._frameIdToContextList[frame.id];
+        return frameContext && frameContext.contextBySecurityOrigin(securityOrigin);
+    },
+
+    _frameAdded: function(event)
+    {
+        var frame = event.data;
+        var context = new WebInspector.FrameExecutionContextList(frame);
+        this._frameIdToContextList[frame.id] = context;
+        this.dispatchEventToListeners(WebInspector.RuntimeModel.Events.FrameExecutionContextListAdded, context);
+    },
+
+    _frameNavigated: function(event)
+    {
+        var frame = event.data;
+        var context = this._frameIdToContextList[frame.id];
+        if (context)
+            context._frameNavigated(frame);
+    },
+
+    _frameDetached: function(event)
+    {
+        var frame = event.data;
+        var context = this._frameIdToContextList[frame.id];
+        if (!context)
+            return;
+        this.dispatchEventToListeners(WebInspector.RuntimeModel.Events.FrameExecutionContextListRemoved, context);
+        delete this._frameIdToContextList[frame.id];
+    },
+
+    _didLoadCachedResources: function()
+    {
+        InspectorBackend.registerRuntimeDispatcher(new WebInspector.RuntimeDispatcher(this));
+        RuntimeAgent.setReportExecutionContextCreation(true);
+    },
+
+    _executionContextCreated: function(context)
+    {
+        var contextList = this._frameIdToContextList[context.frameId];
+        // FIXME(85708): this should never happen
+        if (!contextList)
+            return;
+        contextList._addExecutionContext(new WebInspector.ExecutionContext(context.id, context.name, context.isPageContext));
+    }
+}
+
+WebInspector.RuntimeModel.prototype.__proto__ = WebInspector.Object.prototype;
+
+/**
+ * @type {WebInspector.RuntimeModel}
+ */
+WebInspector.runtimeModel = null;
+
+/**
+ * @constructor
+ * @implements {RuntimeAgent.Dispatcher}
+ * @param {WebInspector.RuntimeModel} runtimeModel
+ */
+WebInspector.RuntimeDispatcher = function(runtimeModel)
+{
+    this._runtimeModel = runtimeModel;
+}
+
+WebInspector.RuntimeDispatcher.prototype = {
+    executionContextCreated: function(context)
+    {
+        this._runtimeModel._executionContextCreated(context);
+    }
+}
+
+/**
+ * @constructor
+ * @extends {WebInspector.Object}
+ */
+WebInspector.ExecutionContext = function(id, name, isPageContext)
+{
+    this.id = id;
+    this.name = (isPageContext && !name) ? "<page context>" : name;
+    this.isMainWorldContext = isPageContext;
+}
+
+/**
+ * @param {*} a
+ * @param {*} b
+ * @return {number}
+ */
+WebInspector.ExecutionContext.comparator = function(a, b)
+{
+    // Main world context should always go first.
+    if (a.isMainWorldContext)
+        return -1;
+    if (b.isMainWorldContext)
+        return +1;
+    return a.name.localeCompare(b.name);
+}
+
+/**
+ * @constructor
+ * @extends {WebInspector.Object}
+ */
+WebInspector.FrameExecutionContextList = function(frame)
+{
+    this._frame = frame;
+    this._executionContexts = [];
+}
+
+WebInspector.FrameExecutionContextList.EventTypes = {
+    ContextsUpdated: "ContextsUpdated",
+    ContextAdded: "ContextAdded"
+}
+
+WebInspector.FrameExecutionContextList.prototype =
+{
+    _frameNavigated: function(frame)
+    {
+        this._frame = frame;
+        this._executionContexts = [];
+        this.dispatchEventToListeners(WebInspector.FrameExecutionContextList.EventTypes.ContextsUpdated, this);
+    },
+
+    /**
+     * @param {WebInspector.ExecutionContext} context
+     */
+    _addExecutionContext: function(context)
+    {
+        var insertAt = insertionIndexForObjectInListSortedByFunction(context, this._executionContexts, WebInspector.ExecutionContext.comparator);
+        this._executionContexts.splice(insertAt, 0, context);
+        this.dispatchEventToListeners(WebInspector.FrameExecutionContextList.EventTypes.ContextAdded, this);
+    },
+
+    executionContexts: function()
+    {
+        return this._executionContexts;
+    },
+
+    /**
+     * @param {string} securityOrigin
+     */
+    contextBySecurityOrigin: function(securityOrigin)
+    {
+        for (var i = 0; i < this._executionContexts.length; ++i) {
+            var context = this._executionContexts[i];
+            if (!context.isMainWorldContext && context.name === securityOrigin)
+                return context; 
+        }
+    },
+
+    get frameId()
+    {
+        return this._frame.id;
+    },
+
+    get url()
+    {
+        return this._frame.url;
+    },
+
+    get displayName()
+    {
+        if (!this._frame.parentFrame)
+            return "<top frame>";
+        var name = this._frame.name || "";
+        var subtitle = new WebInspector.ParsedURL(this._frame.url).displayName;
+        if (subtitle) {
+            if (!name)
+                return subtitle;
+            return name + "( " + subtitle + " )";
+        }
+        return "<iframe>";
+    }
+}
+
+WebInspector.FrameExecutionContextList.prototype.__proto__ = WebInspector.Object.prototype;

Property changes: trunk/Source/WebCore/inspector/front-end/RuntimeModel.js


Added: svn:eol-style

Modified: trunk/Source/WebCore/inspector/front-end/WebKit.qrc (127416 => 127417)


--- trunk/Source/WebCore/inspector/front-end/WebKit.qrc	2012-09-03 10:26:24 UTC (rev 127416)
+++ trunk/Source/WebCore/inspector/front-end/WebKit.qrc	2012-09-03 13:20:02 UTC (rev 127417)
@@ -94,7 +94,6 @@
     <file>InspectorFrontendAPI.js</file>
     <file>InspectorFrontendHostStub.js</file>
     <file>InspectorView.js</file>
-    <file>_javascript_ContextManager.js</file>
     <file>_javascript_Formatter.js</file>
     <file>_javascript_Source.js</file>
     <file>_javascript_SourceFrame.js</file>
@@ -147,6 +146,7 @@
     <file>ResourceWebSocketFrameView.js</file>
     <file>ResourcesPanel.js</file>
     <file>RevisionHistoryView.js</file>
+    <file>RuntimeModel.js</file>
     <file>SASSSourceMapping.js</file>
     <file>ScopeChainSidebarPane.js</file>
     <file>Script.js</file>

Modified: trunk/Source/WebCore/inspector/front-end/inspector.html (127416 => 127417)


--- trunk/Source/WebCore/inspector/front-end/inspector.html	2012-09-03 10:26:24 UTC (rev 127416)
+++ trunk/Source/WebCore/inspector/front-end/inspector.html	2012-09-03 13:20:02 UTC (rev 127417)
@@ -156,7 +156,7 @@
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
-    <script type="text/_javascript_" src=""
+    <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""

Modified: trunk/Source/WebCore/inspector/front-end/inspector.js (127416 => 127417)


--- trunk/Source/WebCore/inspector/front-end/inspector.js	2012-09-03 10:26:24 UTC (rev 127416)
+++ trunk/Source/WebCore/inspector/front-end/inspector.js	2012-09-03 13:20:02 UTC (rev 127417)
@@ -491,7 +491,7 @@
     this.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this);
     this.networkLog = new WebInspector.NetworkLog();
     this.domAgent = new WebInspector.DOMAgent();
-    this._javascript_ContextManager = new WebInspector._javascript_ContextManager(this.resourceTreeModel);
+    this.runtimeModel = new WebInspector.RuntimeModel(this.resourceTreeModel);
 
     this.consoleView = new WebInspector.ConsoleView(WebInspector.WorkerManager.isWorkerFrontend());
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to