Changeset 248434 in webkit


Ignore:
Timestamp:
Aug 8, 2019 11:59:04 AM (5 years ago)
Author:
Devin Rousso
Message:

Web Inspector: rename queryObjects to queryInstances for clarity
https://bugs.webkit.org/show_bug.cgi?id=200520

Reviewed by Brian Burg.

Source/JavaScriptCore:

  • inspector/InjectedScriptSource.js:

(queryInstances): Added.
(queryObjects):

  • inspector/JSInjectedScriptHost.h:
  • inspector/JSInjectedScriptHost.cpp:

(Inspector::JSInjectedScriptHost::queryInstances): Added.
(Inspector::JSInjectedScriptHost::queryObjects): Deleted.

  • inspector/JSInjectedScriptHostPrototype.cpp:

(Inspector::JSInjectedScriptHostPrototype::finishCreation):
(Inspector::jsInjectedScriptHostPrototypeFunctionQueryInstances): Added.
(Inspector::jsInjectedScriptHostPrototypeFunctionQueryObjects): Deleted.

Source/WebCore:

Test: inspector/console/queryInstances.html

  • inspector/CommandLineAPIModuleSource.js:

(CommandLineAPIImpl.prototype.queryInstances): Added.
(CommandLineAPIImpl.prototype.queryObjects):

Source/WebInspectorUI:

  • UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js:

LayoutTests:

  • inspector/console/queryInstances.html: Renamed from LayoutTests/inspector/console/queryObjects.html.
  • inspector/console/queryInstances-expected.txt: Renamed from LayoutTests/inspector/console/queryObjects-expected.txt.
  • http/tests/inspector/console/cross-domain-inspected-node-access-expected.txt:
