Diff
Modified: trunk/LayoutTests/ChangeLog (248286 => 248287)
--- trunk/LayoutTests/ChangeLog 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/LayoutTests/ChangeLog 2019-08-06 03:37:44 UTC (rev 248287)
@@ -1,5 +1,25 @@
2019-08-05 Devin Rousso <[email protected]>
+ Can't use $0, $1 etc when inspecting Google Docs pages because the content uses these for function names
+ https://bugs.webkit.org/show_bug.cgi?id=195834
+
+ Reviewed by Joseph Pecoraro.
+
+ Allow the user to alias saved results by providing a different prefix (e.g. "$") from within
+ Web Inspector. When changing the alias, all existing saved results will update to be
+ reference-able from the new alias.
+
+ * inspector/runtime/setSavedResultAlias.html: Added.
+ * inspector/runtime/setSavedResultAlias-expected.txt: Added.
+ * http/tests/inspector/dom/cross-domain-inspected-node-access-expected.txt:
+ * inspector/console/command-line-api-expected.txt:
+ * inspector/console/command-line-api-exception.html:
+ * inspector/console/command-line-api-exception-expected.txt:
+ * inspector/console/command-line-api-exception-nested-catch.html:
+ * inspector/console/command-line-api-exception-nested-catch-expected.txt:
+
+2019-08-05 Devin Rousso <[email protected]>
+
Web Inspector: Timelines: disable related agents when the tab is closed
https://bugs.webkit.org/show_bug.cgi?id=200118
Modified: trunk/LayoutTests/http/tests/inspector/dom/cross-domain-inspected-node-access-expected.txt (248286 => 248287)
--- trunk/LayoutTests/http/tests/inspector/dom/cross-domain-inspected-node-access-expected.txt 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/LayoutTests/http/tests/inspector/dom/cross-domain-inspected-node-access-expected.txt 2019-08-06 03:37:44 UTC (rev 248287)
@@ -1,5 +1,5 @@
-CONSOLE MESSAGE: line 44: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
-CONSOLE MESSAGE: line 44: Blocked a frame with origin "http://localhost:8000" from accessing a frame with origin "http://127.0.0.1:8000". Protocols, domains, and ports must match.
+CONSOLE MESSAGE: line 49: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
+CONSOLE MESSAGE: line 49: Blocked a frame with origin "http://localhost:8000" from accessing a frame with origin "http://127.0.0.1:8000". Protocols, domains, and ports must match.
Test that code evaluated in the main frame cannot access $0 that resolves to a node in a frame from a different domain. Bug 105423.
Modified: trunk/LayoutTests/inspector/console/command-line-api-expected.txt (248286 => 248287)
--- trunk/LayoutTests/inspector/console/command-line-api-expected.txt 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/LayoutTests/inspector/console/command-line-api-expected.txt 2019-08-06 03:37:44 UTC (rev 248287)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: line 12: The console function $() has changed from $=getElementById(id) to $=querySelector(selector). You might try $("#%s")
+CONSOLE MESSAGE: line 17: The console function $() has changed from $=getElementById(id) to $=querySelector(selector). You might try $("#%s")
Tests that command line api works.
Modified: trunk/LayoutTests/inspector/debugger/command-line-api-exception-expected.txt (248286 => 248287)
--- trunk/LayoutTests/inspector/debugger/command-line-api-exception-expected.txt 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/LayoutTests/inspector/debugger/command-line-api-exception-expected.txt 2019-08-06 03:37:44 UTC (rev 248287)
@@ -15,7 +15,8 @@
== Running test suite: CommandLineAPI.$exception
-- Running test case: BeforeExceptions
-PASS: $exception should be undefined if there is no exception.
+PASS: $exception should throw an error if there is no exception.
+ReferenceError: Can't find variable: $exception
-- Running test case: UncaughtTypeException
$exception => TypeError: undefined is not an object (evaluating '[].x.x')
@@ -69,5 +70,6 @@
$exception => Object
-- Running test case: AfterExceptions
-PASS: $exception should be undefined if there is no exception.
+PASS: $exception should throw an error if there is no exception.
+ReferenceError: Can't find variable: $exception
Modified: trunk/LayoutTests/inspector/debugger/command-line-api-exception-nested-catch-expected.txt (248286 => 248287)
--- trunk/LayoutTests/inspector/debugger/command-line-api-exception-nested-catch-expected.txt 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/LayoutTests/inspector/debugger/command-line-api-exception-nested-catch-expected.txt 2019-08-06 03:37:44 UTC (rev 248287)
@@ -5,7 +5,8 @@
== Running test suite: CommandLineAPI.$exception
-- Running test case: EmptyBefore
-PASS: $exception should be undefined if there is no exception.
+PASS: $exception should throw an error if there is no exception.
+ReferenceError: Can't find variable: $exception
-- Running test case: CheckExceptionInsideNestedCatchBlocks
OUTER 1: $exception => outer exception
@@ -16,5 +17,6 @@
CATCH: $exception === e1 ? true
-- Running test case: EmptyAfter
-PASS: $exception should be undefined if there is no exception.
+PASS: $exception should throw an error if there is no exception.
+ReferenceError: Can't find variable: $exception
Modified: trunk/LayoutTests/inspector/debugger/command-line-api-exception-nested-catch.html (248286 => 248287)
--- trunk/LayoutTests/inspector/debugger/command-line-api-exception-nested-catch.html 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/LayoutTests/inspector/debugger/command-line-api-exception-nested-catch.html 2019-08-06 03:37:44 UTC (rev 248287)
@@ -27,10 +27,11 @@
suite.addTestCase({
name: "EmptyBefore",
- description: "Without exceptions, $exception should be undefined",
+ description: "Without exceptions, $exception should not be defined",
test(resolve, reject) {
WI.runtimeManager.evaluateInInspectedWindow("$exception", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, (result, wasThrown) => {
- InspectorTest.expectThat(result.description === "undefined", "$exception should be undefined if there is no exception.");
+ InspectorTest.expectThat(wasThrown, "$exception should throw an error if there is no exception.");
+ InspectorTest.log(result.description);
resolve();
});
}
@@ -87,10 +88,11 @@
suite.addTestCase({
name: "EmptyAfter",
- description: "Without exceptions, $exception should be undefined",
+ description: "Without exceptions, $exception should not be defined",
test(resolve, reject) {
WI.runtimeManager.evaluateInInspectedWindow("$exception", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, (result, wasThrown) => {
- InspectorTest.expectThat(result.description === "undefined", "$exception should be undefined if there is no exception.");
+ InspectorTest.expectThat(wasThrown, "$exception should throw an error if there is no exception.");
+ InspectorTest.log(result.description);
resolve();
});
}
Modified: trunk/LayoutTests/inspector/debugger/command-line-api-exception.html (248286 => 248287)
--- trunk/LayoutTests/inspector/debugger/command-line-api-exception.html 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/LayoutTests/inspector/debugger/command-line-api-exception.html 2019-08-06 03:37:44 UTC (rev 248287)
@@ -18,7 +18,8 @@
name, description: "Without exceptions, $exception should be undefined",
test(resolve, reject) {
WI.runtimeManager.evaluateInInspectedWindow("$exception", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, (result, wasThrown) => {
- InspectorTest.expectThat(result.description === "undefined", "$exception should be undefined if there is no exception.");
+ InspectorTest.expectThat(wasThrown, "$exception should throw an error if there is no exception.");
+ InspectorTest.log(result.description);
resolve();
});
}
Added: trunk/LayoutTests/inspector/runtime/setSavedResultAlias-expected.txt (0 => 248287)
--- trunk/LayoutTests/inspector/runtime/setSavedResultAlias-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/runtime/setSavedResultAlias-expected.txt 2019-08-06 03:37:44 UTC (rev 248287)
@@ -0,0 +1,28 @@
+Tests for the Runtime.setSavedResultAlias command.
+
+
+== Running test suite: Runtime.setSavedResultAlias
+-- Running test case: Runtime.setSavedResultAlias
+Saving value...
+
+Getting saved value at '$1'...
+PASS: Saved value should match $1.
+Getting saved value at 'temp1'...
+PASS: Should produce an exception.
+Error: ReferenceError: Can't find variable: temp1
+
+Changing saved result alias to "temp"...
+
+Getting saved value at '$1'...
+PASS: Saved value should still match $1.
+Getting saved value at 'temp1'...
+PASS: Saved value should now match temp1.
+
+Changing saved result alias to ""...
+
+Getting saved value at '$1'...
+PASS: Saved value should still match $1.
+Getting saved value at 'temp1'...
+PASS: Should produce an exception.
+Error: ReferenceError: Can't find variable: temp1
+
Added: trunk/LayoutTests/inspector/runtime/setSavedResultAlias.html (0 => 248287)
--- trunk/LayoutTests/inspector/runtime/setSavedResultAlias.html (rev 0)
+++ trunk/LayoutTests/inspector/runtime/setSavedResultAlias.html 2019-08-06 03:37:44 UTC (rev 248287)
@@ -0,0 +1,73 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+function test()
+{
+ function createCallArgumentWithValue(value) {
+ return {value};
+ }
+
+ async function getSavedResult(savedResultPrefix, savedResultIndex) {
+ InspectorTest.log(`Getting saved value at '${savedResultPrefix}${savedResultIndex}'...`);
+ let {result, wasThrown} = await RuntimeAgent.evaluate.invoke({
+ _expression_: savedResultPrefix + savedResultIndex,
+ objectGroup: "test",
+ includeCommandLineAPI: true,
+ returnByValue: true,
+ });
+ if (wasThrown)
+ throw new Error(result.description);
+ return result.value;
+ }
+
+ async function changeSavedResultAlias(alias) {
+ InspectorTest.log(`Changing saved result alias to "${alias}"...`);
+ await RuntimeAgent.setSavedResultAlias(alias);
+ }
+
+ let suite = InspectorTest.createAsyncSuite("Runtime.setSavedResultAlias");
+
+ suite.addTestCase({
+ name: "Runtime.setSavedResultAlias",
+ description: "Saving a new value should produce a new $n value.",
+ async test() {
+ const value = 123;
+
+ InspectorTest.log("Saving value...");
+ let {savedResultIndex} = await RuntimeAgent.saveResult(createCallArgumentWithValue(value));
+
+ InspectorTest.newline();
+
+ InspectorTest.expectEqual(value, await getSavedResult("$", savedResultIndex), `Saved value should match $${savedResultIndex}.`);
+ await InspectorTest.expectException(() => getSavedResult("temp", savedResultIndex));
+
+ InspectorTest.newline();
+
+ await changeSavedResultAlias("temp");
+
+ InspectorTest.newline();
+
+ InspectorTest.expectEqual(value, await getSavedResult("$", savedResultIndex), `Saved value should still match $${savedResultIndex}.`);
+ InspectorTest.expectEqual(value, await getSavedResult("temp", savedResultIndex), `Saved value should now match temp${savedResultIndex}.`);
+
+ InspectorTest.newline();
+
+ await changeSavedResultAlias("");
+
+ InspectorTest.newline();
+
+ InspectorTest.expectEqual(value, await getSavedResult("$", savedResultIndex), `Saved value should still match $${savedResultIndex}.`);
+ await InspectorTest.expectException(() => getSavedResult("temp", savedResultIndex));
+ },
+ });
+
+ suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body _onload_="runTest()">
+ <p>Tests for the Runtime.setSavedResultAlias command.</p>
+</body>
+</html>
Modified: trunk/Source/_javascript_Core/ChangeLog (248286 => 248287)
--- trunk/Source/_javascript_Core/ChangeLog 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/_javascript_Core/ChangeLog 2019-08-06 03:37:44 UTC (rev 248287)
@@ -1,5 +1,38 @@
2019-08-05 Devin Rousso <[email protected]>
+ Can't use $0, $1 etc when inspecting Google Docs pages because the content uses these for function names
+ https://bugs.webkit.org/show_bug.cgi?id=195834
+
+ Reviewed by Joseph Pecoraro.
+
+ Allow the user to alias saved results by providing a different prefix (e.g. "$") from within
+ Web Inspector. When changing the alias, all existing saved results will update to be
+ reference-able from the new alias.
+
+ * inspector/protocol/Runtime.json:
+ Add `setSavedResultAlias` command.
+
+ * inspector/agents/InspectorRuntimeAgent.h:
+ * inspector/agents/InspectorRuntimeAgent.cpp:
+ (Inspector::InspectorRuntimeAgent::setSavedResultAlias): Added.
+
+ * inspector/InjectedScriptHost.h:
+ (Inspector::InjectedScriptHost::setSavedResultAlias): Added.
+ (Inspector::InjectedScriptHost::savedResultAlias const): Added.
+ * inspector/JSInjectedScriptHost.h:
+ * inspector/JSInjectedScriptHost.cpp:
+ (Inspector::JSInjectedScriptHost::savedResultAlias const): Added.
+ * inspector/JSInjectedScriptHostPrototype.cpp:
+ (Inspector::JSInjectedScriptHostPrototype::finishCreation):
+ (Inspector::jsInjectedScriptHostPrototypeAttributeSavedResultAlias): Added.
+ Store the saved result alias on the `InjectedScriptHost` since it is a shared object among
+ all `InjectedScript`.
+
+ * inspector/InjectedScriptSource.js:
+ (BasicCommandLineAPI):
+
+2019-08-05 Devin Rousso <[email protected]>
+
Web Inspector: Timelines: disable related agents when the tab is closed
https://bugs.webkit.org/show_bug.cgi?id=200118
Modified: trunk/Source/_javascript_Core/inspector/InjectedScriptHost.h (248286 => 248287)
--- trunk/Source/_javascript_Core/inspector/InjectedScriptHost.h 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/_javascript_Core/inspector/InjectedScriptHost.h 2019-08-06 03:37:44 UTC (rev 248287)
@@ -27,6 +27,7 @@
#include "JSCJSValueInlines.h"
#include "PerGlobalObjectWrapperWorld.h"
+#include <wtf/Optional.h>
#include <wtf/RefCounted.h>
namespace Inspector {
@@ -43,8 +44,12 @@
JSC::JSValue wrapper(JSC::ExecState*, JSC::JSGlobalObject*);
void clearAllWrappers();
+ void setSavedResultAlias(const Optional<String>& alias) { m_savedResultAlias = alias; }
+ const Optional<String>& savedResultAlias() const { return m_savedResultAlias; }
+
private:
PerGlobalObjectWrapperWorld m_wrappers;
+ Optional<String> m_savedResultAlias;
};
} // namespace Inspector
Modified: trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js (248286 => 248287)
--- trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js 2019-08-06 03:37:44 UTC (rev 248287)
@@ -1453,22 +1453,37 @@
function BasicCommandLineAPI(callFrame)
{
- this.$_ = injectedScript._lastResult;
- this.$exception = injectedScript._exceptionValue;
+ let savedResultAlias = InjectedScriptHost.savedResultAlias;
+ let defineGetter = (key, value) => {
+ if (typeof value !== "function") {
+ let originalValue = value;
+ value = function() { return originalValue; };
+ }
+
+ this.__defineGetter__("$" + key, value);
+ if (savedResultAlias)
+ this.__defineGetter__(savedResultAlias + key, value);
+ };
+
+ if ("_lastResult" in injectedScript)
+ defineGetter("_", injectedScript._lastResult);
+
+ if ("_exceptionValue" in injectedScript)
+ defineGetter("exception", injectedScript._exceptionValue);
+
if ("_eventValue" in injectedScript)
- this.$event = injectedScript._eventValue;
- else if ("$event" in this)
- delete this.$event;
+ defineGetter("event", injectedScript._eventValue);
// $1-$99
for (let i = 1; i <= injectedScript._savedResults.length; ++i)
- this.__defineGetter__("$" + i, bind(injectedScript._savedResult, injectedScript, i));
+ defineGetter(i, bind(injectedScript._savedResult, injectedScript, i));
// Command Line API methods.
for (let i = 0; i < BasicCommandLineAPI.methods.length; ++i) {
let method = BasicCommandLineAPI.methods[i];
- this[method.name] = method;
+ this[method] = bind(commandLineAPIImpl[method], commandLineAPIImpl);
+ this[method].toString = function() { return "function " + method + "() { [Command Line API] }" };
}
}
Modified: trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp (248286 => 248287)
--- trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp 2019-08-06 03:37:44 UTC (rev 248287)
@@ -102,6 +102,14 @@
return globalObject->evalFunction();
}
+JSValue JSInjectedScriptHost::savedResultAlias(ExecState* exec) const
+{
+ auto savedResultAlias = impl().savedResultAlias();
+ if (!savedResultAlias)
+ return jsUndefined();
+ return jsString(exec, savedResultAlias.value());
+}
+
JSValue JSInjectedScriptHost::evaluateWithScopeExtension(ExecState* exec)
{
VM& vm = exec->vm();
Modified: trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.h (248286 => 248287)
--- trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.h 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.h 2019-08-06 03:37:44 UTC (rev 248287)
@@ -57,6 +57,7 @@
// Attributes.
JSC::JSValue evaluate(JSC::ExecState*) const;
+ JSC::JSValue savedResultAlias(JSC::ExecState*) const;
// Functions.
JSC::JSValue evaluateWithScopeExtension(JSC::ExecState*);
Modified: trunk/Source/_javascript_Core/inspector/JSInjectedScriptHostPrototype.cpp (248286 => 248287)
--- trunk/Source/_javascript_Core/inspector/JSInjectedScriptHostPrototype.cpp 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/_javascript_Core/inspector/JSInjectedScriptHostPrototype.cpp 2019-08-06 03:37:44 UTC (rev 248287)
@@ -54,6 +54,7 @@
static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionEvaluateWithScopeExtension(ExecState*);
static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeAttributeEvaluate(ExecState*);
+static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeAttributeSavedResultAlias(ExecState*);
const ClassInfo JSInjectedScriptHostPrototype::s_info = { "InjectedScriptHost", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSInjectedScriptHostPrototype) };
@@ -78,6 +79,7 @@
JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("evaluateWithScopeExtension", jsInjectedScriptHostPrototypeFunctionEvaluateWithScopeExtension, static_cast<unsigned>(PropertyAttribute::DontEnum), 1);
JSC_NATIVE_GETTER_WITHOUT_TRANSITION("evaluate", jsInjectedScriptHostPrototypeAttributeEvaluate, PropertyAttribute::DontEnum | PropertyAttribute::Accessor);
+ JSC_NATIVE_GETTER_WITHOUT_TRANSITION("savedResultAlias", jsInjectedScriptHostPrototypeAttributeSavedResultAlias, PropertyAttribute::DontEnum | PropertyAttribute::Accessor);
}
EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeAttributeEvaluate(ExecState* exec)
@@ -93,6 +95,19 @@
return JSValue::encode(castedThis->evaluate(exec));
}
+EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeAttributeSavedResultAlias(ExecState* exec)
+{
+ VM& vm = exec->vm();
+ auto scope = DECLARE_THROW_SCOPE(vm);
+
+ JSValue thisValue = exec->thisValue();
+ JSInjectedScriptHost* castedThis = jsDynamicCast<JSInjectedScriptHost*>(vm, thisValue);
+ if (!castedThis)
+ return throwVMTypeError(exec, scope);
+
+ return JSValue::encode(castedThis->savedResultAlias(exec));
+}
+
EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionInternalConstructorName(ExecState* exec)
{
VM& vm = exec->vm();
Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorRuntimeAgent.cpp (248286 => 248287)
--- trunk/Source/_javascript_Core/inspector/agents/InspectorRuntimeAgent.cpp 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorRuntimeAgent.cpp 2019-08-06 03:37:44 UTC (rev 248287)
@@ -260,6 +260,14 @@
injectedScript.saveResult(errorString, callArgument.toJSONString(), savedResultIndex);
}
+void InspectorRuntimeAgent::setSavedResultAlias(ErrorString&, const String* alias)
+{
+ Optional<String> savedResultAlias;
+ if (alias && !alias->isEmpty())
+ savedResultAlias = *alias;
+ m_injectedScriptManager.injectedScriptHost().setSavedResultAlias(savedResultAlias);
+}
+
void InspectorRuntimeAgent::releaseObject(ErrorString&, const String& objectId)
{
InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId);
Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorRuntimeAgent.h (248286 => 248287)
--- trunk/Source/_javascript_Core/inspector/agents/InspectorRuntimeAgent.h 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorRuntimeAgent.h 2019-08-06 03:37:44 UTC (rev 248287)
@@ -68,6 +68,7 @@
void getDisplayableProperties(ErrorString&, const String& objectId, const bool* generatePreview, RefPtr<JSON::ArrayOf<Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<JSON::ArrayOf<Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties) final;
void getCollectionEntries(ErrorString&, const String& objectId, const String* objectGroup, const int* startIndex, const int* numberToFetch, RefPtr<JSON::ArrayOf<Protocol::Runtime::CollectionEntry>>& entries) final;
void saveResult(ErrorString&, const JSON::Object& callArgument, const int* executionContextId, Optional<int>& savedResultIndex) final;
+ void setSavedResultAlias(ErrorString&, const String* alias) final;
void releaseObjectGroup(ErrorString&, const String& objectGroup) final;
void getRuntimeTypesForVariablesAtOffsets(ErrorString&, const JSON::Array& locations, RefPtr<JSON::ArrayOf<Protocol::Runtime::TypeDescription>>&) override;
void enableTypeProfiler(ErrorString&) override;
Modified: trunk/Source/_javascript_Core/inspector/protocol/Runtime.json (248286 => 248287)
--- trunk/Source/_javascript_Core/inspector/protocol/Runtime.json 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/_javascript_Core/inspector/protocol/Runtime.json 2019-08-06 03:37:44 UTC (rev 248287)
@@ -318,6 +318,13 @@
]
},
{
+ "name": "setSavedResultAlias",
+ "description": "Creates an additional reference to all saved values in the Console using the the given string as a prefix instead of $.",
+ "parameters": [
+ { "name": "alias", "type": "string", "optional": true, "description": "Passing an empty/null string will clear the alias." }
+ ]
+ },
+ {
"name": "releaseObject",
"description": "Releases remote object with given id.",
"parameters": [
Modified: trunk/Source/WebCore/ChangeLog (248286 => 248287)
--- trunk/Source/WebCore/ChangeLog 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/WebCore/ChangeLog 2019-08-06 03:37:44 UTC (rev 248287)
@@ -1,5 +1,21 @@
2019-08-05 Devin Rousso <[email protected]>
+ Can't use $0, $1 etc when inspecting Google Docs pages because the content uses these for function names
+ https://bugs.webkit.org/show_bug.cgi?id=195834
+
+ Reviewed by Joseph Pecoraro.
+
+ Allow the user to alias saved results by providing a different prefix (e.g. "$") from within
+ Web Inspector. When changing the alias, all existing saved results will update to be
+ reference-able from the new alias.
+
+ Test: inspector/runtime/setSavedResultAlias.html
+
+ * inspector/CommandLineAPIModuleSource.js:
+ (CommandLineAPI):
+
+2019-08-05 Devin Rousso <[email protected]>
+
Web Inspector: Timelines: disable related agents when the tab is closed
https://bugs.webkit.org/show_bug.cgi?id=200118
Modified: trunk/Source/WebCore/inspector/CommandLineAPIModuleSource.js (248286 => 248287)
--- trunk/Source/WebCore/inspector/CommandLineAPIModuleSource.js 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/WebCore/inspector/CommandLineAPIModuleSource.js 2019-08-06 03:37:44 UTC (rev 248287)
@@ -46,16 +46,34 @@
*/
function CommandLineAPI(commandLineAPIImpl, callFrame)
{
- this.$_ = injectedScript._lastResult;
- this.$event = injectedScript._eventValue;
- this.$exception = injectedScript._exceptionValue;
+ let savedResultAlias = InjectedScriptHost.savedResultAlias;
+ let defineGetter = (key, value) => {
+ if (typeof value !== "function") {
+ let originalValue = value;
+ value = function() { return originalValue; };
+ }
+
+ this.__defineGetter__("$" + key, value);
+ if (savedResultAlias)
+ this.__defineGetter__(savedResultAlias + key, value);
+ };
+
+ if ("_lastResult" in injectedScript)
+ defineGetter("_", injectedScript._lastResult);
+
+ if ("_exceptionValue" in injectedScript)
+ defineGetter("exception", injectedScript._exceptionValue);
+
+ if ("_eventValue" in injectedScript)
+ defineGetter("event", injectedScript._eventValue);
+
// $0
- this.__defineGetter__("$0", bind(commandLineAPIImpl._inspectedObject, commandLineAPIImpl));
+ defineGetter("0", bind(commandLineAPIImpl._inspectedObject, commandLineAPIImpl));
// $1-$99
for (let i = 1; i <= injectedScript._savedResults.length; ++i)
- this.__defineGetter__("$" + i, bind(injectedScript._savedResult, injectedScript, i));
+ defineGetter(i, bind(injectedScript._savedResult, injectedScript, i));
// Command Line API methods.
for (let i = 0; i < CommandLineAPI.methods.length; ++i) {
Modified: trunk/Source/WebInspectorUI/ChangeLog (248286 => 248287)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-08-06 03:37:44 UTC (rev 248287)
@@ -1,5 +1,65 @@
2019-08-05 Devin Rousso <[email protected]>
+ Can't use $0, $1 etc when inspecting Google Docs pages because the content uses these for function names
+ https://bugs.webkit.org/show_bug.cgi?id=195834
+
+ Reviewed by Joseph Pecoraro.
+
+ Allow the user to alias saved results by providing a different prefix (e.g. "$") from within
+ Web Inspector. When changing the alias, all existing saved results will update to be
+ reference-able from the new alias.
+
+ * UserInterface/Controllers/RuntimeManager.js:
+ (WI.RuntimeManager):
+ (WI.RuntimeManager.preferredSavedResultPrefix): Added.
+ (WI.RuntimeManager.prototype.initializeTarget):
+ * UserInterface/Controllers/_javascript_RuntimeCompletionProvider.js:
+ (WI._javascript_RuntimeCompletionProvider.completionControllerCompletionsNeeded.receivedPropertyNames):
+
+ * UserInterface/Base/Setting.js:
+ * UserInterface/Base/Main.js:
+ (WI.contentLoaded):
+ (WI.contentLoaded.updateConsoleSavedResultPrefixCSSVariable): Added.
+ * UserInterface/Views/ConsoleMessageView.js:
+ (WI.ConsoleMessageView.prototype.toClipboardString):
+ (WI.ConsoleMessageView.prototype.removeEventListeners): Added.
+ (WI.ConsoleMessageView.prototype._appendSavedResultIndex):
+ (WI.ConsoleMessageView.prototype._appendSavedResultIndex.updateSavedVariableText): Added.
+ (WI.ConsoleMessageView.prototype._rootPropertyPathForObject):
+ (WI.ConsoleMessageView.prototype._rootPropertyPathForObject.prefixSavedResultIndex): Added.
+ * UserInterface/Views/LogContentView.js:
+ (WI.LogContentView.prototype._sessionStarted):
+ (WI.LogContentView.prototype._logCleared):
+ * UserInterface/Views/DOMTreeOutline.css:
+ (.tree-outline.dom.show-last-selected li.last-selected > span::after):
+ * UserInterface/Views/QuickConsole.js:
+ (WI.QuickConsole):
+ (WI.QuickConsole.prototype.closed):
+ (WI.QuickConsole.prototype._updateAutomaticExecutionContextPathComponentTooltip): Added.
+ Listen for changes to the setting that holds the current saved result alias and update any
+ related UI accordingly.
+
+ * UserInterface/Views/SettingsTabContentView.js:
+ (WI.SettingsTabContentView.prototype._createConsoleSettingsView):
+ * UserInterface/Views/SettingsTabContentView.css:
+ (.content-view.settings > .settings-view > .container > .editor-group > .editor input[type="text"]): Added.
+ * UserInterface/Views/SettingsGroup.js:
+ (WI.SettingsGroup.prototype.addCustomEditor): Added.
+ Add an input to the Settings tab that controls the saved result prefix alias. Only allow
+ [a-zA-Z0-9_$] as values (but [0-9] cannot be used as the start).
+
+ * UserInterface/Models/PropertyPath.js:
+ (WI.PropertyPath.prototype.set pathComponent): Added.
+ Miscellaneous getters/setters.
+
+ * Localizations/en.lproj/localizedStrings.js:
+
+ * UserInterface/Test/TestHarness.js:
+ (TestHarness.prototype.newline): Added.
+ Convenience function for adding newlines to test results.
+
+2019-08-05 Devin Rousso <[email protected]>
+
Web Inspector: Timelines: disable related agents when the tab is closed
https://bugs.webkit.org/show_bug.cgi?id=200118
Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (248286 => 248287)
--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2019-08-06 03:37:44 UTC (rev 248287)
@@ -467,7 +467,7 @@
localizedStrings["Events:"] = "Events:";
localizedStrings["Example: \u201C%s\u201D"] = "Example: \u201C%s\u201D";
localizedStrings["Exception with thrown value: %s"] = "Exception with thrown value: %s";
-localizedStrings["Execution context for $0"] = "Execution context for $0";
+localizedStrings["Execution context for %s"] = "Execution context for %s";
localizedStrings["Exited Full-Screen Mode"] = "Exited Full-Screen Mode";
localizedStrings["Expand All"] = "Expand All";
localizedStrings["Expand columns"] = "Expand columns";
@@ -924,6 +924,7 @@
localizedStrings["Save Selected"] = "Save Selected";
localizedStrings["Save configuration"] = "Save configuration";
localizedStrings["Saved Recordings"] = "Saved Recordings";
+localizedStrings["Saved Result Alias:"] = "Saved Result Alias:";
localizedStrings["Saved States"] = "Saved States";
localizedStrings["Scheduling:"] = "Scheduling:";
localizedStrings["Scheme"] = "Scheme";
Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (248286 => 248287)
--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2019-08-06 03:37:44 UTC (rev 248287)
@@ -573,6 +573,12 @@
WI.tabBar.addEventListener(WI.TabBar.Event.TabBarItemRemoved, WI._rememberOpenTabs);
WI.tabBar.addEventListener(WI.TabBar.Event.TabBarItemsReordered, WI._rememberOpenTabs);
+ function updateConsoleSavedResultPrefixCSSVariable() {
+ document.body.style.setProperty("--console-saved-result-prefix", "\"" + WI.RuntimeManager.preferredSavedResultPrefix() + "\"");
+ }
+ WI.settings.consoleSavedResultAlias.addEventListener(WI.Setting.Event.Changed, updateConsoleSavedResultPrefixCSSVariable);
+ updateConsoleSavedResultPrefixCSSVariable();
+
// Signal that the frontend is now ready to receive messages.
WI.whenTargetsAvailable().then(() => {
InspectorFrontendAPI.loadCompleted();
Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js (248286 => 248287)
--- trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js 2019-08-06 03:37:44 UTC (rev 248287)
@@ -143,6 +143,7 @@
canvasRecordingAutoCaptureEnabled: new WI.Setting("canvas-recording-auto-capture-enabled", false),
canvasRecordingAutoCaptureFrameCount: new WI.Setting("canvas-recording-auto-capture-frame-count", 1),
consoleAutoExpandTrace: new WI.Setting("console-auto-expand-trace", true),
+ consoleSavedResultAlias: new WI.Setting("console-saved-result-alias", ""),
cssChangesPerNode: new WI.Setting("css-changes-per-node", false),
clearLogOnNavigate: new WI.Setting("clear-log-on-navigate", true),
clearNetworkOnNavigate: new WI.Setting("clear-network-on-navigate", true),
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/_javascript_RuntimeCompletionProvider.js (248286 => 248287)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/_javascript_RuntimeCompletionProvider.js 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/_javascript_RuntimeCompletionProvider.js 2019-08-06 03:37:44 UTC (rev 248287)
@@ -229,9 +229,19 @@
for (let name of commandLineAPI)
propertyNames[name] = true;
+ let savedResultAlias = WI.settings.consoleSavedResultAlias.value;
+ if (savedResultAlias) {
+ propertyNames[savedResultAlias + "0"] = true;
+ propertyNames[savedResultAlias + "_"] = true;
+ }
+
// FIXME: Due to caching, sometimes old $n values show up as completion results even though they are not available. We should clear that proactively.
- for (var i = 1; i <= WI.ConsoleCommandResultMessage.maximumSavedResultIndex; ++i)
+ for (var i = 1; i <= WI.ConsoleCommandResultMessage.maximumSavedResultIndex; ++i) {
propertyNames["$" + i] = true;
+
+ if (savedResultAlias)
+ propertyNames[savedResultAlias + i] = true;
+ }
}
propertyNames = Object.keys(propertyNames);
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js (248286 => 248287)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js 2019-08-06 03:37:44 UTC (rev 248287)
@@ -31,6 +31,14 @@
this._activeExecutionContext = null;
+ WI.settings.consoleSavedResultAlias.addEventListener(WI.Setting.Event.Changed, (event) => {
+ for (let target of WI.targets) {
+ // COMPATIBILITY (iOS 12.2): Runtime.setSavedResultAlias did not exist.
+ if (target.RuntimeAgent.setSavedResultAlias)
+ target.RuntimeAgent.setSavedResultAlias(WI.settings.consoleSavedResultAlias.value);
+ }
+ });
+
WI.Frame.addEventListener(WI.Frame.Event.ExecutionContextsCleared, this._frameExecutionContextsCleared, this);
}
@@ -42,6 +50,14 @@
return !!InspectorBackend.domains.Runtime.awaitPromise;
}
+ static preferredSavedResultPrefix()
+ {
+ // COMPATIBILITY (iOS 12.2): Runtime.setSavedResultAlias did not exist.
+ if (!InspectorBackend.domains.Runtime.setSavedResultAlias)
+ return "$";
+ return WI.settings.consoleSavedResultAlias.value || "$";
+ }
+
// Target
initializeTarget(target)
@@ -52,9 +68,13 @@
if (target.RuntimeAgent.enableTypeProfiler && WI.settings.showJavaScriptTypeInformation.value)
target.RuntimeAgent.enableTypeProfiler();
- // COMPATIBILITY (iOS 10): Runtime.enableControlFlowProfiler did not exist
+ // COMPATIBILITY (iOS 10): Runtime.enableControlFlowProfiler did not exist.
if (target.RuntimeAgent.enableControlFlowProfiler && WI.settings.enableControlFlowProfiler.value)
target.RuntimeAgent.enableControlFlowProfiler();
+
+ // COMPATIBILITY (iOS 12.2): Runtime.setSavedResultAlias did not exist.
+ if (target.RuntimeAgent.setSavedResultAlias && WI.settings.consoleSavedResultAlias.value)
+ target.RuntimeAgent.setSavedResultAlias(WI.settings.consoleSavedResultAlias.value);
}
// Public
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/PropertyPath.js (248286 => 248287)
--- trunk/Source/WebInspectorUI/UserInterface/Models/PropertyPath.js 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/PropertyPath.js 2019-08-06 03:37:44 UTC (rev 248287)
@@ -55,7 +55,9 @@
get object() { return this._object; }
get parent() { return this._parent; }
get isPrototype() { return this._isPrototype; }
+
get pathComponent() { return this._pathComponent; }
+ set pathComponent(pathComponent) { this._pathComponent = pathComponent; }
get rootObject()
{
Modified: trunk/Source/WebInspectorUI/UserInterface/Test/TestHarness.js (248286 => 248287)
--- trunk/Source/WebInspectorUI/UserInterface/Test/TestHarness.js 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/WebInspectorUI/UserInterface/Test/TestHarness.js 2019-08-06 03:37:44 UTC (rev 248287)
@@ -97,6 +97,11 @@
this.addResult(message);
}
+ newline()
+ {
+ this.log("");
+ }
+
json(object, filter)
{
this.log(JSON.stringify(object, filter || null, 2));
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js (248286 => 248287)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js 2019-08-06 03:37:44 UTC (rev 248287)
@@ -203,7 +203,7 @@
{
let clipboardString = this._messageBodyElement.innerText.removeWordBreakCharacters();
if (this._message.savedResultIndex)
- clipboardString = clipboardString.replace(/\s*=\s*(\$\d+)$/, "");
+ clipboardString = clipboardString.replace(new RegExp(`\\s*=\\s*(${WI.RuntimeManager.preferredSavedResultPrefix()}\\d+)$`), "");
let hasStackTrace = this._shouldShowStackTrace();
if (!hasStackTrace) {
@@ -240,6 +240,12 @@
return clipboardString;
}
+ removeEventListeners()
+ {
+ // FIXME: <https://webkit.org/b/196956> Web Inspector: use weak collections for holding event listeners
+ WI.settings.consoleSavedResultAlias.removeEventListener(null, null, this);
+ }
+
// Private
_appendMessageTextAndArguments(element)
@@ -346,7 +352,8 @@
_appendSavedResultIndex(element)
{
- if (!this._message.savedResultIndex)
+ let savedResultIndex = this._message.savedResultIndex;
+ if (!savedResultIndex)
return;
console.assert(this._message instanceof WI.ConsoleCommandResultMessage);
@@ -354,8 +361,14 @@
var savedVariableElement = document.createElement("span");
savedVariableElement.classList.add("console-saved-variable");
- savedVariableElement.textContent = " = $" + this._message.savedResultIndex;
+ // FIXME: <https://webkit.org/b/196956> Web Inspector: use weak collections for holding event listeners
+ function updateSavedVariableText() {
+ savedVariableElement.textContent = " = " + WI.RuntimeManager.preferredSavedResultPrefix() + savedResultIndex;
+ }
+ WI.settings.consoleSavedResultAlias.addEventListener(WI.Setting.Event.Changed, updateSavedVariableText, this);
+ updateSavedVariableText();
+
if (this._objectTree)
this._objectTree.appendTitleSuffix(savedVariableElement);
else
@@ -692,10 +705,22 @@
_rootPropertyPathForObject(object)
{
- if (!this._message.savedResultIndex)
+ let savedResultIndex = this._message.savedResultIndex;
+ if (!savedResultIndex)
return null;
- return new WI.PropertyPath(object, "$" + this._message.savedResultIndex);
+ function prefixSavedResultIndex() {
+ return WI.RuntimeManager.preferredSavedResultPrefix() + savedResultIndex;
+ }
+
+ let propertyPath = new WI.PropertyPath(object, prefixSavedResultIndex());
+
+ // FIXME: <https://webkit.org/b/196956> Web Inspector: use weak collections for holding event listeners
+ WI.settings.consoleSavedResultAlias.addEventListener(WI.Setting.Event.Changed, (event) => {
+ propertyPath.pathComponent = prefixSavedResultIndex();
+ }, this);
+
+ return propertyPath;
}
_formatWithSubstitutionString(parameters, formattedResult)
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.css (248286 => 248287)
--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.css 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.css 2019-08-06 03:37:44 UTC (rev 248287)
@@ -71,7 +71,7 @@
}
.tree-outline.dom.show-last-selected li.last-selected > span::after {
- content: " = $0";
+ content: " = " var(--console-saved-result-prefix) "0";
color: var(--console-secondary-text-color);
position: absolute;
white-space: pre;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js (248286 => 248287)
--- trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js 2019-08-06 03:37:44 UTC (rev 248287)
@@ -394,6 +394,11 @@
return;
}
+ for (let messageElement of this._allMessageElements()) {
+ if (messageElement.__messageView)
+ messageElement.__messageView.removeEventListeners();
+ }
+
const isFirstSession = false;
const newSessionReason = event.data.wasReloaded ? WI.ConsoleSession.NewSessionReason.PageReloaded : WI.ConsoleSession.NewSessionReason.PageNavigated;
this._logViewController.startNewSession(isFirstSession, {newSessionReason, timestamp: event.data.timestamp});
@@ -825,6 +830,11 @@
for (let item of this._scopeBar.items)
item.element.classList.remove("unread");
+ for (let messageElement of this._allMessageElements()) {
+ if (messageElement.__messageView)
+ messageElement.__messageView.removeEventListeners();
+ }
+
this._logViewController.clear();
this._nestingLevel = 0;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/QuickConsole.js (248286 => 248287)
--- trunk/Source/WebInspectorUI/UserInterface/Views/QuickConsole.js 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/QuickConsole.js 2019-08-06 03:37:44 UTC (rev 248287)
@@ -33,7 +33,7 @@
this._toggleOrFocusKeyboardShortcut.implicitlyPreventsDefault = false;
this._automaticExecutionContextPathComponent = this._createExecutionContextPathComponent(null, WI.UIString("Auto"));
- this._automaticExecutionContextPathComponent.tooltip = WI.UIString("Execution context for $0");
+ this._updateAutomaticExecutionContextPathComponentTooltip();
this._mainExecutionContextPathComponent = null;
this._otherExecutionContextPathComponents = [];
@@ -71,6 +71,8 @@
this.initializeMainExecutionContextPathComponent();
+ WI.settings.consoleSavedResultAlias.addEventListener(WI.Setting.Event.Changed, this._updateAutomaticExecutionContextPathComponentTooltip, this);
+
WI.consoleDrawer.toggleButtonShortcutTooltip(this._toggleOrFocusKeyboardShortcut);
WI.consoleDrawer.addEventListener(WI.ConsoleDrawer.Event.CollapsedStateChanged, this._updateStyles, this);
@@ -98,6 +100,7 @@
closed()
{
+ WI.settings.consoleSavedResultAlias.removeEventListener(null, null, this);
WI.Frame.removeEventListener(null, null, this);
WI.debuggerManager.removeEventListener(null, null, this);
WI.runtimeManager.removeEventListener(null, null, this);
@@ -167,6 +170,11 @@
return changed;
}
+ _updateAutomaticExecutionContextPathComponentTooltip()
+ {
+ this._automaticExecutionContextPathComponent.tooltip = WI.UIString("Execution context for %s").format(WI.RuntimeManager.preferredSavedResultPrefix() + "0");
+ }
+
_handleMouseDown(event)
{
if (event.target !== this.element)
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SettingsGroup.js (248286 => 248287)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SettingsGroup.js 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SettingsGroup.js 2019-08-06 03:37:44 UTC (rev 248287)
@@ -64,4 +64,11 @@
this._editorGroupElement.append(editor.element);
return editor;
}
+
+ addCustomEditor()
+ {
+ let element = this._editorGroupElement.appendChild(document.createElement("div"));
+ element.classList.add("editor");
+ return element;
+ }
};
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.css (248286 => 248287)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.css 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.css 2019-08-06 03:37:44 UTC (rev 248287)
@@ -128,6 +128,15 @@
--settings-editor-child-margin-top: -2px;
}
+.content-view.settings > .settings-view > .container > .editor-group > .editor input[type="text"] {
+ padding-top: 0;
+ padding-bottom: 0;
+ vertical-align: 1px;
+
+ /* Vertically align <input> with the group title text. */
+ --settings-editor-child-margin-top: -2px;
+}
+
@media (prefers-color-scheme: dark) {
.content-view.settings .navigation-bar {
background-color: var(--background-color-content);
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js (248286 => 248287)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js 2019-08-06 03:37:44 UTC (rev 248287)
@@ -260,6 +260,30 @@
{
let consoleSettingsView = new WI.SettingsView("console", WI.UIString("Console"));
+ // COMPATIBILITY (iOS 12.2): Runtime.setSavedResultAlias did not exist.
+ if (InspectorBackend.domains.Runtime.setSavedResultAlias) {
+ let consoleSavedResultAliasEditor = consoleSettingsView.addGroupWithCustomEditor(WI.UIString("Saved Result Alias:"));
+
+ let consoleSavedResultAliasInput = consoleSavedResultAliasEditor.appendChild(document.createElement("input"));
+ consoleSavedResultAliasInput.type = "text";
+ consoleSavedResultAliasInput.value = WI.settings.consoleSavedResultAlias.value;
+ consoleSavedResultAliasInput.placeholder = WI.unlocalizedString("$");
+ consoleSavedResultAliasInput.addEventListener("keydown", (event) => {
+ if (!/[a-zA-Z0-9_$]/.test(event.key) || (consoleSavedResultAliasInput.selectionStart === 0 && /[0-9]/.test(event.key))) {
+ event.preventDefault();
+ InspectorFrontendHost.beep();
+ }
+ });
+ consoleSavedResultAliasInput.addEventListener("input", (event) => {
+ let savedResultAlias = consoleSavedResultAliasInput.value;
+ if (savedResultAlias === "$")
+ savedResultAlias = "";
+ WI.settings.consoleSavedResultAlias.value = savedResultAlias;
+ });
+
+ consoleSettingsView.addSeparator();
+ }
+
consoleSettingsView.addSetting(WI.UIString("Traces:"), WI.settings.consoleAutoExpandTrace, WI.UIString("Auto-expand"));
if (WI.ConsoleManager.supportsLogChannels()) {
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SettingsView.js (248286 => 248287)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SettingsView.js 2019-08-06 02:21:59 UTC (rev 248286)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SettingsView.js 2019-08-06 03:37:44 UTC (rev 248287)
@@ -52,6 +52,12 @@
return settingsGroup.addCustomSetting(editorType, options);
}
+ addGroupWithCustomEditor(title, element)
+ {
+ let settingsGroup = this.addGroup(title);
+ return settingsGroup.addCustomEditor();
+ }
+
addGroup(title)
{
let settingsGroup = new WI.SettingsGroup(title);