Diff
Modified: trunk/LayoutTests/ChangeLog (202521 => 202522)
--- trunk/LayoutTests/ChangeLog 2016-06-27 23:59:50 UTC (rev 202521)
+++ trunk/LayoutTests/ChangeLog 2016-06-28 00:23:09 UTC (rev 202522)
@@ -1,3 +1,18 @@
+2016-06-27 Brian Burg <[email protected]>
+
+ Web Inspector: RuntimeManager should not use view object WebInspector.quickConsole
+ https://bugs.webkit.org/show_bug.cgi?id=128092
+ <rdar://problem/15966526>
+
+ Reviewed by Timothy Hatcher.
+
+ Add some really basic coverage for RuntimeManager.defaultExecutionContextIdentifier
+ and using it in RuntimeManager.evaluateInInspectedWindow.
+
+ * inspector/runtime/change-execution-context-identifier-expected.txt: Added.
+ * inspector/runtime/change-execution-context-identifier.html: Added.
+ * inspector/runtime/resources/change-execution-context-identifier-subframe.html: Added.
+
2016-06-27 Benjamin Poulain <[email protected]>
Fix style invalidation for :active when the activated node has no renderer
Added: trunk/LayoutTests/inspector/runtime/change-execution-context-identifier-expected.txt (0 => 202522)
--- trunk/LayoutTests/inspector/runtime/change-execution-context-identifier-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/runtime/change-execution-context-identifier-expected.txt 2016-06-28 00:23:09 UTC (rev 202522)
@@ -0,0 +1,21 @@
+
+Test that RuntimeManager.evaluateInInspectedWindow respects the selected execution context.
+
+
+== Running test suite: RuntimeManager.defaultExecutionContextIdentifier
+-- Running test case: InitialScriptExecutionContext
+PASS: The default execution context should be the top level execution context initially.
+
+-- Running test case: ScriptExecutionContextMainFrame
+Passphrase in selected frame: coldwater
+PASS: The passphrase should match the phrase defined in the main frame.
+
+-- Running test case: ScriptExecutionContextSubFrame
+PASS: The test page should only have one sub-frame.
+Passphrase in selected frame: rosewater
+PASS: The passphrase should match the phrase defined in the subframe.
+
+-- Running test case: ScriptExecutionContextMainFrameAgain
+Passphrase in selected frame: coldwater
+PASS: The passphrase should match the phrase defined in the main frame.
+
Added: trunk/LayoutTests/inspector/runtime/change-execution-context-identifier.html (0 => 202522)
--- trunk/LayoutTests/inspector/runtime/change-execution-context-identifier.html (rev 0)
+++ trunk/LayoutTests/inspector/runtime/change-execution-context-identifier.html 2016-06-28 00:23:09 UTC (rev 202522)
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+
+var passphrase = "coldwater";
+
+function test()
+{
+ let suite = InspectorTest.createAsyncSuite("RuntimeManager.defaultExecutionContextIdentifier");
+
+ suite.addTestCase({
+ name: "InitialScriptExecutionContext",
+ description: "Test that the initial value of defaultExecutionContextIdentifier is the top-level context.",
+ test: (resolve, reject) => {
+ InspectorTest.expectThat(WebInspector.runtimeManager.defaultExecutionContextIdentifier === WebInspector.RuntimeManager.TopLevelExecutionContextIdentifier, "The default execution context should be the top level execution context initially.");
+ resolve();
+ }
+ });
+
+ suite.addTestCase({
+ name: "ScriptExecutionContextMainFrame",
+ description: "Test that evaluateInInspectedWindow works when defaultExecutionContextIdentifier is the top level context.",
+ test: (resolve, reject) => {
+ WebInspector.runtimeManager.evaluateInInspectedWindow("passphrase", {objectGroup: "test"}, (remoteObject, wasThrown, savedResultIndex) => {
+ InspectorTest.log("Passphrase in selected frame: " + remoteObject.value);
+ InspectorTest.expectThat(remoteObject.value === "coldwater", "The passphrase should match the phrase defined in the main frame.");
+ resolve();
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "ScriptExecutionContextSubFrame",
+ description: "Test that evaluateInInspectedWindow works when defaultExecutionContextIdentifier is a subframe context.",
+ test: (resolve, reject) => {
+ let mainFrame = WebInspector.frameResourceManager.mainFrame;
+ let subframes = WebInspector.frameResourceManager.frames.filter((frame) => frame != mainFrame);
+ InspectorTest.expectThat(subframes.length === 1, "The test page should only have one sub-frame.");
+
+ WebInspector.runtimeManager.defaultExecutionContextIdentifier = subframes[0].pageExecutionContext.id;
+ WebInspector.runtimeManager.evaluateInInspectedWindow("passphrase", {objectGroup: "test"}, (remoteObject, wasThrown, savedResultIndex) => {
+ InspectorTest.log("Passphrase in selected frame: " + remoteObject.value);
+ InspectorTest.expectThat(remoteObject.value === "rosewater", "The passphrase should match the phrase defined in the subframe.");
+ resolve();
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "ScriptExecutionContextMainFrameAgain",
+ description: "Test that evaluateInInspectedWindow works when defaultExecutionContextIdentifier switches back to the main frame execution context.",
+ test: (resolve, reject) => {
+ let mainFrame = WebInspector.frameResourceManager.mainFrame;
+
+ WebInspector.runtimeManager.defaultExecutionContextIdentifier = mainFrame.pageExecutionContext.id;
+ WebInspector.runtimeManager.evaluateInInspectedWindow("passphrase", {objectGroup: "test"}, (remoteObject, wasThrown, savedResultIndex) => {
+ InspectorTest.log("Passphrase in selected frame: " + remoteObject.value);
+ InspectorTest.expectThat(remoteObject.value === "coldwater", "The passphrase should match the phrase defined in the main frame.");
+ resolve();
+ });
+ }
+ });
+
+ suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body>
+<iframe src="" _onload_="runTest()"></iframe>
+<p>Test that RuntimeManager.evaluateInInspectedWindow respects the selected execution context.</p>
+</body>
+</html>
Added: trunk/LayoutTests/inspector/runtime/resources/change-execution-context-identifier-subframe.html (0 => 202522)
--- trunk/LayoutTests/inspector/runtime/resources/change-execution-context-identifier-subframe.html (rev 0)
+++ trunk/LayoutTests/inspector/runtime/resources/change-execution-context-identifier-subframe.html 2016-06-28 00:23:09 UTC (rev 202522)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+var passphrase = "rosewater";
+</script>
+</head>
+<body>
+</body>
+</html>
Modified: trunk/Source/WebInspectorUI/ChangeLog (202521 => 202522)
--- trunk/Source/WebInspectorUI/ChangeLog 2016-06-27 23:59:50 UTC (rev 202521)
+++ trunk/Source/WebInspectorUI/ChangeLog 2016-06-28 00:23:09 UTC (rev 202522)
@@ -1,3 +1,43 @@
+2016-06-27 Brian Burg <[email protected]>
+
+ Web Inspector: RuntimeManager should not use view object WebInspector.quickConsole
+ https://bugs.webkit.org/show_bug.cgi?id=128092
+ <rdar://problem/15966526>
+
+ Reviewed by Timothy Hatcher.
+
+ This is a layering violation which makes it harder to use RuntimeManager.evaluateInInspectedWindow
+ from a testing context where the QuickConsole view does not exist.
+
+ Store the selected execution context identifier on RuntimeManager and use it
+ when doing subsequent evaluations that act on the currently selected frame.
+
+ * UserInterface/Controllers/RuntimeManager.js:
+ (WebInspector.RuntimeManager.prototype.evaluateInInspectedWindow):
+ (WebInspector.RuntimeManager.prototype.saveResult):
+ Use local state.
+
+ (WebInspector.RuntimeManager.prototype.get defaultExecutionContextIdentifier):
+ (WebInspector.RuntimeManager.prototype.set defaultExecutionContextIdentifier):
+ Added.
+
+ (WebInspector.RuntimeManager):
+ * UserInterface/Models/ExecutionContext.js:
+ (WebInspector.ExecutionContext):
+ Move the symbolic name for the top level execution context to RuntimeManager.
+
+ * UserInterface/Test/Test.js:
+ (WebInspector.loaded): No need to stub out WebInspector.QuickConsole any more.
+
+ * UserInterface/Views/QuickConsole.js:
+ (WebInspector.QuickConsole.prototype._framePageExecutionContextsChanged):
+ (WebInspector.QuickConsole.prototype._removeExecutionContextPathComponentForFrame):
+ (WebInspector.QuickConsole.prototype._updateExecutionContextPathComponentForFrame):
+ (WebInspector.QuickConsole.prototype._pathComponentSelected):
+ For now, set RuntimeManager's selected execution context whenever we set the
+ selected path component. In a future patch, we should invert the dependency and have
+ the selected component change whenever RuntimeManager.defaultExecutionContext changes.
+
2016-06-23 Joseph Pecoraro <[email protected]>
Web Inspector: first heap snapshot taken when a page is reloaded happens before the reload navigation
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js (202521 => 202522)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js 2016-06-27 23:59:50 UTC (rev 202521)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js 2016-06-28 00:23:09 UTC (rev 202522)
@@ -82,7 +82,7 @@
}
// COMPATIBILITY (iOS 8): "saveResult" did not exist.
- var contextId = WebInspector.quickConsole.executionContextIdentifier;
+ let contextId = this.defaultExecutionContextIdentifier;
RuntimeAgent.evaluate.invoke({_expression_, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, contextId, returnByValue, generatePreview, saveResult}, evalCallback.bind(this));
}
@@ -104,7 +104,7 @@
if (remoteObject.objectId)
RuntimeAgent.saveResult(remoteObject.asCallArgument(), mycallback);
else
- RuntimeAgent.saveResult(remoteObject.asCallArgument(), WebInspector.quickConsole.executionContextIdentifier, mycallback);
+ RuntimeAgent.saveResult(remoteObject.asCallArgument(), this.defaultExecutionContextIdentifier, mycallback);
}
getPropertiesForRemoteObject(objectId, callback)
@@ -122,8 +122,13 @@
callback(null, properties);
});
}
+
+ get defaultExecutionContextIdentifier() { return this._defaultExecutionContextIdentifier; }
+ set defaultExecutionContextIdentifier(value) { this._defaultExecutionContextIdentifier = value; }
};
+WebInspector.RuntimeManager.TopLevelExecutionContextIdentifier = undefined;
+
WebInspector.RuntimeManager.Event = {
DidEvaluate: "runtime-manager-did-evaluate"
};
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/ExecutionContext.js (202521 => 202522)
--- trunk/Source/WebInspectorUI/UserInterface/Models/ExecutionContext.js 2016-06-27 23:59:50 UTC (rev 202521)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/ExecutionContext.js 2016-06-28 00:23:09 UTC (rev 202522)
@@ -29,7 +29,7 @@
{
super();
- console.assert(typeof id === "number" || id === WebInspector.QuickConsole.MainFrameContextExecutionIdentifier);
+ console.assert(typeof id === "number" || id === WebInspector.RuntimeManager.TopLevelExecutionContextIdentifier);
console.assert(typeof name === "string");
this._id = id;
Modified: trunk/Source/WebInspectorUI/UserInterface/Test/Test.js (202521 => 202522)
--- trunk/Source/WebInspectorUI/UserInterface/Test/Test.js 2016-06-27 23:59:50 UTC (rev 202521)
+++ trunk/Source/WebInspectorUI/UserInterface/Test/Test.js 2016-06-28 00:23:09 UTC (rev 202522)
@@ -62,9 +62,6 @@
this.probeManager = new WebInspector.ProbeManager;
this.replayManager = new WebInspector.ReplayManager;
- // Global controllers.
- this.quickConsole = {executionContextIdentifier: undefined};
-
document.addEventListener("DOMContentLoaded", this.contentLoaded);
// Enable agents.
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/QuickConsole.js (202521 => 202522)
--- trunk/Source/WebInspectorUI/UserInterface/Views/QuickConsole.js 2016-06-27 23:59:50 UTC (rev 202521)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/QuickConsole.js 2016-06-28 00:23:09 UTC (rev 202522)
@@ -149,6 +149,7 @@
if (shouldAutomaticallySelect) {
delete this._restoreSelectedExecutionContextForFrame;
this._selectedExecutionContextPathComponent = newExecutionContextPathComponent;
+ WebInspector.runtimeManager.defaultExecutionContextIdentifier = this.executionContextIdentifier;
this._rebuildExecutionContextPathComponents();
}
}
@@ -260,8 +261,10 @@
if (next)
next.previousSibling = prev;
- if (this._selectedExecutionContextPathComponent === executionContextPathComponent)
+ if (this._selectedExecutionContextPathComponent === executionContextPathComponent) {
this._selectedExecutionContextPathComponent = this._mainFrameExecutionContextPathComponent;
+ WebInspector.runtimeManager.defaultExecutionContextIdentifier = this.executionContextIdentifier;
+ }
this._otherExecutionContextPathComponents.remove(executionContextPathComponent, true);
delete this._frameIdentifierToExecutionContextPathComponentMap[frame.id];
@@ -284,8 +287,10 @@
this._removeExecutionContextPathComponentForFrame(frame, true);
var newExecutionContextPathComponent = this._insertExecutionContextPathComponentForFrame(frame, true);
- if (wasSelected)
+ if (wasSelected) {
this._selectedExecutionContextPathComponent = newExecutionContextPathComponent;
+ WebInspector.runtimeManager.defaultExecutionContextIdentifier = this.executionContextIdentifier;
+ }
this._rebuildExecutionContextPathComponents();
}
@@ -296,6 +301,7 @@
return;
this._selectedExecutionContextPathComponent = event.data.pathComponent;
+ WebInspector.runtimeManager.defaultExecutionContextIdentifier = this.executionContextIdentifier;
this._rebuildExecutionContextPathComponents();
}
@@ -325,8 +331,6 @@
WebInspector.QuickConsole.ToolbarPromptPadding = 4;
WebInspector.QuickConsole.ToolbarTopBorder = 1;
-WebInspector.QuickConsole.MainFrameContextExecutionIdentifier = undefined;
-
WebInspector.QuickConsole.Event = {
DidResize: "quick-console-did-resize"
};