Last Comment Bug 380422 - The evaluating iframe may contain nuts (and other remainders)
: The evaluating iframe may contain nuts (and other remainders)
Status: RESOLVED FIXED
:
Product: Toolkit Graveyard
Classification: Graveyard
Component: Error Console (show other bugs)
: Trunk
: All All
-- minor (vote)
: mozilla1.9alpha5
Assigned To: Simon Bünzli
:
:
Mentors:
Depends on: 385092
Blocks:
  Show dependency treegraph
 
Reported: 2007-05-11 10:50 PDT by Simon Bünzli
Modified: 2016-06-29 11:02 PDT (History)
4 users (show)
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
fix (1.98 KB, patch)
2007-05-11 11:52 PDT, Simon Bünzli
gavin.sharp: review+
neil: superreview+
Details | Diff | Splinter Review
using contentWindow (2.26 KB, patch)
2007-05-11 12:36 PDT, Simon Bünzli
no flags Details | Diff | Splinter Review

Description User image Simon Bünzli 2007-05-11 10:50:35 PDT
(From bug 238898 comment #24)
> Hrm, this doesn't behave properly with javascript: URLs that don't cause a new
> load, e.g. evaluating ("const a=1;", "a;", "a;") will result in ("", 1, error)
> when it should result in ("", error, error), but I guess that happens currently
> too because displayResult() is only called onload. This was mentioned in bug
> 158475 comment 4, so I guess it's known. Might be worth filing a bug on it
> anyways.

Inserting the following line just before setting the location to the new javascript: URL fixes this issue:

+  iframe.contentDocument.location = "about:blank"; // reset the iframe

I'll add a patch once bug 238898 has been fixed.
Comment 1 User image Simon Bünzli 2007-05-11 11:52:31 PDT
Created attachment 264505 [details] [diff] [review]
fix
Comment 2 User image neil@parkwaycc.co.uk 2007-05-11 12:24:07 PDT
Comment on attachment 264505 [details] [diff] [review]
fix

I'm sure what I said on IRC was to use contentWindow, not contentDocument (nsDocument simply calls GetLocation on its nsIDOMWindowInternal). But as you're repeating yourself I now prefer var Evaluator = document.getElementById("Evaluator").contentWindow; etc. sr=me with that fixed.
Comment 3 User image Simon Bünzli 2007-05-11 12:36:39 PDT
Created attachment 264518 [details] [diff] [review]
using contentWindow

... but keeping |evaluator| lower-cased as all other variables are.
Comment 4 User image Simon Bünzli 2007-05-11 12:38:28 PDT
This bitrots my patch to bug 369097. I'll update it after this one's been checked in.
Comment 5 User image :Gavin Sharp [email: gavin@gavinsharp.com] 2007-05-11 12:54:19 PDT
(In reply to comment #2)
> (From update of attachment 264505 [details] [diff] [review])
> I'm sure what I said on IRC was to use contentWindow, not contentDocument
> (nsDocument simply calls GetLocation on its nsIDOMWindowInternal).

Oops, that's right. Sorry about that.
Comment 6 User image Nickolay_Ponomarev 2007-05-13 04:37:16 PDT
mozilla/toolkit/components/console/content/console.js         1.8
mozilla/xpfe/components/console/resources/content/console.js  1.27
Comment 7 User image Wladimir Palant 2007-07-01 08:57:22 PDT
This caused bug 386501.

Note You need to log in before you can comment on or make changes to this bug.