haikuwebkit/LayoutTests/inspector/runtime/getPreview.html

166 lines
8.1 KiB
HTML
Raw Permalink Normal View History

Web Inspector: Pausing with a deep call stack can be very slow, avoid eagerly generating object previews https://bugs.webkit.org/show_bug.cgi?id=173698 Reviewed by Matt Baker. Source/JavaScriptCore: When pausing in a deep call stack the majority of the time spent in JavaScriptCore when preparing Inspector pause information is spent generating object previews for the `thisObject` of each of the call frames. In some cases, this could be more than 95% of the time generating pause information. In the common case, only one of these (the top frame) will ever be seen by users. This change avoids eagerly generating object previews up front and let the frontend request previews if they are needed. This introduces the `Runtime.getPreview` protocol command. This can be used to: - Get a preview for a RemoteObject that did not have a preview but could. - Update a preview for a RemoteObject that had a preview. This patch only uses it for the first case, but the second is valid and may be something we want to do in the future. * inspector/protocol/Runtime.json: A new command to get an up to date preview for an object. * inspector/InjectedScript.h: * inspector/InjectedScript.cpp: (Inspector::InjectedScript::getPreview): * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::InspectorRuntimeAgent::getPreview): * inspector/agents/InspectorRuntimeAgent.h: Plumbing for the new command. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.getPreview): Implementation just uses the existing helper. (InjectedScript.CallFrameProxy): Do not generate a preview for the this object as it may not be shown. Let the frontend request a preview if it wants or needs one. Source/WebInspectorUI: Introduce RemoteObject.prototype.updatePreview which can be used to update the preview of a RemoteObject with a current view for the object. Currently we only use this to fetch the preview that we did not have for the `thisObject` in the scope chain sidebar. However this could be used generically to update a RemoteObject's preview (ObjectPreview) at any time. * UserInterface/Protocol/RemoteObject.js: (WebInspector.RemoteObject.prototype.canLoadPreview): (WebInspector.RemoteObject.prototype.updatePreview): Allow a RemoteObject to update its preview property. Since this only makes sense on certain Object values include a helper to know when it is appropriate to fetch a preview. * UserInterface/Views/ObjectTreePropertyTreeElement.js: (WebInspector.ObjectTreePropertyTreeElement.prototype._createTitlePropertyStyle): (WebInspector.ObjectTreePropertyTreeElement.prototype._loadPreviewLazilyIfNeeded): If the object being shown in the sidebar does not have a preview but can load a preview then attempt to load it lazily. This is the case for the `thisObject` which is injected into an ObjectTree in the scope chain sidebar. LayoutTests: * inspector/runtime/getPreview-expected.txt: Added. * inspector/runtime/getPreview.html: Added. Test the new protocol command `Runtime.getPreview` as well as the frontend model method RemoteObject.prototype.updatePreview which uses it with its own slightly different semantics about when it should be used. * inspector/debugger/tail-deleted-frames-this-value.html: This test used `CallFrame.thisObject.preview` so rewrite it to first load the preview and then check values with it. Canonical link: https://commits.webkit.org/190601@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218718 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-22 21:12:01 +00:00
<!DOCTYPE html>
<html>
<head>
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script>
function test()
{
let suite = InspectorTest.createAsyncSuite("Runtime.getPreview");
// ------ RemoteObject.prototype.updatePreview
suite.addTestCase({
name: "RemoteObject.updatePreview.ObjectWithoutPreview",
description: "Should be able to update the preview of a RemoteObject without a preview.",
test(resolve, reject) {
RuntimeAgent.evaluate.invoke({expression: `({a:1, b:2})`, objectGroup: "test", generatePreview: false}, (error, remoteObjectPayload) => {
InspectorTest.assert(!error, "Should not be a protocol error.");
let remoteObject = WI.RemoteObject.fromPayload(remoteObjectPayload);
Web Inspector: Pausing with a deep call stack can be very slow, avoid eagerly generating object previews https://bugs.webkit.org/show_bug.cgi?id=173698 Reviewed by Matt Baker. Source/JavaScriptCore: When pausing in a deep call stack the majority of the time spent in JavaScriptCore when preparing Inspector pause information is spent generating object previews for the `thisObject` of each of the call frames. In some cases, this could be more than 95% of the time generating pause information. In the common case, only one of these (the top frame) will ever be seen by users. This change avoids eagerly generating object previews up front and let the frontend request previews if they are needed. This introduces the `Runtime.getPreview` protocol command. This can be used to: - Get a preview for a RemoteObject that did not have a preview but could. - Update a preview for a RemoteObject that had a preview. This patch only uses it for the first case, but the second is valid and may be something we want to do in the future. * inspector/protocol/Runtime.json: A new command to get an up to date preview for an object. * inspector/InjectedScript.h: * inspector/InjectedScript.cpp: (Inspector::InjectedScript::getPreview): * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::InspectorRuntimeAgent::getPreview): * inspector/agents/InspectorRuntimeAgent.h: Plumbing for the new command. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.getPreview): Implementation just uses the existing helper. (InjectedScript.CallFrameProxy): Do not generate a preview for the this object as it may not be shown. Let the frontend request a preview if it wants or needs one. Source/WebInspectorUI: Introduce RemoteObject.prototype.updatePreview which can be used to update the preview of a RemoteObject with a current view for the object. Currently we only use this to fetch the preview that we did not have for the `thisObject` in the scope chain sidebar. However this could be used generically to update a RemoteObject's preview (ObjectPreview) at any time. * UserInterface/Protocol/RemoteObject.js: (WebInspector.RemoteObject.prototype.canLoadPreview): (WebInspector.RemoteObject.prototype.updatePreview): Allow a RemoteObject to update its preview property. Since this only makes sense on certain Object values include a helper to know when it is appropriate to fetch a preview. * UserInterface/Views/ObjectTreePropertyTreeElement.js: (WebInspector.ObjectTreePropertyTreeElement.prototype._createTitlePropertyStyle): (WebInspector.ObjectTreePropertyTreeElement.prototype._loadPreviewLazilyIfNeeded): If the object being shown in the sidebar does not have a preview but can load a preview then attempt to load it lazily. This is the case for the `thisObject` which is injected into an ObjectTree in the scope chain sidebar. LayoutTests: * inspector/runtime/getPreview-expected.txt: Added. * inspector/runtime/getPreview.html: Added. Test the new protocol command `Runtime.getPreview` as well as the frontend model method RemoteObject.prototype.updatePreview which uses it with its own slightly different semantics about when it should be used. * inspector/debugger/tail-deleted-frames-this-value.html: This test used `CallFrame.thisObject.preview` so rewrite it to first load the preview and then check values with it. Canonical link: https://commits.webkit.org/190601@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218718 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-22 21:12:01 +00:00
InspectorTest.expectThat(!remoteObject.preview, "RemoteObject should not have a preview.");
InspectorTest.expectThat(remoteObject.canLoadPreview(), "RemoteObject should be able to load a preview.");
remoteObject.updatePreview((preview) => {
InspectorTest.expectThat(preview instanceof WI.ObjectPreview, "RemoteObject.updatePreview should produce an ObjectPreview.");
Web Inspector: Pausing with a deep call stack can be very slow, avoid eagerly generating object previews https://bugs.webkit.org/show_bug.cgi?id=173698 Reviewed by Matt Baker. Source/JavaScriptCore: When pausing in a deep call stack the majority of the time spent in JavaScriptCore when preparing Inspector pause information is spent generating object previews for the `thisObject` of each of the call frames. In some cases, this could be more than 95% of the time generating pause information. In the common case, only one of these (the top frame) will ever be seen by users. This change avoids eagerly generating object previews up front and let the frontend request previews if they are needed. This introduces the `Runtime.getPreview` protocol command. This can be used to: - Get a preview for a RemoteObject that did not have a preview but could. - Update a preview for a RemoteObject that had a preview. This patch only uses it for the first case, but the second is valid and may be something we want to do in the future. * inspector/protocol/Runtime.json: A new command to get an up to date preview for an object. * inspector/InjectedScript.h: * inspector/InjectedScript.cpp: (Inspector::InjectedScript::getPreview): * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::InspectorRuntimeAgent::getPreview): * inspector/agents/InspectorRuntimeAgent.h: Plumbing for the new command. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.getPreview): Implementation just uses the existing helper. (InjectedScript.CallFrameProxy): Do not generate a preview for the this object as it may not be shown. Let the frontend request a preview if it wants or needs one. Source/WebInspectorUI: Introduce RemoteObject.prototype.updatePreview which can be used to update the preview of a RemoteObject with a current view for the object. Currently we only use this to fetch the preview that we did not have for the `thisObject` in the scope chain sidebar. However this could be used generically to update a RemoteObject's preview (ObjectPreview) at any time. * UserInterface/Protocol/RemoteObject.js: (WebInspector.RemoteObject.prototype.canLoadPreview): (WebInspector.RemoteObject.prototype.updatePreview): Allow a RemoteObject to update its preview property. Since this only makes sense on certain Object values include a helper to know when it is appropriate to fetch a preview. * UserInterface/Views/ObjectTreePropertyTreeElement.js: (WebInspector.ObjectTreePropertyTreeElement.prototype._createTitlePropertyStyle): (WebInspector.ObjectTreePropertyTreeElement.prototype._loadPreviewLazilyIfNeeded): If the object being shown in the sidebar does not have a preview but can load a preview then attempt to load it lazily. This is the case for the `thisObject` which is injected into an ObjectTree in the scope chain sidebar. LayoutTests: * inspector/runtime/getPreview-expected.txt: Added. * inspector/runtime/getPreview.html: Added. Test the new protocol command `Runtime.getPreview` as well as the frontend model method RemoteObject.prototype.updatePreview which uses it with its own slightly different semantics about when it should be used. * inspector/debugger/tail-deleted-frames-this-value.html: This test used `CallFrame.thisObject.preview` so rewrite it to first load the preview and then check values with it. Canonical link: https://commits.webkit.org/190601@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218718 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-22 21:12:01 +00:00
InspectorTest.expectEqual(remoteObject.preview, preview, "RemoteObject.preview should be the same object as the callback.");
InspectorTest.expectEqual(remoteObject.preview.propertyPreviews.length, 2, "Preview should have 2 properties.");
resolve();
});
});
}
});
suite.addTestCase({
name: "RemoteObject.updatePreview.ObjectWithPreview",
description: "Should be able to update the preview of a RemoteObject with a preview.",
test(resolve, reject) {
RuntimeAgent.evaluate.invoke({expression: `window.alpha = ({a:1, b:2, c:3})`, objectGroup: "test", generatePreview: true}, (error, remoteObjectPayload) => {
InspectorTest.assert(!error, "Should not be a protocol error.");
let remoteObject = WI.RemoteObject.fromPayload(remoteObjectPayload);
Web Inspector: Pausing with a deep call stack can be very slow, avoid eagerly generating object previews https://bugs.webkit.org/show_bug.cgi?id=173698 Reviewed by Matt Baker. Source/JavaScriptCore: When pausing in a deep call stack the majority of the time spent in JavaScriptCore when preparing Inspector pause information is spent generating object previews for the `thisObject` of each of the call frames. In some cases, this could be more than 95% of the time generating pause information. In the common case, only one of these (the top frame) will ever be seen by users. This change avoids eagerly generating object previews up front and let the frontend request previews if they are needed. This introduces the `Runtime.getPreview` protocol command. This can be used to: - Get a preview for a RemoteObject that did not have a preview but could. - Update a preview for a RemoteObject that had a preview. This patch only uses it for the first case, but the second is valid and may be something we want to do in the future. * inspector/protocol/Runtime.json: A new command to get an up to date preview for an object. * inspector/InjectedScript.h: * inspector/InjectedScript.cpp: (Inspector::InjectedScript::getPreview): * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::InspectorRuntimeAgent::getPreview): * inspector/agents/InspectorRuntimeAgent.h: Plumbing for the new command. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.getPreview): Implementation just uses the existing helper. (InjectedScript.CallFrameProxy): Do not generate a preview for the this object as it may not be shown. Let the frontend request a preview if it wants or needs one. Source/WebInspectorUI: Introduce RemoteObject.prototype.updatePreview which can be used to update the preview of a RemoteObject with a current view for the object. Currently we only use this to fetch the preview that we did not have for the `thisObject` in the scope chain sidebar. However this could be used generically to update a RemoteObject's preview (ObjectPreview) at any time. * UserInterface/Protocol/RemoteObject.js: (WebInspector.RemoteObject.prototype.canLoadPreview): (WebInspector.RemoteObject.prototype.updatePreview): Allow a RemoteObject to update its preview property. Since this only makes sense on certain Object values include a helper to know when it is appropriate to fetch a preview. * UserInterface/Views/ObjectTreePropertyTreeElement.js: (WebInspector.ObjectTreePropertyTreeElement.prototype._createTitlePropertyStyle): (WebInspector.ObjectTreePropertyTreeElement.prototype._loadPreviewLazilyIfNeeded): If the object being shown in the sidebar does not have a preview but can load a preview then attempt to load it lazily. This is the case for the `thisObject` which is injected into an ObjectTree in the scope chain sidebar. LayoutTests: * inspector/runtime/getPreview-expected.txt: Added. * inspector/runtime/getPreview.html: Added. Test the new protocol command `Runtime.getPreview` as well as the frontend model method RemoteObject.prototype.updatePreview which uses it with its own slightly different semantics about when it should be used. * inspector/debugger/tail-deleted-frames-this-value.html: This test used `CallFrame.thisObject.preview` so rewrite it to first load the preview and then check values with it. Canonical link: https://commits.webkit.org/190601@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218718 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-22 21:12:01 +00:00
let originalPreview = remoteObject.preview;
InspectorTest.expectThat(remoteObject.preview, "RemoteObject should have a preview.");
InspectorTest.expectThat(remoteObject.canLoadPreview(), "RemoteObject should be able to load a preview.");
InspectorTest.expectEqual(originalPreview.propertyPreviews.length, 3, "Original preview should have 3 properties.");
InspectorTest.evaluateInPage(`window.alpha.d = 4`, () => {
remoteObject.updatePreview((preview) => {
InspectorTest.expectThat(preview instanceof WI.ObjectPreview, "RemoteObject.updatePreview should produce an ObjectPreview.");
Web Inspector: Pausing with a deep call stack can be very slow, avoid eagerly generating object previews https://bugs.webkit.org/show_bug.cgi?id=173698 Reviewed by Matt Baker. Source/JavaScriptCore: When pausing in a deep call stack the majority of the time spent in JavaScriptCore when preparing Inspector pause information is spent generating object previews for the `thisObject` of each of the call frames. In some cases, this could be more than 95% of the time generating pause information. In the common case, only one of these (the top frame) will ever be seen by users. This change avoids eagerly generating object previews up front and let the frontend request previews if they are needed. This introduces the `Runtime.getPreview` protocol command. This can be used to: - Get a preview for a RemoteObject that did not have a preview but could. - Update a preview for a RemoteObject that had a preview. This patch only uses it for the first case, but the second is valid and may be something we want to do in the future. * inspector/protocol/Runtime.json: A new command to get an up to date preview for an object. * inspector/InjectedScript.h: * inspector/InjectedScript.cpp: (Inspector::InjectedScript::getPreview): * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::InspectorRuntimeAgent::getPreview): * inspector/agents/InspectorRuntimeAgent.h: Plumbing for the new command. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.getPreview): Implementation just uses the existing helper. (InjectedScript.CallFrameProxy): Do not generate a preview for the this object as it may not be shown. Let the frontend request a preview if it wants or needs one. Source/WebInspectorUI: Introduce RemoteObject.prototype.updatePreview which can be used to update the preview of a RemoteObject with a current view for the object. Currently we only use this to fetch the preview that we did not have for the `thisObject` in the scope chain sidebar. However this could be used generically to update a RemoteObject's preview (ObjectPreview) at any time. * UserInterface/Protocol/RemoteObject.js: (WebInspector.RemoteObject.prototype.canLoadPreview): (WebInspector.RemoteObject.prototype.updatePreview): Allow a RemoteObject to update its preview property. Since this only makes sense on certain Object values include a helper to know when it is appropriate to fetch a preview. * UserInterface/Views/ObjectTreePropertyTreeElement.js: (WebInspector.ObjectTreePropertyTreeElement.prototype._createTitlePropertyStyle): (WebInspector.ObjectTreePropertyTreeElement.prototype._loadPreviewLazilyIfNeeded): If the object being shown in the sidebar does not have a preview but can load a preview then attempt to load it lazily. This is the case for the `thisObject` which is injected into an ObjectTree in the scope chain sidebar. LayoutTests: * inspector/runtime/getPreview-expected.txt: Added. * inspector/runtime/getPreview.html: Added. Test the new protocol command `Runtime.getPreview` as well as the frontend model method RemoteObject.prototype.updatePreview which uses it with its own slightly different semantics about when it should be used. * inspector/debugger/tail-deleted-frames-this-value.html: This test used `CallFrame.thisObject.preview` so rewrite it to first load the preview and then check values with it. Canonical link: https://commits.webkit.org/190601@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218718 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-22 21:12:01 +00:00
InspectorTest.expectEqual(remoteObject.preview, preview, "RemoteObject.preview should be the same object as the callback.");
InspectorTest.expectEqual(remoteObject.preview.propertyPreviews.length, 4, "Preview should now have 4 properties.");
resolve();
});
});
});
}
});
suite.addTestCase({
name: "RemoteObject.updatePreview.NonObject",
description: "Non-object RemoteObjects should not request a preview.",
test(resolve, reject) {
function testRemoteObject(remoteObject, preferredTypeName) {
InspectorTest.expectThat(!remoteObject.canLoadPreview(), `Should not be able to load a preview for a ${preferredTypeName || remoteObject.type} RemoteObject.`);
remoteObject.updatePreview((preview) => {
InspectorTest.expectNull(preview, `RemoteObject.updatePreview should return null for a ${preferredTypeName || remoteObject.type} RemoteObject.`);
});
}
testRemoteObject(WI.RemoteObject.fromPrimitiveValue(true));
testRemoteObject(WI.RemoteObject.fromPrimitiveValue(100));
testRemoteObject(WI.RemoteObject.fromPrimitiveValue("str"));
testRemoteObject(WI.RemoteObject.createFakeRemoteObject(), "fake object");
Web Inspector: Pausing with a deep call stack can be very slow, avoid eagerly generating object previews https://bugs.webkit.org/show_bug.cgi?id=173698 Reviewed by Matt Baker. Source/JavaScriptCore: When pausing in a deep call stack the majority of the time spent in JavaScriptCore when preparing Inspector pause information is spent generating object previews for the `thisObject` of each of the call frames. In some cases, this could be more than 95% of the time generating pause information. In the common case, only one of these (the top frame) will ever be seen by users. This change avoids eagerly generating object previews up front and let the frontend request previews if they are needed. This introduces the `Runtime.getPreview` protocol command. This can be used to: - Get a preview for a RemoteObject that did not have a preview but could. - Update a preview for a RemoteObject that had a preview. This patch only uses it for the first case, but the second is valid and may be something we want to do in the future. * inspector/protocol/Runtime.json: A new command to get an up to date preview for an object. * inspector/InjectedScript.h: * inspector/InjectedScript.cpp: (Inspector::InjectedScript::getPreview): * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::InspectorRuntimeAgent::getPreview): * inspector/agents/InspectorRuntimeAgent.h: Plumbing for the new command. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.getPreview): Implementation just uses the existing helper. (InjectedScript.CallFrameProxy): Do not generate a preview for the this object as it may not be shown. Let the frontend request a preview if it wants or needs one. Source/WebInspectorUI: Introduce RemoteObject.prototype.updatePreview which can be used to update the preview of a RemoteObject with a current view for the object. Currently we only use this to fetch the preview that we did not have for the `thisObject` in the scope chain sidebar. However this could be used generically to update a RemoteObject's preview (ObjectPreview) at any time. * UserInterface/Protocol/RemoteObject.js: (WebInspector.RemoteObject.prototype.canLoadPreview): (WebInspector.RemoteObject.prototype.updatePreview): Allow a RemoteObject to update its preview property. Since this only makes sense on certain Object values include a helper to know when it is appropriate to fetch a preview. * UserInterface/Views/ObjectTreePropertyTreeElement.js: (WebInspector.ObjectTreePropertyTreeElement.prototype._createTitlePropertyStyle): (WebInspector.ObjectTreePropertyTreeElement.prototype._loadPreviewLazilyIfNeeded): If the object being shown in the sidebar does not have a preview but can load a preview then attempt to load it lazily. This is the case for the `thisObject` which is injected into an ObjectTree in the scope chain sidebar. LayoutTests: * inspector/runtime/getPreview-expected.txt: Added. * inspector/runtime/getPreview.html: Added. Test the new protocol command `Runtime.getPreview` as well as the frontend model method RemoteObject.prototype.updatePreview which uses it with its own slightly different semantics about when it should be used. * inspector/debugger/tail-deleted-frames-this-value.html: This test used `CallFrame.thisObject.preview` so rewrite it to first load the preview and then check values with it. Canonical link: https://commits.webkit.org/190601@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218718 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-22 21:12:01 +00:00
InspectorBackend.runAfterPendingDispatches(resolve);
}
});
suite.addTestCase({
name: "RemoteObject.updatePreview.Symbol",
description: "Non-object RemoteObjects should not request a preview.",
test(resolve, reject) {
Web Inspector: InspectorTest.evaluateInPage should unwrap primitive values by default https://bugs.webkit.org/show_bug.cgi?id=180831 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Test/FrontendTestHarness.js: (FrontendTestHarness.prototype.evaluateInPage.resultObjectToReturn): (FrontendTestHarness.prototype.evaluateInPage): Unwrap the resulting RemoteObject's value if it is a primitive. Add an `options` dictionary so this behavior can be opted out. * UserInterface/Test/TestHarness.js: Add documentation of how evaluateInPage works. LayoutTests: * inspector/unit-tests/test-harness-evaluate-in-page-expected.txt: Added. * inspector/unit-tests/test-harness-evaluate-in-page.html: Added. Add test coverage for InspectorTest.evaluateInPage. Only the promise-returning variant is tested here, because the callback variant is well-used in existing tests and I plan to remove the callback variant entirely in later patches. * inspector/console/js-isLikelyStackTrace-expected.txt: * inspector/console/js-isLikelyStackTrace.html: Fix some bad tests and rebaseline. A bug was filed for the remaining failing assertion. * http/tests/inspector/dom/shapes-test.js: (TestPage.registerInitializer.InspectorTest.Shapes.receivedHighlightObject): (TestPage.registerInitializer.InspectorTest.Shapes.getShapeOutsideInfoForSelector): * http/tests/inspector/paymentrequest/payment-request-internal-properties.https.html: * inspector/console/command-line-api-copy.html: * inspector/console/console-log-proxy.html: * inspector/debugger/js-stacktrace.html: * inspector/dom/hideHighlight.html: * inspector/dom/highlightFrame.html: * inspector/dom/highlightNode.html: * inspector/dom/highlightNodeList.html: * inspector/dom/highlightQuad.html: * inspector/dom/highlightRect.html: * inspector/dom/highlightSelector.html: * inspector/page/setEmulatedMedia.html: * inspector/runtime/getPreview.html: Fix existing tests to opt out of unwrapping or use the unwrapped value directly. * inspector/dom/setEventListenerDisabled-expected.txt: Rebaseline results. This is caused by an extra promise tick in evaluateInPage. * inspector/injected-script/observable-expected.txt: * inspector/injected-script/observable.html: Fix a typo and rebaseline. Canonical link: https://commits.webkit.org/196748@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225950 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-15 01:39:11 +00:00
InspectorTest.evaluateInPage(`Symbol.iterator`, (error, remoteObject) => {
Web Inspector: Pausing with a deep call stack can be very slow, avoid eagerly generating object previews https://bugs.webkit.org/show_bug.cgi?id=173698 Reviewed by Matt Baker. Source/JavaScriptCore: When pausing in a deep call stack the majority of the time spent in JavaScriptCore when preparing Inspector pause information is spent generating object previews for the `thisObject` of each of the call frames. In some cases, this could be more than 95% of the time generating pause information. In the common case, only one of these (the top frame) will ever be seen by users. This change avoids eagerly generating object previews up front and let the frontend request previews if they are needed. This introduces the `Runtime.getPreview` protocol command. This can be used to: - Get a preview for a RemoteObject that did not have a preview but could. - Update a preview for a RemoteObject that had a preview. This patch only uses it for the first case, but the second is valid and may be something we want to do in the future. * inspector/protocol/Runtime.json: A new command to get an up to date preview for an object. * inspector/InjectedScript.h: * inspector/InjectedScript.cpp: (Inspector::InjectedScript::getPreview): * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::InspectorRuntimeAgent::getPreview): * inspector/agents/InspectorRuntimeAgent.h: Plumbing for the new command. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.getPreview): Implementation just uses the existing helper. (InjectedScript.CallFrameProxy): Do not generate a preview for the this object as it may not be shown. Let the frontend request a preview if it wants or needs one. Source/WebInspectorUI: Introduce RemoteObject.prototype.updatePreview which can be used to update the preview of a RemoteObject with a current view for the object. Currently we only use this to fetch the preview that we did not have for the `thisObject` in the scope chain sidebar. However this could be used generically to update a RemoteObject's preview (ObjectPreview) at any time. * UserInterface/Protocol/RemoteObject.js: (WebInspector.RemoteObject.prototype.canLoadPreview): (WebInspector.RemoteObject.prototype.updatePreview): Allow a RemoteObject to update its preview property. Since this only makes sense on certain Object values include a helper to know when it is appropriate to fetch a preview. * UserInterface/Views/ObjectTreePropertyTreeElement.js: (WebInspector.ObjectTreePropertyTreeElement.prototype._createTitlePropertyStyle): (WebInspector.ObjectTreePropertyTreeElement.prototype._loadPreviewLazilyIfNeeded): If the object being shown in the sidebar does not have a preview but can load a preview then attempt to load it lazily. This is the case for the `thisObject` which is injected into an ObjectTree in the scope chain sidebar. LayoutTests: * inspector/runtime/getPreview-expected.txt: Added. * inspector/runtime/getPreview.html: Added. Test the new protocol command `Runtime.getPreview` as well as the frontend model method RemoteObject.prototype.updatePreview which uses it with its own slightly different semantics about when it should be used. * inspector/debugger/tail-deleted-frames-this-value.html: This test used `CallFrame.thisObject.preview` so rewrite it to first load the preview and then check values with it. Canonical link: https://commits.webkit.org/190601@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218718 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-22 21:12:01 +00:00
InspectorTest.expectThat(!remoteObject.canLoadPreview(), `Should not be able to load a preview for a ${remoteObject.type} RemoteObject.`);
remoteObject.updatePreview((preview) => {
InspectorTest.expectNull(preview, `RemoteObject.updatePreview should return null for a ${remoteObject.type} RemoteObject.`);
resolve();
});
});
}
});
suite.addTestCase({
name: "RemoteObject.updatePreview.Function",
description: "Non-object RemoteObjects should not request a preview.",
test(resolve, reject) {
Web Inspector: InspectorTest.evaluateInPage should unwrap primitive values by default https://bugs.webkit.org/show_bug.cgi?id=180831 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Test/FrontendTestHarness.js: (FrontendTestHarness.prototype.evaluateInPage.resultObjectToReturn): (FrontendTestHarness.prototype.evaluateInPage): Unwrap the resulting RemoteObject's value if it is a primitive. Add an `options` dictionary so this behavior can be opted out. * UserInterface/Test/TestHarness.js: Add documentation of how evaluateInPage works. LayoutTests: * inspector/unit-tests/test-harness-evaluate-in-page-expected.txt: Added. * inspector/unit-tests/test-harness-evaluate-in-page.html: Added. Add test coverage for InspectorTest.evaluateInPage. Only the promise-returning variant is tested here, because the callback variant is well-used in existing tests and I plan to remove the callback variant entirely in later patches. * inspector/console/js-isLikelyStackTrace-expected.txt: * inspector/console/js-isLikelyStackTrace.html: Fix some bad tests and rebaseline. A bug was filed for the remaining failing assertion. * http/tests/inspector/dom/shapes-test.js: (TestPage.registerInitializer.InspectorTest.Shapes.receivedHighlightObject): (TestPage.registerInitializer.InspectorTest.Shapes.getShapeOutsideInfoForSelector): * http/tests/inspector/paymentrequest/payment-request-internal-properties.https.html: * inspector/console/command-line-api-copy.html: * inspector/console/console-log-proxy.html: * inspector/debugger/js-stacktrace.html: * inspector/dom/hideHighlight.html: * inspector/dom/highlightFrame.html: * inspector/dom/highlightNode.html: * inspector/dom/highlightNodeList.html: * inspector/dom/highlightQuad.html: * inspector/dom/highlightRect.html: * inspector/dom/highlightSelector.html: * inspector/page/setEmulatedMedia.html: * inspector/runtime/getPreview.html: Fix existing tests to opt out of unwrapping or use the unwrapped value directly. * inspector/dom/setEventListenerDisabled-expected.txt: Rebaseline results. This is caused by an extra promise tick in evaluateInPage. * inspector/injected-script/observable-expected.txt: * inspector/injected-script/observable.html: Fix a typo and rebaseline. Canonical link: https://commits.webkit.org/196748@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225950 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-15 01:39:11 +00:00
InspectorTest.evaluateInPage(`function f() {}; f`, (error, remoteObject) => {
Web Inspector: Pausing with a deep call stack can be very slow, avoid eagerly generating object previews https://bugs.webkit.org/show_bug.cgi?id=173698 Reviewed by Matt Baker. Source/JavaScriptCore: When pausing in a deep call stack the majority of the time spent in JavaScriptCore when preparing Inspector pause information is spent generating object previews for the `thisObject` of each of the call frames. In some cases, this could be more than 95% of the time generating pause information. In the common case, only one of these (the top frame) will ever be seen by users. This change avoids eagerly generating object previews up front and let the frontend request previews if they are needed. This introduces the `Runtime.getPreview` protocol command. This can be used to: - Get a preview for a RemoteObject that did not have a preview but could. - Update a preview for a RemoteObject that had a preview. This patch only uses it for the first case, but the second is valid and may be something we want to do in the future. * inspector/protocol/Runtime.json: A new command to get an up to date preview for an object. * inspector/InjectedScript.h: * inspector/InjectedScript.cpp: (Inspector::InjectedScript::getPreview): * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::InspectorRuntimeAgent::getPreview): * inspector/agents/InspectorRuntimeAgent.h: Plumbing for the new command. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.getPreview): Implementation just uses the existing helper. (InjectedScript.CallFrameProxy): Do not generate a preview for the this object as it may not be shown. Let the frontend request a preview if it wants or needs one. Source/WebInspectorUI: Introduce RemoteObject.prototype.updatePreview which can be used to update the preview of a RemoteObject with a current view for the object. Currently we only use this to fetch the preview that we did not have for the `thisObject` in the scope chain sidebar. However this could be used generically to update a RemoteObject's preview (ObjectPreview) at any time. * UserInterface/Protocol/RemoteObject.js: (WebInspector.RemoteObject.prototype.canLoadPreview): (WebInspector.RemoteObject.prototype.updatePreview): Allow a RemoteObject to update its preview property. Since this only makes sense on certain Object values include a helper to know when it is appropriate to fetch a preview. * UserInterface/Views/ObjectTreePropertyTreeElement.js: (WebInspector.ObjectTreePropertyTreeElement.prototype._createTitlePropertyStyle): (WebInspector.ObjectTreePropertyTreeElement.prototype._loadPreviewLazilyIfNeeded): If the object being shown in the sidebar does not have a preview but can load a preview then attempt to load it lazily. This is the case for the `thisObject` which is injected into an ObjectTree in the scope chain sidebar. LayoutTests: * inspector/runtime/getPreview-expected.txt: Added. * inspector/runtime/getPreview.html: Added. Test the new protocol command `Runtime.getPreview` as well as the frontend model method RemoteObject.prototype.updatePreview which uses it with its own slightly different semantics about when it should be used. * inspector/debugger/tail-deleted-frames-this-value.html: This test used `CallFrame.thisObject.preview` so rewrite it to first load the preview and then check values with it. Canonical link: https://commits.webkit.org/190601@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218718 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-22 21:12:01 +00:00
InspectorTest.expectThat(!remoteObject.canLoadPreview(), `Should not be able to load a preview for a ${remoteObject.type} RemoteObject.`);
remoteObject.updatePreview((preview) => {
InspectorTest.expectNull(preview, `RemoteObject.updatePreview should return null for a ${remoteObject.type} RemoteObject.`);
resolve();
});
});
}
});
suite.addTestCase({
name: "RemoteObject.updatePreview.Null",
description: "Non-object RemoteObjects should not request a preview.",
test(resolve, reject) {
Web Inspector: InspectorTest.evaluateInPage should unwrap primitive values by default https://bugs.webkit.org/show_bug.cgi?id=180831 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Test/FrontendTestHarness.js: (FrontendTestHarness.prototype.evaluateInPage.resultObjectToReturn): (FrontendTestHarness.prototype.evaluateInPage): Unwrap the resulting RemoteObject's value if it is a primitive. Add an `options` dictionary so this behavior can be opted out. * UserInterface/Test/TestHarness.js: Add documentation of how evaluateInPage works. LayoutTests: * inspector/unit-tests/test-harness-evaluate-in-page-expected.txt: Added. * inspector/unit-tests/test-harness-evaluate-in-page.html: Added. Add test coverage for InspectorTest.evaluateInPage. Only the promise-returning variant is tested here, because the callback variant is well-used in existing tests and I plan to remove the callback variant entirely in later patches. * inspector/console/js-isLikelyStackTrace-expected.txt: * inspector/console/js-isLikelyStackTrace.html: Fix some bad tests and rebaseline. A bug was filed for the remaining failing assertion. * http/tests/inspector/dom/shapes-test.js: (TestPage.registerInitializer.InspectorTest.Shapes.receivedHighlightObject): (TestPage.registerInitializer.InspectorTest.Shapes.getShapeOutsideInfoForSelector): * http/tests/inspector/paymentrequest/payment-request-internal-properties.https.html: * inspector/console/command-line-api-copy.html: * inspector/console/console-log-proxy.html: * inspector/debugger/js-stacktrace.html: * inspector/dom/hideHighlight.html: * inspector/dom/highlightFrame.html: * inspector/dom/highlightNode.html: * inspector/dom/highlightNodeList.html: * inspector/dom/highlightQuad.html: * inspector/dom/highlightRect.html: * inspector/dom/highlightSelector.html: * inspector/page/setEmulatedMedia.html: * inspector/runtime/getPreview.html: Fix existing tests to opt out of unwrapping or use the unwrapped value directly. * inspector/dom/setEventListenerDisabled-expected.txt: Rebaseline results. This is caused by an extra promise tick in evaluateInPage. * inspector/injected-script/observable-expected.txt: * inspector/injected-script/observable.html: Fix a typo and rebaseline. Canonical link: https://commits.webkit.org/196748@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225950 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-15 01:39:11 +00:00
InspectorTest.evaluateInPage(`null`, (error, remoteObject) => {
Web Inspector: Pausing with a deep call stack can be very slow, avoid eagerly generating object previews https://bugs.webkit.org/show_bug.cgi?id=173698 Reviewed by Matt Baker. Source/JavaScriptCore: When pausing in a deep call stack the majority of the time spent in JavaScriptCore when preparing Inspector pause information is spent generating object previews for the `thisObject` of each of the call frames. In some cases, this could be more than 95% of the time generating pause information. In the common case, only one of these (the top frame) will ever be seen by users. This change avoids eagerly generating object previews up front and let the frontend request previews if they are needed. This introduces the `Runtime.getPreview` protocol command. This can be used to: - Get a preview for a RemoteObject that did not have a preview but could. - Update a preview for a RemoteObject that had a preview. This patch only uses it for the first case, but the second is valid and may be something we want to do in the future. * inspector/protocol/Runtime.json: A new command to get an up to date preview for an object. * inspector/InjectedScript.h: * inspector/InjectedScript.cpp: (Inspector::InjectedScript::getPreview): * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::InspectorRuntimeAgent::getPreview): * inspector/agents/InspectorRuntimeAgent.h: Plumbing for the new command. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.getPreview): Implementation just uses the existing helper. (InjectedScript.CallFrameProxy): Do not generate a preview for the this object as it may not be shown. Let the frontend request a preview if it wants or needs one. Source/WebInspectorUI: Introduce RemoteObject.prototype.updatePreview which can be used to update the preview of a RemoteObject with a current view for the object. Currently we only use this to fetch the preview that we did not have for the `thisObject` in the scope chain sidebar. However this could be used generically to update a RemoteObject's preview (ObjectPreview) at any time. * UserInterface/Protocol/RemoteObject.js: (WebInspector.RemoteObject.prototype.canLoadPreview): (WebInspector.RemoteObject.prototype.updatePreview): Allow a RemoteObject to update its preview property. Since this only makes sense on certain Object values include a helper to know when it is appropriate to fetch a preview. * UserInterface/Views/ObjectTreePropertyTreeElement.js: (WebInspector.ObjectTreePropertyTreeElement.prototype._createTitlePropertyStyle): (WebInspector.ObjectTreePropertyTreeElement.prototype._loadPreviewLazilyIfNeeded): If the object being shown in the sidebar does not have a preview but can load a preview then attempt to load it lazily. This is the case for the `thisObject` which is injected into an ObjectTree in the scope chain sidebar. LayoutTests: * inspector/runtime/getPreview-expected.txt: Added. * inspector/runtime/getPreview.html: Added. Test the new protocol command `Runtime.getPreview` as well as the frontend model method RemoteObject.prototype.updatePreview which uses it with its own slightly different semantics about when it should be used. * inspector/debugger/tail-deleted-frames-this-value.html: This test used `CallFrame.thisObject.preview` so rewrite it to first load the preview and then check values with it. Canonical link: https://commits.webkit.org/190601@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218718 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-22 21:12:01 +00:00
InspectorTest.expectThat(!remoteObject.canLoadPreview(), `Should not be able to load a preview for a ${remoteObject.subtype} RemoteObject.`);
remoteObject.updatePreview((preview) => {
InspectorTest.expectNull(preview, `RemoteObject.updatePreview should return null for a ${remoteObject.subtype} RemoteObject.`);
resolve();
});
Web Inspector: InspectorTest.evaluateInPage should unwrap primitive values by default https://bugs.webkit.org/show_bug.cgi?id=180831 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Test/FrontendTestHarness.js: (FrontendTestHarness.prototype.evaluateInPage.resultObjectToReturn): (FrontendTestHarness.prototype.evaluateInPage): Unwrap the resulting RemoteObject's value if it is a primitive. Add an `options` dictionary so this behavior can be opted out. * UserInterface/Test/TestHarness.js: Add documentation of how evaluateInPage works. LayoutTests: * inspector/unit-tests/test-harness-evaluate-in-page-expected.txt: Added. * inspector/unit-tests/test-harness-evaluate-in-page.html: Added. Add test coverage for InspectorTest.evaluateInPage. Only the promise-returning variant is tested here, because the callback variant is well-used in existing tests and I plan to remove the callback variant entirely in later patches. * inspector/console/js-isLikelyStackTrace-expected.txt: * inspector/console/js-isLikelyStackTrace.html: Fix some bad tests and rebaseline. A bug was filed for the remaining failing assertion. * http/tests/inspector/dom/shapes-test.js: (TestPage.registerInitializer.InspectorTest.Shapes.receivedHighlightObject): (TestPage.registerInitializer.InspectorTest.Shapes.getShapeOutsideInfoForSelector): * http/tests/inspector/paymentrequest/payment-request-internal-properties.https.html: * inspector/console/command-line-api-copy.html: * inspector/console/console-log-proxy.html: * inspector/debugger/js-stacktrace.html: * inspector/dom/hideHighlight.html: * inspector/dom/highlightFrame.html: * inspector/dom/highlightNode.html: * inspector/dom/highlightNodeList.html: * inspector/dom/highlightQuad.html: * inspector/dom/highlightRect.html: * inspector/dom/highlightSelector.html: * inspector/page/setEmulatedMedia.html: * inspector/runtime/getPreview.html: Fix existing tests to opt out of unwrapping or use the unwrapped value directly. * inspector/dom/setEventListenerDisabled-expected.txt: Rebaseline results. This is caused by an extra promise tick in evaluateInPage. * inspector/injected-script/observable-expected.txt: * inspector/injected-script/observable.html: Fix a typo and rebaseline. Canonical link: https://commits.webkit.org/196748@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225950 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-15 01:39:11 +00:00
}, {remoteObjectOnly: true});
Web Inspector: Pausing with a deep call stack can be very slow, avoid eagerly generating object previews https://bugs.webkit.org/show_bug.cgi?id=173698 Reviewed by Matt Baker. Source/JavaScriptCore: When pausing in a deep call stack the majority of the time spent in JavaScriptCore when preparing Inspector pause information is spent generating object previews for the `thisObject` of each of the call frames. In some cases, this could be more than 95% of the time generating pause information. In the common case, only one of these (the top frame) will ever be seen by users. This change avoids eagerly generating object previews up front and let the frontend request previews if they are needed. This introduces the `Runtime.getPreview` protocol command. This can be used to: - Get a preview for a RemoteObject that did not have a preview but could. - Update a preview for a RemoteObject that had a preview. This patch only uses it for the first case, but the second is valid and may be something we want to do in the future. * inspector/protocol/Runtime.json: A new command to get an up to date preview for an object. * inspector/InjectedScript.h: * inspector/InjectedScript.cpp: (Inspector::InjectedScript::getPreview): * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::InspectorRuntimeAgent::getPreview): * inspector/agents/InspectorRuntimeAgent.h: Plumbing for the new command. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.getPreview): Implementation just uses the existing helper. (InjectedScript.CallFrameProxy): Do not generate a preview for the this object as it may not be shown. Let the frontend request a preview if it wants or needs one. Source/WebInspectorUI: Introduce RemoteObject.prototype.updatePreview which can be used to update the preview of a RemoteObject with a current view for the object. Currently we only use this to fetch the preview that we did not have for the `thisObject` in the scope chain sidebar. However this could be used generically to update a RemoteObject's preview (ObjectPreview) at any time. * UserInterface/Protocol/RemoteObject.js: (WebInspector.RemoteObject.prototype.canLoadPreview): (WebInspector.RemoteObject.prototype.updatePreview): Allow a RemoteObject to update its preview property. Since this only makes sense on certain Object values include a helper to know when it is appropriate to fetch a preview. * UserInterface/Views/ObjectTreePropertyTreeElement.js: (WebInspector.ObjectTreePropertyTreeElement.prototype._createTitlePropertyStyle): (WebInspector.ObjectTreePropertyTreeElement.prototype._loadPreviewLazilyIfNeeded): If the object being shown in the sidebar does not have a preview but can load a preview then attempt to load it lazily. This is the case for the `thisObject` which is injected into an ObjectTree in the scope chain sidebar. LayoutTests: * inspector/runtime/getPreview-expected.txt: Added. * inspector/runtime/getPreview.html: Added. Test the new protocol command `Runtime.getPreview` as well as the frontend model method RemoteObject.prototype.updatePreview which uses it with its own slightly different semantics about when it should be used. * inspector/debugger/tail-deleted-frames-this-value.html: This test used `CallFrame.thisObject.preview` so rewrite it to first load the preview and then check values with it. Canonical link: https://commits.webkit.org/190601@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218718 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-22 21:12:01 +00:00
}
});
// ------ Runtime.getPreview
suite.addTestCase({
name: "Runtime.getPreview.Symbol",
description: "Runtime.getPreview should return an empty preview for non-objects.",
test(resolve, reject) {
Web Inspector: InspectorTest.evaluateInPage should unwrap primitive values by default https://bugs.webkit.org/show_bug.cgi?id=180831 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Test/FrontendTestHarness.js: (FrontendTestHarness.prototype.evaluateInPage.resultObjectToReturn): (FrontendTestHarness.prototype.evaluateInPage): Unwrap the resulting RemoteObject's value if it is a primitive. Add an `options` dictionary so this behavior can be opted out. * UserInterface/Test/TestHarness.js: Add documentation of how evaluateInPage works. LayoutTests: * inspector/unit-tests/test-harness-evaluate-in-page-expected.txt: Added. * inspector/unit-tests/test-harness-evaluate-in-page.html: Added. Add test coverage for InspectorTest.evaluateInPage. Only the promise-returning variant is tested here, because the callback variant is well-used in existing tests and I plan to remove the callback variant entirely in later patches. * inspector/console/js-isLikelyStackTrace-expected.txt: * inspector/console/js-isLikelyStackTrace.html: Fix some bad tests and rebaseline. A bug was filed for the remaining failing assertion. * http/tests/inspector/dom/shapes-test.js: (TestPage.registerInitializer.InspectorTest.Shapes.receivedHighlightObject): (TestPage.registerInitializer.InspectorTest.Shapes.getShapeOutsideInfoForSelector): * http/tests/inspector/paymentrequest/payment-request-internal-properties.https.html: * inspector/console/command-line-api-copy.html: * inspector/console/console-log-proxy.html: * inspector/debugger/js-stacktrace.html: * inspector/dom/hideHighlight.html: * inspector/dom/highlightFrame.html: * inspector/dom/highlightNode.html: * inspector/dom/highlightNodeList.html: * inspector/dom/highlightQuad.html: * inspector/dom/highlightRect.html: * inspector/dom/highlightSelector.html: * inspector/page/setEmulatedMedia.html: * inspector/runtime/getPreview.html: Fix existing tests to opt out of unwrapping or use the unwrapped value directly. * inspector/dom/setEventListenerDisabled-expected.txt: Rebaseline results. This is caused by an extra promise tick in evaluateInPage. * inspector/injected-script/observable-expected.txt: * inspector/injected-script/observable.html: Fix a typo and rebaseline. Canonical link: https://commits.webkit.org/196748@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225950 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-15 01:39:11 +00:00
InspectorTest.evaluateInPage(`Symbol.iterator`, (error, remoteObject) => {
Web Inspector: Pausing with a deep call stack can be very slow, avoid eagerly generating object previews https://bugs.webkit.org/show_bug.cgi?id=173698 Reviewed by Matt Baker. Source/JavaScriptCore: When pausing in a deep call stack the majority of the time spent in JavaScriptCore when preparing Inspector pause information is spent generating object previews for the `thisObject` of each of the call frames. In some cases, this could be more than 95% of the time generating pause information. In the common case, only one of these (the top frame) will ever be seen by users. This change avoids eagerly generating object previews up front and let the frontend request previews if they are needed. This introduces the `Runtime.getPreview` protocol command. This can be used to: - Get a preview for a RemoteObject that did not have a preview but could. - Update a preview for a RemoteObject that had a preview. This patch only uses it for the first case, but the second is valid and may be something we want to do in the future. * inspector/protocol/Runtime.json: A new command to get an up to date preview for an object. * inspector/InjectedScript.h: * inspector/InjectedScript.cpp: (Inspector::InjectedScript::getPreview): * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::InspectorRuntimeAgent::getPreview): * inspector/agents/InspectorRuntimeAgent.h: Plumbing for the new command. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.getPreview): Implementation just uses the existing helper. (InjectedScript.CallFrameProxy): Do not generate a preview for the this object as it may not be shown. Let the frontend request a preview if it wants or needs one. Source/WebInspectorUI: Introduce RemoteObject.prototype.updatePreview which can be used to update the preview of a RemoteObject with a current view for the object. Currently we only use this to fetch the preview that we did not have for the `thisObject` in the scope chain sidebar. However this could be used generically to update a RemoteObject's preview (ObjectPreview) at any time. * UserInterface/Protocol/RemoteObject.js: (WebInspector.RemoteObject.prototype.canLoadPreview): (WebInspector.RemoteObject.prototype.updatePreview): Allow a RemoteObject to update its preview property. Since this only makes sense on certain Object values include a helper to know when it is appropriate to fetch a preview. * UserInterface/Views/ObjectTreePropertyTreeElement.js: (WebInspector.ObjectTreePropertyTreeElement.prototype._createTitlePropertyStyle): (WebInspector.ObjectTreePropertyTreeElement.prototype._loadPreviewLazilyIfNeeded): If the object being shown in the sidebar does not have a preview but can load a preview then attempt to load it lazily. This is the case for the `thisObject` which is injected into an ObjectTree in the scope chain sidebar. LayoutTests: * inspector/runtime/getPreview-expected.txt: Added. * inspector/runtime/getPreview.html: Added. Test the new protocol command `Runtime.getPreview` as well as the frontend model method RemoteObject.prototype.updatePreview which uses it with its own slightly different semantics about when it should be used. * inspector/debugger/tail-deleted-frames-this-value.html: This test used `CallFrame.thisObject.preview` so rewrite it to first load the preview and then check values with it. Canonical link: https://commits.webkit.org/190601@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218718 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-22 21:12:01 +00:00
RuntimeAgent.getPreview(remoteObject.objectId, (error, result) => {
InspectorTest.log(JSON.stringify(result));
resolve();
});
});
}
});
suite.addTestCase({
name: "Runtime.getPreview.Function",
description: "Runtime.getPreview should return an empty preview for non-objects.",
test(resolve, reject) {
Web Inspector: InspectorTest.evaluateInPage should unwrap primitive values by default https://bugs.webkit.org/show_bug.cgi?id=180831 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Test/FrontendTestHarness.js: (FrontendTestHarness.prototype.evaluateInPage.resultObjectToReturn): (FrontendTestHarness.prototype.evaluateInPage): Unwrap the resulting RemoteObject's value if it is a primitive. Add an `options` dictionary so this behavior can be opted out. * UserInterface/Test/TestHarness.js: Add documentation of how evaluateInPage works. LayoutTests: * inspector/unit-tests/test-harness-evaluate-in-page-expected.txt: Added. * inspector/unit-tests/test-harness-evaluate-in-page.html: Added. Add test coverage for InspectorTest.evaluateInPage. Only the promise-returning variant is tested here, because the callback variant is well-used in existing tests and I plan to remove the callback variant entirely in later patches. * inspector/console/js-isLikelyStackTrace-expected.txt: * inspector/console/js-isLikelyStackTrace.html: Fix some bad tests and rebaseline. A bug was filed for the remaining failing assertion. * http/tests/inspector/dom/shapes-test.js: (TestPage.registerInitializer.InspectorTest.Shapes.receivedHighlightObject): (TestPage.registerInitializer.InspectorTest.Shapes.getShapeOutsideInfoForSelector): * http/tests/inspector/paymentrequest/payment-request-internal-properties.https.html: * inspector/console/command-line-api-copy.html: * inspector/console/console-log-proxy.html: * inspector/debugger/js-stacktrace.html: * inspector/dom/hideHighlight.html: * inspector/dom/highlightFrame.html: * inspector/dom/highlightNode.html: * inspector/dom/highlightNodeList.html: * inspector/dom/highlightQuad.html: * inspector/dom/highlightRect.html: * inspector/dom/highlightSelector.html: * inspector/page/setEmulatedMedia.html: * inspector/runtime/getPreview.html: Fix existing tests to opt out of unwrapping or use the unwrapped value directly. * inspector/dom/setEventListenerDisabled-expected.txt: Rebaseline results. This is caused by an extra promise tick in evaluateInPage. * inspector/injected-script/observable-expected.txt: * inspector/injected-script/observable.html: Fix a typo and rebaseline. Canonical link: https://commits.webkit.org/196748@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225950 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-15 01:39:11 +00:00
InspectorTest.evaluateInPage(`function f() {}; f`, (error, remoteObject) => {
Web Inspector: Pausing with a deep call stack can be very slow, avoid eagerly generating object previews https://bugs.webkit.org/show_bug.cgi?id=173698 Reviewed by Matt Baker. Source/JavaScriptCore: When pausing in a deep call stack the majority of the time spent in JavaScriptCore when preparing Inspector pause information is spent generating object previews for the `thisObject` of each of the call frames. In some cases, this could be more than 95% of the time generating pause information. In the common case, only one of these (the top frame) will ever be seen by users. This change avoids eagerly generating object previews up front and let the frontend request previews if they are needed. This introduces the `Runtime.getPreview` protocol command. This can be used to: - Get a preview for a RemoteObject that did not have a preview but could. - Update a preview for a RemoteObject that had a preview. This patch only uses it for the first case, but the second is valid and may be something we want to do in the future. * inspector/protocol/Runtime.json: A new command to get an up to date preview for an object. * inspector/InjectedScript.h: * inspector/InjectedScript.cpp: (Inspector::InjectedScript::getPreview): * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::InspectorRuntimeAgent::getPreview): * inspector/agents/InspectorRuntimeAgent.h: Plumbing for the new command. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.getPreview): Implementation just uses the existing helper. (InjectedScript.CallFrameProxy): Do not generate a preview for the this object as it may not be shown. Let the frontend request a preview if it wants or needs one. Source/WebInspectorUI: Introduce RemoteObject.prototype.updatePreview which can be used to update the preview of a RemoteObject with a current view for the object. Currently we only use this to fetch the preview that we did not have for the `thisObject` in the scope chain sidebar. However this could be used generically to update a RemoteObject's preview (ObjectPreview) at any time. * UserInterface/Protocol/RemoteObject.js: (WebInspector.RemoteObject.prototype.canLoadPreview): (WebInspector.RemoteObject.prototype.updatePreview): Allow a RemoteObject to update its preview property. Since this only makes sense on certain Object values include a helper to know when it is appropriate to fetch a preview. * UserInterface/Views/ObjectTreePropertyTreeElement.js: (WebInspector.ObjectTreePropertyTreeElement.prototype._createTitlePropertyStyle): (WebInspector.ObjectTreePropertyTreeElement.prototype._loadPreviewLazilyIfNeeded): If the object being shown in the sidebar does not have a preview but can load a preview then attempt to load it lazily. This is the case for the `thisObject` which is injected into an ObjectTree in the scope chain sidebar. LayoutTests: * inspector/runtime/getPreview-expected.txt: Added. * inspector/runtime/getPreview.html: Added. Test the new protocol command `Runtime.getPreview` as well as the frontend model method RemoteObject.prototype.updatePreview which uses it with its own slightly different semantics about when it should be used. * inspector/debugger/tail-deleted-frames-this-value.html: This test used `CallFrame.thisObject.preview` so rewrite it to first load the preview and then check values with it. Canonical link: https://commits.webkit.org/190601@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218718 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-22 21:12:01 +00:00
RuntimeAgent.getPreview(remoteObject.objectId, (error, result) => {
InspectorTest.log(JSON.stringify(result));
resolve();
});
});
}
});
// ------
suite.addTestCase({
name: "Runtime.getPreview.InvalidObjectId",
description: "Invalid objectId should produce and error.",
test(resolve, reject) {
const objectId = "DOES_NOT_EXIST";
RuntimeAgent.getPreview(objectId, (error) => {
InspectorTest.expectThat(error, "Should produce an error.");
InspectorTest.log("Error: " + error);
resolve();
});
}
});
suite.runTestCasesAndFinish();
}
</script>
</head>
<body onload="runTest()">
<p>Tests for the Runtime.getPreview command and associated RemoteObject.prototype.updatePreview.</p>
</body>
</html>