The default bug view has changed. See this FAQ.

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

RESOLVED FIXED in 1.9

Status

Add-on SDK
General
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: KWierso, Assigned: irakli)

Tracking

unspecified
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
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
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.
(Reporter)

Comment 2

5 years ago
(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".
(Reporter)

Comment 3

5 years ago
So, would us trying to set console's prototype to 'undefined' trigger this?
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.
(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.
Assignee: nobody → rFobic
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 ?
(Reporter)

Comment 7

5 years ago
(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.
(Reporter)

Updated

5 years ago
Priority: -- → P1
(Reporter)

Comment 8

5 years ago
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
(Reporter)

Comment 9

5 years ago
(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.
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Priority: P1 → --
Resolution: --- → FIXED
(Reporter)

Updated

5 years ago
Depends on: 770369
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) ?
OS: Windows 8 → All
Hardware: x86_64 → All
Target Milestone: --- → 1.9
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.
This is bad - I'm thinking we should do a 1.8.2 to fix this.
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.
Attachment #645345 - Flags: review?(rFobic)
Attachment #645345 - Flags: review?(rFobic)
You need to log in before you can comment on or make changes to this bug.