Bug 1549785 - Fix Remote object support for Node/Elements objects. r=remote-protocol-reviewers,ato
authorAlexandre Poirot <poirot.alex@gmail.com>
Tue, 14 May 2019 20:05:32 +0000
changeset 532724 b143758e66ec86fac847d65cb4243d8f92f6b3e2
parent 532723 b1406a7e07ff3e12aa20a3b644ff4a86b8045dd5
child 532725 6138ca044e5c74d47923dac3accd8cafba1cc1a0
push id11272
push userapavel@mozilla.com
push dateThu, 16 May 2019 15:28:22 +0000
treeherdermozilla-beta@2265bfc5920d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersremote-protocol-reviewers, ato
bugs1549785
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1549785 - Fix Remote object support for Node/Elements objects. r=remote-protocol-reviewers,ato Debugger.Object's class isn't "Object" for DOM Elements. Instead, it is specific to each element tag name. Differential Revision: https://phabricator.services.mozilla.com/D31084
remote/domains/content/runtime/ExecutionContext.jsm
remote/test/browser/browser_runtime_evaluate.js
--- a/remote/domains/content/runtime/ExecutionContext.jsm
+++ b/remote/domains/content/runtime/ExecutionContext.jsm
@@ -261,17 +261,17 @@ class ExecutionContext {
       } else if (cls == "WeakSet") {
         subtype = "weakset";
       } else if (cls == "Error") {
         subtype = "error";
       } else if (cls == "Promise") {
         subtype = "promise";
       } else if (TYPED_ARRAY_CLASSES.includes(cls)) {
         subtype = "typedarray";
-      } else if (cls == "Object" && Node.isInstance(rawObj)) {
+      } else if (Node.isInstance(rawObj)) {
         subtype = "node";
       }
 
       const type = typeof rawObj;
       return {objectId, type, subtype};
     }
 
     // Now, handle all values that Debugger API isn't wrapping into Debugger.API.
--- a/remote/test/browser/browser_runtime_evaluate.js
+++ b/remote/test/browser/browser_runtime_evaluate.js
@@ -183,16 +183,19 @@ async function testObjectTypes(testFunct
     { expression: "new WeakMap()", type: "object", subtype: "weakmap" },
     { expression: "new WeakSet()", type: "object", subtype: "weakset" },
     { expression: "new Map()", type: "object", subtype: "map" },
     { expression: "new Set()", type: "object", subtype: "set" },
     { expression: "/foo/", type: "object", subtype: "regexp" },
     { expression: "[1, 2]", type: "object", subtype: "array" },
     { expression: "new Proxy({}, {})", type: "object", subtype: "proxy" },
     { expression: "new Date()", type: "object", subtype: "date" },
+    { expression: "document", type: "object", subtype: "node" },
+    { expression: "document.documentElement", type: "object", subtype: "node" },
+    { expression: "document.createElement('div')", type: "object", subtype: "node" },
   ];
 
   for (const { expression, type, subtype } of expressions) {
     const { result } = await testFunction(expression);
     is(result.subtype, subtype, `Evaluating '${expression}' has the expected subtype`);
     is(result.type, type, "The type is correct");
     ok(!!result.objectId, "Got an object id");
   }