Diff
Modified: trunk/LayoutTests/ChangeLog (127411 => 127412)
--- trunk/LayoutTests/ChangeLog 2012-09-03 08:50:35 UTC (rev 127411)
+++ trunk/LayoutTests/ChangeLog 2012-09-03 08:54:43 UTC (rev 127412)
@@ -1,3 +1,13 @@
+2012-08-31 Pavel Feldman <[email protected]>
+
+ Web Inspector: get rid of context execution id fallback.
+ https://bugs.webkit.org/show_bug.cgi?id=95567
+
+ Reviewed by Yury Semikhatsky.
+
+ * http/tests/inspector/console-cd-completions.html:
+ * http/tests/inspector/console-cd.html:
+
2012-09-03 Yoshifumi Inoue <[email protected]>
Unreviewed rebaseline for bug 94287.
Modified: trunk/LayoutTests/http/tests/inspector/console-cd-completions.html (127411 => 127412)
--- trunk/LayoutTests/http/tests/inspector/console-cd-completions.html 2012-09-03 08:50:35 UTC (rev 127411)
+++ trunk/LayoutTests/http/tests/inspector/console-cd-completions.html 2012-09-03 08:54:43 UTC (rev 127412)
@@ -7,7 +7,7 @@
function test()
{
InspectorTest.showConsolePanel();
- var selector = WebInspector.consoleView._contextSelector._selectElement;
+ var selector = WebInspector.consoleView._frameSelector._selectElement;
var option = selector.firstChild;
while (option) {
if (option.textContent && option.textContent.indexOf("myIFrame") === 0)
@@ -20,8 +20,8 @@
return;
}
option.selected = true;
+ WebInspector.consoleView._frameChanged();
-
WebInspector.consoleView.completionsForExpression("", "myGlob", false, checkCompletions.bind(this));
function checkCompletions(completions)
{
Modified: trunk/LayoutTests/http/tests/inspector/console-cd.html (127411 => 127412)
--- trunk/LayoutTests/http/tests/inspector/console-cd.html 2012-09-03 08:50:35 UTC (rev 127411)
+++ trunk/LayoutTests/http/tests/inspector/console-cd.html 2012-09-03 08:54:43 UTC (rev 127412)
@@ -8,7 +8,7 @@
function test()
{
InspectorTest.showConsolePanel();
- var selector = WebInspector.consoleView._contextSelector._selectElement;
+ var selector = WebInspector.consoleView._frameSelector._selectElement;
var option = selector.firstChild;
while (option) {
if (option.textContent && option.textContent.indexOf("myIFrame") === 0)
@@ -21,6 +21,8 @@
return;
}
option.selected = true;
+ WebInspector.consoleView._frameChanged();
+
InspectorTest.evaluateInConsoleAndDump("foo", finish);
function finish()
{
Modified: trunk/Source/WebCore/ChangeLog (127411 => 127412)
--- trunk/Source/WebCore/ChangeLog 2012-09-03 08:50:35 UTC (rev 127411)
+++ trunk/Source/WebCore/ChangeLog 2012-09-03 08:54:43 UTC (rev 127412)
@@ -1,3 +1,39 @@
+2012-08-31 Pavel Feldman <[email protected]>
+
+ Web Inspector: get rid of context execution id fallback.
+ https://bugs.webkit.org/show_bug.cgi?id=95567
+
+ Reviewed by Yury Semikhatsky.
+
+ We now assign execution context id upon changes in the UI.
+
+ * inspector/front-end/ConsoleView.js:
+ (WebInspector.ConsoleView.prototype.get statusBarItems):
+ (WebInspector.ConsoleView.prototype._contextAdded):
+ (WebInspector.ConsoleView.prototype._addContextList):
+ (WebInspector.ConsoleView.prototype._contextListRemoved):
+ (WebInspector.ConsoleView.prototype._updateExecutionContextSelector):
+ (WebInspector.ConsoleView.prototype._appendExecutionContextOption):
+ (WebInspector.ConsoleView.prototype._executionContextChanged):
+ (WebInspector.ConsoleView.prototype._contextListUpdated):
+ (WebInspector.ConsoleView.prototype._addedExecutionContext):
+ (WebInspector.ConsoleView.prototype.evalInInspectedWindow.evalCallback):
+ (WebInspector.ConsoleView.prototype.evalInInspectedWindow):
+ (WebInspector.ConsoleView.prototype._enterKeyPressed):
+ * inspector/front-end/_javascript_ContextManager.js:
+ (WebInspector._javascript_ContextManager):
+ (WebInspector._javascript_ContextManager.prototype.contextLists):
+ (WebInspector._javascript_ContextManager.prototype.contextByFrameAndSecurityOrigin):
+ (WebInspector._javascript_ContextManager.prototype._frameAdded):
+ (WebInspector._javascript_ContextManager.prototype._frameNavigated):
+ (WebInspector._javascript_ContextManager.prototype._frameDetached):
+ (WebInspector._javascript_ContextManager.prototype.isolatedContextCreated):
+ (WebInspector.FrameExecutionContextList):
+ (WebInspector.FrameExecutionContextList.prototype._frameNavigated):
+ (WebInspector.FrameExecutionContextList.prototype._addExecutionContext):
+ (WebInspector.FrameExecutionContextList.prototype.executionContexts):
+ (WebInspector.FrameExecutionContextList.prototype.contextBySecurityOrigin):
+
2012-09-03 Grzegorz Czajkowski <[email protected]>
[GTK][EFL] 'dictIter' iterator is not initialized for an inner loop
Modified: trunk/Source/WebCore/inspector/front-end/ConsoleView.js (127411 => 127412)
--- trunk/Source/WebCore/inspector/front-end/ConsoleView.js 2012-09-03 08:50:35 UTC (rev 127411)
+++ trunk/Source/WebCore/inspector/front-end/ConsoleView.js 2012-09-03 08:54:43 UTC (rev 127412)
@@ -44,12 +44,12 @@
this._clearConsoleButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear console log."), "clear-status-bar-item");
this._clearConsoleButton.addEventListener("click", this._requestClearMessages, this);
- this._contextSelector = new WebInspector.StatusBarComboBox(this._updateIsolatedWorldSelector.bind(this), "console-context");
- this._isolatedWorldSelector = new WebInspector.StatusBarComboBox(null, "console-context");
+ this._frameSelector = new WebInspector.StatusBarComboBox(this._frameChanged.bind(this), "console-context");
+ this._contextSelector = new WebInspector.StatusBarComboBox(this._contextChanged.bind(this), "console-context");
if (hideContextSelector) {
+ this._frameSelector.element.addStyleClass("hidden");
this._contextSelector.element.addStyleClass("hidden");
- this._isolatedWorldSelector.element.addStyleClass("hidden");
}
this.messagesElement = document.createElement("div");
@@ -73,14 +73,17 @@
this._filterBarElement = document.createElement("div");
this._filterBarElement.className = "scope-bar status-bar-item";
- function createDividerElement() {
+ function createDividerElement()
+ {
var dividerElement = document.createElement("div");
dividerElement.addStyleClass("scope-bar-divider");
this._filterBarElement.appendChild(dividerElement);
}
var updateFilterHandler = this._updateFilter.bind(this);
- function createFilterElement(category, label) {
+
+ function createFilterElement(category, label)
+ {
var categoryElement = document.createElement("li");
categoryElement.category = category;
categoryElement.className = category;
@@ -118,9 +121,9 @@
this.prompt.proxyElement.addEventListener("keydown", this._promptKeyDown.bind(this), false);
this.prompt.setHistoryData(WebInspector.settings.consoleHistory.get());
- WebInspector._javascript_ContextManager.contexts().forEach(this._addContext, this);
- WebInspector._javascript_ContextManager.addEventListener(WebInspector._javascript_ContextManager.Events.FrameContextAdded, this._contextAdded, this);
- WebInspector._javascript_ContextManager.addEventListener(WebInspector._javascript_ContextManager.Events.FrameContextRemoved, this._contextRemoved, this);
+ 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.ConsoleView.Events = {
@@ -131,119 +134,120 @@
WebInspector.ConsoleView.prototype = {
get statusBarItems()
{
- return [this._clearConsoleButton.element, this._contextSelector.element, this._isolatedWorldSelector.element, this._filterBarElement];
+ return [this._clearConsoleButton.element, this._frameSelector.element, this._contextSelector.element, this._filterBarElement];
},
/**
* @param {WebInspector.Event} event
*/
- _contextAdded: function(event)
+ _frameAdded: function(event)
{
- var context = /** @type {WebInspector.FrameEvaluationContext} */ event.data;
- this._addContext(context);
+ var contextList = /** @type {WebInspector.FrameExecutionContextList} */ event.data;
+ this._addFrame(contextList);
},
/**
- * @param {WebInspector.FrameEvaluationContext} context
+ * @param {WebInspector.FrameExecutionContextList} contextList
*/
- _addContext: function(context)
+ _addFrame: function(contextList)
{
var option = document.createElement("option");
- option.text = context.displayName;
- option.title = context.url;
- option._context = context;
- context._consoleOption = option;
- this._contextSelector.addOption(option);
- context.addEventListener(WebInspector.FrameEvaluationContext.EventTypes.Updated, this._contextUpdated, this);
- context.addEventListener(WebInspector.FrameEvaluationContext.EventTypes.AddedExecutionContext, this._addedExecutionContext, this);
- this._updateIsolatedWorldSelector();
+ option.text = contextList.displayName;
+ option.title = contextList.url;
+ option._contextList = contextList;
+ contextList._consoleOption = option;
+ this._frameSelector.addOption(option);
+ contextList.addEventListener(WebInspector.FrameExecutionContextList.EventTypes.ContextsUpdated, this._frameUpdated, this);
+ contextList.addEventListener(WebInspector.FrameExecutionContextList.EventTypes.ContextAdded, this._contextAdded, this);
+ this._frameChanged();
},
/**
* @param {WebInspector.Event} event
*/
- _contextRemoved: function(event)
+ _frameRemoved: function(event)
{
- var context = /** @type {WebInspector.FrameEvaluationContext} */ event.data;
- this._contextSelector.removeOption(context._consoleOption);
- this._updateIsolatedWorldSelector();
+ var contextList = /** @type {WebInspector.FrameExecutionContextList} */ event.data;
+ this._frameSelector.removeOption(contextList._consoleOption);
+ this._frameChanged();
},
- _updateIsolatedWorldSelector: function()
+ _frameChanged: function()
{
- var context = this._currentEvaluationContext();
+ var context = this._currentFrame();
if (!context) {
- this._isolatedWorldSelector.element.addStyleClass("hidden");
+ delete this._currentExecutionContext;
+ this._contextSelector.element.addStyleClass("hidden");
return;
}
- var isolatedContexts = context.isolatedContexts();
- if (!isolatedContexts.length) {
- this._isolatedWorldSelector.element.addStyleClass("hidden");
+ var executionContexts = context.executionContexts();
+ if (executionContexts.length)
+ this._currentExecutionContext = executionContexts[0];
+
+ if (executionContexts.length === 1) {
+ this._contextSelector.element.addStyleClass("hidden");
return;
}
- this._isolatedWorldSelector.element.removeStyleClass("hidden");
- this._isolatedWorldSelector.removeOptions();
- this._appendIsolatedContextOption(context.mainWorldContext());
- for (var i = 0; i < isolatedContexts.length; i++)
- this._appendIsolatedContextOption(isolatedContexts[i]);
+ this._contextSelector.element.removeStyleClass("hidden");
+ this._contextSelector.removeOptions();
+ for (var i = 0; i < executionContexts.length; i++)
+ this._appendContextOption(executionContexts[i]);
},
- _appendIsolatedContextOption: function(isolatedContext)
+ /**
+ * @param {WebInspector.ExecutionContext} executionContext
+ */
+ _appendContextOption: function(executionContext)
{
- if (!isolatedContext)
- return;
+ if (!this._currentExecutionContext)
+ this._currentExecutionContext = executionContext;
var option = document.createElement("option");
- option.text = isolatedContext.name;
- option.title = isolatedContext.id;
- option._executionContextId = isolatedContext.id;
- this._isolatedWorldSelector.addOption(option);
+ option.text = executionContext.name;
+ option.title = executionContext.id;
+ option._executionContext = executionContext;
+ this._contextSelector.addOption(option);
},
- _contextUpdated: function(event)
+ /**
+ * @param {Event} event
+ */
+ _contextChanged: function(event)
{
- var context = event.data;
- var option = context._consoleOption;
- option.text = context.displayName;
- option.title = context.url;
+ var option = this._contextSelector.selectedOption();
+ this._currentExecutionContext = option ? option._executionContext : undefined;
},
- _addedExecutionContext: function(event)
+ /**
+ * @param {WebInspector.Event} event
+ */
+ _frameUpdated: function(event)
{
- var context = event.data;
- if (context === this._currentEvaluationContext())
- this._updateIsolatedWorldSelector();
+ var contextList = /** {WebInspector.FrameExecutionContextList */ event.data;
+ var option = contextList._consoleOption;
+ option.text = contextList.displayName;
+ option.title = contextList.url;
},
- _currentEvaluationContextId: function()
+ /**
+ * @param {WebInspector.Event} event
+ */
+ _contextAdded: function(event)
{
- var result = this._currentIsolatedContextId();
- if (result !== undefined)
- return result;
- var context = this._currentEvaluationContext();
- if (context && context.mainWorldContext())
- return context.mainWorldContext().id;
- return undefined;
+ var contextList = /** {WebInspector.FrameExecutionContextList */ event.data;
+ if (contextList === this._currentFrame())
+ this._frameChanged();
},
- _currentEvaluationContext: function()
+ /**
+ * @return {WebInspector.FrameExecutionContextList|undefined}
+ */
+ _currentFrame: function()
{
- var option = this._contextSelector.selectedOption();
- if (!option)
- return undefined;
- return option._context;
+ var option = this._frameSelector.selectedOption();
+ return option ? option._contextList : undefined;
},
- _currentIsolatedContextId: function()
- {
- if (this._isolatedWorldSelector.element.hasStyleClass("hidden"))
- return undefined;
- var option = this._isolatedWorldSelector.selectedOption();
- if (!option)
- return undefined;
- return option._executionContextId;
- },
-
_updateFilter: function(e)
{
var isMac = WebInspector.isMac();
@@ -706,8 +710,7 @@
else
callback(WebInspector.RemoteObject.fromPayload(result), !!wasThrown);
}
- var contextId = this._currentEvaluationContextId();
- RuntimeAgent.evaluate(_expression_, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, contextId, returnByValue, evalCallback);
+ RuntimeAgent.evaluate(_expression_, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, this._currentExecutionContext ? this._currentExecutionContext.id : undefined, returnByValue, evalCallback);
},
evaluateUsingTextPrompt: function(_expression_, showResultOnly)
@@ -732,8 +735,7 @@
runScript: function(scriptId)
{
- var contextId = WebInspector.consoleView._currentEvaluationContextId();
- DebuggerAgent.runScript(scriptId, contextId, "console", false, runCallback.bind(this));
+ DebuggerAgent.runScript(scriptId, this._currentExecutionContext ? this._currentExecutionContext.id : undefined, "console", false, runCallback.bind(this));
WebInspector.userMetrics.ConsoleEvaluated.record();
/**
Modified: trunk/Source/WebCore/inspector/front-end/_javascript_ContextManager.js (127411 => 127412)
--- trunk/Source/WebCore/inspector/front-end/_javascript_ContextManager.js 2012-09-03 08:50:35 UTC (rev 127411)
+++ trunk/Source/WebCore/inspector/front-end/_javascript_ContextManager.js 2012-09-03 08:54:43 UTC (rev 127412)
@@ -39,21 +39,21 @@
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._frameIdToContext = {};
+ this._frameIdToContextList = {};
}
WebInspector._javascript_ContextManager.Events = {
- FrameContextAdded: "FrameContextAdded",
- FrameContextRemoved: "FrameContextRemoved",
+ FrameExecutionContextListAdded: "FrameExecutionContextListAdded",
+ FrameExecutionContextListRemoved: "FrameExecutionContextListRemoved",
}
WebInspector._javascript_ContextManager.prototype = {
/**
- * @return {Array.<WebInspector.FrameEvaluationContext>}
+ * @return {Array.<WebInspector.FrameExecutionContextList>}
*/
- contexts: function()
+ contextLists: function()
{
- return Object.values(this._frameIdToContext);
+ return Object.values(this._frameIdToContextList);
},
/**
@@ -62,22 +62,22 @@
*/
contextByFrameAndSecurityOrigin: function(frame, securityOrigin)
{
- var frameContext = this._frameIdToContext[frame.id];
+ var frameContext = this._frameIdToContextList[frame.id];
return frameContext && frameContext.contextBySecurityOrigin(securityOrigin);
},
_frameAdded: function(event)
{
var frame = event.data;
- var context = new WebInspector.FrameEvaluationContext(frame);
- this._frameIdToContext[frame.id] = context;
- this.dispatchEventToListeners(WebInspector._javascript_ContextManager.Events.FrameContextAdded, context);
+ 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._frameIdToContext[frame.id];
+ var context = this._frameIdToContextList[frame.id];
if (context)
context._frameNavigated(frame);
},
@@ -85,11 +85,11 @@
_frameDetached: function(event)
{
var frame = event.data;
- var context = this._frameIdToContext[frame.id];
+ var context = this._frameIdToContextList[frame.id];
if (!context)
return;
- this.dispatchEventToListeners(WebInspector._javascript_ContextManager.Events.FrameContextRemoved, context);
- delete this._frameIdToContext[frame.id];
+ this.dispatchEventToListeners(WebInspector._javascript_ContextManager.Events.FrameExecutionContextListRemoved, context);
+ delete this._frameIdToContextList[frame.id];
},
_didLoadCachedResources: function()
@@ -100,11 +100,11 @@
isolatedContextCreated: function(context)
{
- var frameEvaluationContext = this._frameIdToContext[context.frameId];
+ var contextList = this._frameIdToContextList[context.frameId];
// FIXME(85708): this should never happen
- if (!frameEvaluationContext)
+ if (!contextList)
return;
- frameEvaluationContext._addExecutionContext(new WebInspector.ExecutionContext(context.id, context.name, context.isPageContext));
+ contextList._addExecutionContext(new WebInspector.ExecutionContext(context.id, context.name, context.isPageContext));
}
}
@@ -162,26 +162,24 @@
* @constructor
* @extends {WebInspector.Object}
*/
-WebInspector.FrameEvaluationContext = function(frame)
+WebInspector.FrameExecutionContextList = function(frame)
{
this._frame = frame;
- this._mainWorldContext = null;
- this._isolatedContexts = [];
+ this._executionContexts = [];
}
-WebInspector.FrameEvaluationContext.EventTypes = {
- Updated: "Updated",
- AddedExecutionContext: "AddedExecutionContext"
+WebInspector.FrameExecutionContextList.EventTypes = {
+ ContextsUpdated: "ContextsUpdated",
+ ContextAdded: "ContextAdded"
}
-WebInspector.FrameEvaluationContext.prototype =
+WebInspector.FrameExecutionContextList.prototype =
{
_frameNavigated: function(frame)
{
this._frame = frame;
- this._mainWorldContext = null;
- this._isolatedContexts = [];
- this.dispatchEventToListeners(WebInspector.FrameEvaluationContext.EventTypes.Updated, this);
+ this._executionContexts = [];
+ this.dispatchEventToListeners(WebInspector.FrameExecutionContextList.EventTypes.ContextsUpdated, this);
},
/**
@@ -189,32 +187,23 @@
*/
_addExecutionContext: function(context)
{
- if (context.isMainWorldContext)
- this._mainWorldContext = context;
- else {
- var insertAt = insertionIndexForObjectInListSortedByFunction(context, this._isolatedContexts, WebInspector.ExecutionContext.comparator);
- this._isolatedContexts.splice(insertAt, 0, context);
- }
- this.dispatchEventToListeners(WebInspector.FrameEvaluationContext.EventTypes.AddedExecutionContext, this);
+ var insertAt = insertionIndexForObjectInListSortedByFunction(context, this._executionContexts, WebInspector.ExecutionContext.comparator);
+ this._executionContexts.splice(insertAt, 0, context);
+ this.dispatchEventToListeners(WebInspector.FrameExecutionContextList.EventTypes.ContextAdded, this);
},
- mainWorldContext: function()
+ executionContexts: function()
{
- return this._mainWorldContext;
+ return this._executionContexts;
},
- isolatedContexts: function()
- {
- return this._isolatedContexts;
- },
-
/**
* @param {string} securityOrigin
*/
contextBySecurityOrigin: function(securityOrigin)
{
- for (var i = 0; i < this._isolatedContexts.length; ++i) {
- var context = this._isolatedContexts[i];
+ for (var i = 0; i < this._executionContexts.length; ++i) {
+ var context = this._executionContexts[i];
if (!context.isMainWorldContext && context.name === securityOrigin)
return context;
}
@@ -245,4 +234,4 @@
}
}
-WebInspector.FrameEvaluationContext.prototype.__proto__ = WebInspector.Object.prototype;
+WebInspector.FrameExecutionContextList.prototype.__proto__ = WebInspector.Object.prototype;