Location:
trunk
Files:
1 added
1 deleted
11 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r248433 r248434  
     12019-08-08  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: rename `queryObjects` to `queryInstances` for clarity
     4        https://bugs.webkit.org/show_bug.cgi?id=200520
     5
     6        Reviewed by Brian Burg.
     7
     8        * inspector/console/queryInstances.html: Renamed from LayoutTests/inspector/console/queryObjects.html.
     9        * inspector/console/queryInstances-expected.txt: Renamed from LayoutTests/inspector/console/queryObjects-expected.txt.
     10
     11        * http/tests/inspector/console/cross-domain-inspected-node-access-expected.txt:
     12
    1132019-08-08  Wenson Hsieh  <wenson_hsieh@apple.com>
    214
  • trunk/LayoutTests/http/tests/inspector/dom/cross-domain-inspected-node-access-expected.txt

    r248287 r248434  
    1 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.
    2 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.
     1CONSOLE MESSAGE: line 50: 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.
     2CONSOLE MESSAGE: line 50: 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.
    33Test that code evaluated in the main frame cannot access $0 that resolves to a node in a frame from a different domain. Bug 105423.
    44
  • trunk/LayoutTests/inspector/console/queryInstances.html

    r248433 r248434  
    1 <!doctype html>
     1<!DOCTYPE html>
    22<html>
    33<head>
     
    6161
    6262function test() {
    63     function queryObjects(prototypeOrConstructor, callback) {
    64         WI.runtimeManager.evaluateInInspectedWindow(`queryObjects(${prototypeOrConstructor})`, {objectGroup: "test", includeCommandLineAPI: true, generatePreview: true}, callback);
    65     }
    66 
    67     let suite = InspectorTest.createAsyncSuite("CommandLineAPI.queryObjects");
     63    function queryInstances(prototypeOrConstructor, callback) {
     64        WI.runtimeManager.evaluateInInspectedWindow(`queryInstances(${prototypeOrConstructor})`, {objectGroup: "test", includeCommandLineAPI: true, generatePreview: true}, callback);
     65    }
     66
     67    let suite = InspectorTest.createAsyncSuite("CommandLineAPI.queryInstances");
    6868
    6969    let cases = [
     
    124124    for (let {prototypeOrConstructor, resultCount, shouldThrow} of cases) {
    125125        suite.addTestCase({
    126             name: `CommandLineAPI.queryObjects.${prototypeOrConstructor}`,
     126            name: `CommandLineAPI.queryInstances.${prototypeOrConstructor}`,
    127127            test(resolve, reject) {
    128                 queryObjects(prototypeOrConstructor, (remoteObject, wasThrown, savedResultIndex) => {
     128                queryInstances(prototypeOrConstructor, (remoteObject, wasThrown, savedResultIndex) => {
    129129                    if (shouldThrow) {
    130                         InspectorTest.expectThat(wasThrown, `Calling "queryObjects" with "${prototypeOrConstructor}" should throw an exception.`);
     130                        InspectorTest.expectThat(wasThrown, `Calling "queryInstances" with "${prototypeOrConstructor}" should throw an exception.`);
    131131                        InspectorTest.log(remoteObject.description);
    132132                        if (wasThrown) {
     
    162162
    163163    suite.addTestCase({
    164         name: "CommandLineAPI.queryObjects.GC",
     164        name: "CommandLineAPI.queryInstances.GC",
    165165        test(resolve, reject) {
    166             queryObjects(`ClassC`, (remoteObject, wasThrown, savedResultIndex) => {
     166            queryInstances(`ClassC`, (remoteObject, wasThrown, savedResultIndex) => {
    167167                InspectorTest.assert(!wasThrown);
    168168                if (wasThrown)
     
    176176                InspectorTest.evaluateInPage(`clearInstances()`);
    177177
    178                 queryObjects(`ClassC`, (remoteObject, wasThrown, savedResultIndex) => {
     178                queryInstances(`ClassC`, (remoteObject, wasThrown, savedResultIndex) => {
    179179                    InspectorTest.assert(!wasThrown);
    180180                    if (wasThrown)
     
    189189
    190190    suite.addTestCase({
    191         name: "CommandLineAPI.queryObjects.NoParameter",
     191        name: "CommandLineAPI.queryInstances.NoParameter",
    192192        test(resolve, reject) {
    193193            const prototypeOrConstructor = "";
    194             queryObjects(prototypeOrConstructor, (remoteObject, wasThrown, savedResultIndex) => {
     194            queryInstances(prototypeOrConstructor, (remoteObject, wasThrown, savedResultIndex) => {
    195195                if (wasThrown) {
    196196                    InspectorTest.fail("An exception was thrown.");
     
    211211</head>
    212212<body onload="runTest()">
    213     <p>Tests for the `queryObjects` function in the Command Line API.</p>
     213<p>Tests for the `queryInstances` function in the Command Line API.</p>
    214214</body>
    215215</html>
  • trunk/Source/JavaScriptCore/ChangeLog

    r248426 r248434  
     12019-08-08  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: rename `queryObjects` to `queryInstances` for clarity
     4        https://bugs.webkit.org/show_bug.cgi?id=200520
     5
     6        Reviewed by Brian Burg.
     7
     8        * inspector/InjectedScriptSource.js:
     9        (queryInstances): Added.
     10        (queryObjects):
     11        * inspector/JSInjectedScriptHost.h:
     12        * inspector/JSInjectedScriptHost.cpp:
     13        (Inspector::JSInjectedScriptHost::queryInstances): Added.
     14        (Inspector::JSInjectedScriptHost::queryObjects): Deleted.
     15        * inspector/JSInjectedScriptHostPrototype.cpp:
     16        (Inspector::JSInjectedScriptHostPrototype::finishCreation):
     17        (Inspector::jsInjectedScriptHostPrototypeFunctionQueryInstances): Added.
     18        (Inspector::jsInjectedScriptHostPrototypeFunctionQueryObjects): Deleted.
     19
    1202019-08-08  Ross Kirsling  <ross.kirsling@sony.com>
    221
  • trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js

    r248287 r248434  
    15031503    },
    15041504
     1505    function queryInstances() {
     1506        return InjectedScriptHost.queryInstances(...arguments);
     1507    },
     1508
    15051509    function queryObjects() {
    1506         return InjectedScriptHost.queryObjects(...arguments);
     1510        return InjectedScriptHost.queryInstances(...arguments);
    15071511    },
    15081512];
  • trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp

    r248287 r248434  
    662662}
    663663
    664 JSValue JSInjectedScriptHost::queryObjects(ExecState* exec)
     664JSValue JSInjectedScriptHost::queryInstances(ExecState* exec)
    665665{
    666666    if (exec->argumentCount() < 1)
     
    672672    JSValue prototypeOrConstructor = exec->uncheckedArgument(0);
    673673    if (!prototypeOrConstructor.isObject())
    674         return throwTypeError(exec, scope, "queryObjects first argument must be an object."_s);
     674        return throwTypeError(exec, scope, "queryInstances first argument must be an object."_s);
    675675
    676676    JSObject* object = asObject(prototypeOrConstructor);
    677677    if (object->inherits<ProxyObject>(vm))
    678         return throwTypeError(exec, scope, "queryObjects cannot be called with a Proxy."_s);
     678        return throwTypeError(exec, scope, "queryInstances cannot be called with a Proxy."_s);
    679679
    680680    JSValue prototype = object;
     
    693693
    694694    if (object->inherits<ProxyObject>(vm) || prototype.inherits<ProxyObject>(vm))
    695         return throwTypeError(exec, scope, "queryObjects cannot be called with a Proxy."_s);
     695        return throwTypeError(exec, scope, "queryInstances cannot be called with a Proxy."_s);
    696696
    697697    // FIXME: implement a way of distinguishing between internal and user-created objects.
    698698    JSGlobalObject* lexicalGlobalObject = exec->lexicalGlobalObject();
    699699    if (checkForbiddenPrototype(exec, object, lexicalGlobalObject->objectPrototype()))
    700         return throwTypeError(exec, scope, "queryObjects cannot be called with Object."_s);
     700        return throwTypeError(exec, scope, "queryInstances cannot be called with Object."_s);
    701701    if (checkForbiddenPrototype(exec, object, lexicalGlobalObject->functionPrototype()))
    702         return throwTypeError(exec, scope, "queryObjects cannot be called with Function."_s);
     702        return throwTypeError(exec, scope, "queryInstances cannot be called with Function."_s);
    703703    if (checkForbiddenPrototype(exec, object, lexicalGlobalObject->arrayPrototype()))
    704         return throwTypeError(exec, scope, "queryObjects cannot be called with Array."_s);
     704        return throwTypeError(exec, scope, "queryInstances cannot be called with Array."_s);
    705705    if (checkForbiddenPrototype(exec, object, lexicalGlobalObject->mapPrototype()))
    706         return throwTypeError(exec, scope, "queryObjects cannot be called with Map."_s);
     706        return throwTypeError(exec, scope, "queryInstances cannot be called with Map."_s);
    707707    if (checkForbiddenPrototype(exec, object, lexicalGlobalObject->jsSetPrototype()))
    708         return throwTypeError(exec, scope, "queryObjects cannot be called with Set."_s);
     708        return throwTypeError(exec, scope, "queryInstances cannot be called with Set."_s);
    709709    if (checkForbiddenPrototype(exec, object, lexicalGlobalObject->promisePrototype()))
    710         return throwTypeError(exec, scope, "queryObjects cannot be called with Promise."_s);
     710        return throwTypeError(exec, scope, "queryInstances cannot be called with Promise."_s);
    711711
    712712    sanitizeStackForVM(&vm);
  • trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHost.h

    r248287 r248434  
    7474    JSC::JSValue weakSetEntries(JSC::ExecState*);
    7575    JSC::JSValue iteratorEntries(JSC::ExecState*);
    76     JSC::JSValue queryObjects(JSC::ExecState*);
     76    JSC::JSValue queryInstances(JSC::ExecState*);
    7777
    7878protected:
  • trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHostPrototype.cpp

    r248287 r248434  
    5151static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionWeakSetEntries(ExecState*);
    5252static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionIteratorEntries(ExecState*);
    53 static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionQueryObjects(ExecState*);
     53static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionQueryInstances(ExecState*);
    5454static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionEvaluateWithScopeExtension(ExecState*);
    5555
     
    7676    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("weakSetEntries", jsInjectedScriptHostPrototypeFunctionWeakSetEntries, static_cast<unsigned>(PropertyAttribute::DontEnum), 1);
    7777    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("iteratorEntries", jsInjectedScriptHostPrototypeFunctionIteratorEntries, static_cast<unsigned>(PropertyAttribute::DontEnum), 1);
    78     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("queryObjects", jsInjectedScriptHostPrototypeFunctionQueryObjects, static_cast<unsigned>(PropertyAttribute::DontEnum), 1);
     78    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("queryInstances", jsInjectedScriptHostPrototypeFunctionQueryInstances, static_cast<unsigned>(PropertyAttribute::DontEnum), 1);
    7979    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("evaluateWithScopeExtension", jsInjectedScriptHostPrototypeFunctionEvaluateWithScopeExtension, static_cast<unsigned>(PropertyAttribute::DontEnum), 1);
    8080
     
    226226}
    227227
    228 EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionQueryObjects(ExecState* exec)
    229 {
    230     VM& vm = exec->vm();
    231     auto scope = DECLARE_THROW_SCOPE(vm);
    232 
    233     JSValue thisValue = exec->thisValue();
    234     JSInjectedScriptHost* castedThis = jsDynamicCast<JSInjectedScriptHost*>(vm, thisValue);
    235     if (!castedThis)
    236         return throwVMTypeError(exec, scope);
    237 
    238     return JSValue::encode(castedThis->queryObjects(exec));
     228EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionQueryInstances(ExecState* exec)
     229{
     230    VM& vm = exec->vm();
     231    auto scope = DECLARE_THROW_SCOPE(vm);
     232
     233    JSValue thisValue = exec->thisValue();
     234    JSInjectedScriptHost* castedThis = jsDynamicCast<JSInjectedScriptHost*>(vm, thisValue);
     235    if (!castedThis)
     236        return throwVMTypeError(exec, scope);
     237
     238    return JSValue::encode(castedThis->queryInstances(exec));
    239239}
    240240
  • trunk/Source/WebCore/ChangeLog

    r248432 r248434  
     12019-08-08  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: rename `queryObjects` to `queryInstances` for clarity
     4        https://bugs.webkit.org/show_bug.cgi?id=200520
     5
     6        Reviewed by Brian Burg.
     7
     8        Test: inspector/console/queryInstances.html
     9
     10        * inspector/CommandLineAPIModuleSource.js:
     11        (CommandLineAPIImpl.prototype.queryInstances): Added.
     12        (CommandLineAPIImpl.prototype.queryObjects):
     13
    1142019-08-08  Chris Dumez  <cdumez@apple.com>
    215
  • trunk/Source/WebCore/inspector/CommandLineAPIModuleSource.js

    r248287 r248434  
    102102    "profile",
    103103    "profileEnd",
     104    "queryInstances",
    104105    "queryObjects",
    105106    "screenshot",
     
    263264    },
    264265
     266    queryInstances()
     267    {
     268        return InjectedScriptHost.queryInstances(...arguments);
     269    },
     270
    265271    queryObjects()
    266272    {
    267         return InjectedScriptHost.queryObjects(...arguments);
     273        return InjectedScriptHost.queryInstances(...arguments);
    268274    },
    269275
  • trunk/Source/WebInspectorUI/ChangeLog

    r248400 r248434  
     12019-08-08  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: rename `queryObjects` to `queryInstances` for clarity
     4        https://bugs.webkit.org/show_bug.cgi?id=200520
     5
     6        Reviewed by Brian Burg.
     7
     8        * UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js:
     9
    1102019-08-07  Devin Rousso  <drousso@apple.com>
    211
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js

    r248287 r248434  
    331331    "profile",
    332332    "profileEnd",
     333    "queryInstances",
    333334    "queryObjects",
    334335    "screenshot",
Note: See TracChangeset for help on using the changeset viewer.