Note: There are a few cases of duplicates in user autocompletion which are being worked on.

Debug scope proxies don't let eval-in-frame code define new properties

RESOLVED FIXED in mozilla15



JavaScript Engine
5 years ago
5 years ago


(Reporter: Honza, Assigned: luke)


Windows Vista

Firefox Tracking Flags

(Not tracked)



(1 attachment)

Firebug's test doesn't work since the "TypeError: can't redefine non-configurable property" error appears when evaluating the following script in a frame:

if (!window._firebug)window._firebug={};
window._firebug.rerunThis = this;
window._firebug.rerunArgs = [];
if (arguments && arguments.length) for (var i = 0; i < arguments.length; i++) window._firebug.rerunArgs.push(arguments[i]);
window._firebug.rerunFunctionName = onclick;
window._firebug.rerunFunction = function _firebugRerun() { onclick.apply(window._firebug.rerunThis, window._firebug.rerunArgs); }

See the source here:

1) Install Firebug:
2) Load:
3) Follow the steps on the page -> after clicking re-run, the debugger doesn't halt again -> BUG

You can also see the error by installing FBTrace:

Open FBTrace by "Firebug (icon) menu -> Open Firebug Tracing". In the console check UI_LOOP option (within the Options tab) and watch the console when pressing the rerun button during the test case.

The log comes from this source location:

The log:
debugger.rerun false and result: [object Object] for http://legoas/src/

- Expand the log
- Select the Object tab
- Result -> Value -> stringValue == "TypeError: can't redefine non-configurable property 'i'"

It works in Firefox 13

Is there something wrong with the evaluated script?


Comment 1

5 years ago
That error pops out when eval-in-frame code tries to redefine a binding in the enclosing scope.  Right now, the error is overly conservative (it throws on *any* call to defineProperty on the scope object) since it wasn't even clear how this path would be exercised (normal reads/writes go through get/set).  I'll look at what your test-case is doing and probably we can relax the restriction to allow defineProperty when, e.g., only the value changes.


5 years ago
Summary: TypeError: can't redefine non-configurable property → Debug scope proxies don't let eval-in-frame code define new properties

Comment 2

5 years ago
Created attachment 628845 [details] [diff] [review]
fix and tests

Simple enough fix; thanks for the great STR!  With this patch, do you see any other problems Jan?

The eif-call-newvar change is just reverting the change made in bug 690135.
Assignee: general → luke
Attachment #628845 - Flags: review?(jimb)

Comment 3

5 years ago
Comment on attachment 628845 [details] [diff] [review]
fix and tests

Review of attachment 628845 [details] [diff] [review]:

Looks good to me. Would it be worthwhile to test that a *re*declaration of a variable also works?
Attachment #628845 - Flags: review?(jimb) → review+

Comment 4

5 years ago
(In reply to Jim Blandy :jimb from comment #3)
Heh, well, that actually doesn't work with the patch (that's what the if(has) Throw is guarding against).  To make it work, we'd need to do a lot more thinking to make sure the PropertyDescriptors match and then the soon-to-be-landed patches in bug 659577 would need to do the right thing for unaliased variables.  All in all, I'd rather not do it if it isn't necessary.

Comment 5

5 years ago
As jimb pointed out on irc, re-defining a var does not call defineProperty, but just sets the existing var, so it should work just fine.  Pushed with the suggested redefinition test:
Target Milestone: --- → mozilla15

Comment 6

5 years ago
Last Resolved: 5 years ago
Resolution: --- → FIXED
(In reply to Luke Wagner [:luke] from comment #2)
> Simple enough fix; thanks for the great STR!  With this patch, do you see
> any other problems Jan?
It looks like this will be in Nightly soon so, I'll let you know.

Thanks for the quick fix!

Retested with today's Nightly and STR from comment #0 works for me

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