Changeset 196270 in webkit


Ignore:
Timestamp:
Feb 8, 2016 1:50:27 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: copy({x:1}) should copy "{x:1}", not "[object Object]"
https://bugs.webkit.org/show_bug.cgi?id=148605

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2016-02-08
Reviewed by Brian Burg.

Source/WebCore:

Test: inspector/console/command-line-api-copy.html

  • inspector/CommandLineAPIModuleSource.js:

(CommandLineAPIImpl.prototype.copy):
Support copying different types. This is meant to be more
convenient then just JSON.stringify, so it handles types
like Node, Symbol, RegExp, and Function a bit better.

LayoutTests:

  • inspector/console/command-line-api-copy-expected.txt: Added.
  • inspector/console/command-line-api-copy.html: Added.
  • http/tests/inspector/console/cross-domain-inspected-node-access-expected.txt:
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r196269 r196270  
     12016-02-08  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: copy({x:1}) should copy "{x:1}", not "[object Object]"
     4        https://bugs.webkit.org/show_bug.cgi?id=148605
     5
     6        Reviewed by Brian Burg.
     7
     8        * inspector/console/command-line-api-copy-expected.txt: Added.
     9        * inspector/console/command-line-api-copy.html: Added.
     10        * http/tests/inspector/console/cross-domain-inspected-node-access-expected.txt:
     11
    1122016-02-08  Ryan Haddad  <ryanhaddad@apple.com>
    213
  • trunk/LayoutTests/http/tests/inspector/console/cross-domain-inspected-node-access-expected.txt

    r192186 r196270  
    1 CONSOLE MESSAGE: line 52: 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 52: 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 57: 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 57: 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/Source/WebCore/ChangeLog

    r196268 r196270  
     12016-02-08  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: copy({x:1}) should copy "{x:1}", not "[object Object]"
     4        https://bugs.webkit.org/show_bug.cgi?id=148605
     5
     6        Reviewed by Brian Burg.
     7
     8        Test: inspector/console/command-line-api-copy.html
     9
     10        * inspector/CommandLineAPIModuleSource.js:
     11        (CommandLineAPIImpl.prototype.copy):
     12        Support copying different types. This is meant to be more
     13        convenient then just JSON.stringify, so it handles types
     14        like Node, Symbol, RegExp, and Function a bit better.
     15
    1162016-02-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
    217
  • trunk/Source/WebCore/inspector/CommandLineAPIModuleSource.js

    r186891 r196270  
    292292    copy: function(object)
    293293    {
    294         if (injectedScript._subtype(object) === "node")
    295             object = object.outerHTML;
    296         CommandLineAPIHost.copyText(object);
     294        var string;
     295        var subtype = injectedScript._subtype(object);
     296        if (subtype === "node")
     297            string = object.outerHTML;
     298        else if (subtype === "regexp")
     299            string = "" + object;
     300        else if (injectedScript.isPrimitiveValue(object))
     301            string = "" + object;
     302        else if (typeof object === "symbol")
     303            string = String(object);
     304        else if (typeof object === "function")
     305            string = "" + object;
     306        else {
     307            try {
     308                string = JSON.stringify(object, null, "  ");
     309            } catch (e) {
     310                string = "" + object;
     311            }
     312        }
     313
     314        CommandLineAPIHost.copyText(string);
    297315    },
    298316
Note: See TracChangeset for help on using the changeset viewer.