Closed Bug 632347 Opened 13 years ago Closed 13 years ago

Expanding a property in the Object Inspector whose type is Generator causes lockup

Categories

(DevTools :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: rcampbell, Assigned: msucan)

References

()

Details

(Keywords: hang, Whiteboard: [console-1])

Attachments

(2 files, 3 obsolete files)

In the web console, open an Object inspector that contains a Generator. Click the arrow to expand it, browser locks up, beachballs, etc.
see test case at the above URL
Keywords: hang
Attached patch proposed patch (obsolete) — Splinter Review
Proposed patch, with fixes for the autocomplete, eval result inspection and for the object inspector panel code. Included a mochitest which checks that the three parts of the Web Console do not fail with iterators and generators. I used the MDN docs to write down the main types of supported iters and gens.

Feedback for improvements is welcome! Thanks!
Assignee: nobody → mihai.sucan
Status: NEW → ASSIGNED
Attachment #510760 - Flags: feedback?(rcampbell)
Whiteboard: [patchclean:0208]
Version: unspecified → Trunk
Comment on attachment 510760 [details] [diff] [review]
proposed patch

+      let str = aResult + "";

toString() ?

f+=me!
Attachment #510760 - Flags: feedback?(rcampbell) → feedback+
Attached patch updated patch (obsolete) — Splinter Review
Updated the patch. Thanks for the feedback+ Rob!

Asking for review from Shawn.
Attachment #510760 - Attachment is obsolete: true
Attachment #511336 - Flags: review?(sdwilsh)
Whiteboard: [patchclean:0208] → [patchclean:0210]
Comment on attachment 511336 [details] [diff] [review]
updated patch

>+++ b/toolkit/components/console/hudservice/HUDService.jsm
>+  // Skip Iterators and Generators.
>+  if (typeof obj == "object") {
>+    if (typeof obj.__iterator__ == "function" ||
>+        obj.constructor && obj.constructor.name == "Iterator") {
>+      return null;
>+    }
>+
>+    let str = obj.toString();
>+    if (typeof obj.next == "function" &&
>+        str.indexOf("[object Generator") == 0) {
>+      return null;
>+    }
>+  }
You do this code twice, which means you should pull it into a helper method (like isIteratorOrGenerator(aObject) perhaps)

>+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_632347_iterators_generators.js
>@@ -0,0 +1,99 @@
>+/*
>+ * Any copyright is dedicated to the Public Domain.
>+ * http://creativecommons.org/publicdomain/zero/1.0/
>+ *
>+ * Contributor(s):
>+ *   Mihai Èucan <mihai.sucan@gmail.com>
>+ */
nit: just https://www.mozilla.org/MPL/boilerplate-1.1/pd-c

r=sdwilsh
Attachment #511336 - Flags: review?(sdwilsh) → review+
Attached patch patch update 2 (obsolete) — Splinter Review
Thanks for the review+ Shawn! Updated the patch as requested.
Attachment #511336 - Attachment is obsolete: true
Whiteboard: [patchclean:0210] → [patchclean:0309][checkin][future-release]
Whiteboard: [patchclean:0309][checkin][future-release] → [patchclean:0309][checkin][future-release][console-1]
Ready to land (mozilla-central, default branch, on top of bugs 619598 and 618311).
Attachment #518135 - Attachment is obsolete: true
Whiteboard: [patchclean:0309][checkin][future-release][console-1] → [patchclean:0323][checkin][console-1]
Comment on attachment 521241 [details] [diff] [review]
[in-devtools] rebased patch

checked into devtools

http://hg.mozilla.org/projects/devtools/rev/b224e897c616
Attachment #521241 - Attachment description: rebased patch → [in-devtools] rebased patch
Whiteboard: [patchclean:0323][checkin][console-1] → [patchclean:0323][merge-moz-central][console-1]
http://tinderbox.mozilla.org/showlog.cgi?log=Devtools/1301077938.1301081696.7097.gz&fulltext=1

TEST-PASS | chrome://mochitests/content/browser/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_632347_iterators_generators.js | iter2 is correctly displayed in the Property Panel
TEST-UNEXPECTED-FAIL | chrome://mochitests/content/browser/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_632347_iterators_generators.js | window.parent is correctly displayed in the Property Panel
JavaScript strict warning: resource://gre/modules/NetworkPrioritizer.jsm, line 117: reference to undefined property aBrowser.webNavigation
INFO TEST-END | chrome://mochitests/content/browser/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_632347_iterators_generators.js | finished in 845ms
TEST-INFO | checking window state
This fixes the test in debug builds. Works for me.

It applies cleanly in the devtools repo, default branch.
Whiteboard: [patchclean:0323][merge-moz-central][console-1] → [console-1][merge-m-c]
http://hg.mozilla.org/mozilla-central/rev/b224e897c616
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Whiteboard: [console-1][merge-m-c] → [console-1]
Verified on:
Build identifier: Mozilla/5.0 (Windows NT 5.1; rv:2.2a1pre) Gecko/20110403 Firefox/4.2a1pre
Status: RESOLVED → VERIFIED
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: