Last Comment Bug 764688 - TypeError: can't redefine non-configurable property 'console'
: TypeError: can't redefine non-configurable property 'console'
Status: RESOLVED FIXED
:
Product: Add-on SDK
Classification: Client Software
Component: General (show other bugs)
: unspecified
: All All
: -- normal (vote)
: 1.9
Assigned To: Irakli Gozalishvili [:irakli] [:gozala] [@gozala]
:
Mentors:
Depends on: 770369
Blocks: 750307
  Show dependency treegraph
 
Reported: 2012-06-13 19:20 PDT by Wes Kocher (:KWierso)
Modified: 2012-09-18 08:39 PDT (History)
9 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Pull request 508 (165 bytes, text/html)
2012-07-24 09:31 PDT, Alexandre Poirot [:ochameau]
no flags Details

Description Wes Kocher (:KWierso) 2012-06-13 19:20:41 PDT
Starting with this push: https://hg.mozilla.org/integration/mozilla-inbound/rev/2ddb6278d1de all Jetpack test runs on Inbound became orange with the error "can't redefine non-configurable property 'console'"

Inbound was then merged back to m-c and all JP tests there are orange as well.

For an example test: https://tbpl.mozilla.org/php/getParsedLog.php?id=12615843&tree=Mozilla-Inbound&full=1
Comment 1 Jeff Walden [:Waldo] (remove +bmo to email) 2012-06-13 22:16:44 PDT
Why are you attempting to redefine the "console" property, and could you provide a link to the code in question?

That said, it's possible that window.console shouldn't be non-configurable.  Meh.
Comment 2 Wes Kocher (:KWierso) 2012-06-13 22:44:43 PDT
(In reply to Jeff Walden [:Waldo] (busy, try to prefer other reviewers if possible) from comment #1)
> Why are you attempting to redefine the "console" property, and could you
> provide a link to the code in question?
> 
> That said, it's possible that window.console shouldn't be non-configurable. 
> Meh.

Here's the "where" we override the console property: https://github.com/mozilla/addon-sdk/blob/96c836227648407595e26d8906623064f1d9aece/packages/test-harness/lib/harness.js#L311
which goes into https://github.com/mozilla/addon-sdk/blob/96c836227648407595e26d8906623064f1d9aece/packages/test-harness/lib/loader.js#L12 which attempts to get frozen here: https://github.com/mozilla/addon-sdk/blob/53eaebafc76df3f81c7d6db72c479bfc3cf369f4/packages/api-utils/lib/loader.js#L85

Irakli will have to answer the "why".
Comment 3 Wes Kocher (:KWierso) 2012-06-13 23:15:33 PDT
So, would us trying to set console's prototype to 'undefined' trigger this?
Comment 4 Jeff Walden [:Waldo] (remove +bmo to email) 2012-06-14 09:04:50 PDT
It shouldn't.  Only redefining window.console somehow would do it.  Or setting window.console, if you've made the property non-configurable yourself -- which would happen if you froze the global object, which it seems plausible you might have done.
Comment 5 Irakli Gozalishvili [:irakli] [:gozala] [@gozala] 2012-06-14 10:17:24 PDT
(In reply to Jeff Walden [:Waldo] (busy, try to prefer other reviewers if possible) from comment #4)
> It shouldn't.  Only redefining window.console somehow would do it.  Or
> setting window.console, if you've made the property non-configurable
> yourself -- which would happen if you froze the global object, which it
> seems plausible you might have done.

I don't thin we intent do redefine non-configurable properties and if we do that's a bug in our code I'll try to digg into this to find out why / where this happens.
Comment 6 Irakli Gozalishvili [:irakli] [:gozala] [@gozala] 2012-06-14 10:33:31 PDT
I looked into stack traces of the failures:


  File "resource://anonid0-annotator-at-jetpack/api-utils/lib/timer.js", line 28, in notify

    callback.apply(null, args);

  File "resource://anonid0-annotator-at-jetpack/test-harness/lib/run-tests.js", line 59, in 

    onDone: onDone});

  File "resource://anonid0-annotator-at-jetpack/test-harness/lib/harness.js", line 311, in runTests

    console: new TestRunnerConsole(new ptc.PlainTextConsole(print), options)

  File "resource://anonid0-annotator-at-jetpack/test-harness/lib/loader.js", line 12, in 

    globals = override(override({}, require('api-utils/globals')), globals || {});

  File "resource://anonid0-annotator-at-jetpack/api-utils/lib/loader.js", line 85, in override

    return defineProperties(target, getOwnPropertyDescriptors(properties));

TypeError: can't redefine non-configurable property 'console'


And  it looks like SDK code is not up to date. For example:

 File "resource://anonid0-annotator-at-jetpack/api-utils/lib/loader.js", line 85, in override

    return defineProperties(target, getOwnPropertyDescriptors(properties));

No longer exists, https://github.com/mozilla/addon-sdk/blob/master/packages/api-utils/lib/loader.js#L85 pointed out by KWierso, is not actually not an override function :)
Also `defineProperties(target, ...` is no longer used either.

Can we re-run those tests with up to date SDK ?
Comment 7 Wes Kocher (:KWierso) 2012-06-14 10:38:28 PDT
(In reply to Irakli Gozilalishvili [:irakli] [:gozala] from comment #6)
> I looked into stack traces of the failures:
> 
> 
>   File "resource://anonid0-annotator-at-jetpack/api-utils/lib/timer.js",
> line 28, in notify
> 
>     callback.apply(null, args);
> 
>   File
> "resource://anonid0-annotator-at-jetpack/test-harness/lib/run-tests.js",
> line 59, in 
> 
>     onDone: onDone});
> 
>   File
> "resource://anonid0-annotator-at-jetpack/test-harness/lib/harness.js", line
> 311, in runTests
> 
>     console: new TestRunnerConsole(new ptc.PlainTextConsole(print), options)
> 
>   File "resource://anonid0-annotator-at-jetpack/test-harness/lib/loader.js",
> line 12, in 
> 
>     globals = override(override({}, require('api-utils/globals')), globals
> || {});
> 
>   File "resource://anonid0-annotator-at-jetpack/api-utils/lib/loader.js",
> line 85, in override
> 
>     return defineProperties(target, getOwnPropertyDescriptors(properties));
> 
> TypeError: can't redefine non-configurable property 'console'
> 
> 
> And  it looks like SDK code is not up to date. For example:
> 
>  File "resource://anonid0-annotator-at-jetpack/api-utils/lib/loader.js",
> line 85, in override
> 
>     return defineProperties(target, getOwnPropertyDescriptors(properties));
> 
> No longer exists,
> https://github.com/mozilla/addon-sdk/blob/master/packages/api-utils/lib/
> loader.js#L85 pointed out by KWierso, is not actually not an override
> function :)
> Also `defineProperties(target, ...` is no longer used either.
> 
> Can we re-run those tests with up to date SDK ?

Sure, I'll push an update in a few minutes.
Comment 8 Wes Kocher (:KWierso) 2012-06-14 13:10:11 PDT
Okay, I pushed this to m-c: http://hg.mozilla.org/mozilla-central/rev/9bbc55b71de8

We'll see how it goes: https://tbpl.mozilla.org/?noignore=1&jobname=jetpack&rev=9bbc55b71de8
Comment 9 Wes Kocher (:KWierso) 2012-06-14 14:23:41 PDT
(In reply to Wes Kocher (:KWierso) from comment #8)
> Okay, I pushed this to m-c:
> http://hg.mozilla.org/mozilla-central/rev/9bbc55b71de8
> 
> We'll see how it goes:
> https://tbpl.mozilla.org/?noignore=1&jobname=jetpack&rev=9bbc55b71de8

And the Opt builds seem to be coming up green, so I'd say this is fixed. The remaining debug oranges are bug 763381.
Comment 10 Alexandre Poirot [:ochameau] 2012-07-23 08:46:36 PDT
This issue which has been automagically fixed by some changeset in 1.9 branch means that 1.8.1 isn't able to run tests with nightly (and aurora ?).

$ cfx test 
...
TypeError: can't redefine non-configurable property 'console'
...

I got pinged by various people about this error and thought that something was wrong with their addon... Wouldn't it be worth having a 1.8.2 to fix this (and the panel issue) ?
Comment 11 Alexandre Poirot [:ochameau] 2012-07-24 02:39:22 PDT
I gave it a try and found that cfx test was broken on all versions but FF14, so it is being broken on Beta, Aurora and Nightly.
Comment 12 Jeff Griffiths (:canuckistani) (:⚡︎) 2012-07-24 04:55:34 PDT
This is bad - I'm thinking we should do a 1.8.2 to fix this.
Comment 13 Alexandre Poirot [:ochameau] 2012-07-24 09:31:56 PDT
Created attachment 645345 [details]
Pull request 508

This bug was marked as resolved fixed as it has been fixed by new loader changeset landed in 1.9 branch.
But it will need some fix for release/1.8 branch. 
Here is one.

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