Open Bug 1182943 Opened 9 years ago Updated 2 years ago

Variables declared in the web console are configurable which confuses people

Categories

(DevTools :: Console, defect, P3)

39 Branch
defect

Tracking

(Not tracked)

People

(Reporter: rodrigo5244, Unassigned)

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Build ID: 20150630154324

Steps to reproduce:

I declared a variable and looked at its configurable attribute.

var a;
Object.getOwnPropertyDescriptor(this, "a").configurable;


Actual results:

Firefox indicates that the variable declared is configurable.


Expected results:

The variable should not be configurable.
Attached file Testcase
How are you testing? This testcase logs "configurable: false" for me, ie it works as expected and does the opposite of what you suggest.

I suspect that "this" is not what you declare 'a' on in your testing.
Flags: needinfo?(rodrigo5244)
Attachment #8634070 - Attachment mime type: text/plain → text/html
Flags: needinfo?(rodrigo5244)
Patrick, I don't know if this is even fixable without breaking other important things, because it seems to just be an issue with the devtools evaluation context.
Component: Untriaged → Developer Tools: Console
Flags: needinfo?(pbrosset)
Summary: Declared variables are configurable. → Variables declared in the devtools commandline aren't on |this| in the devtools commandline which confuses people
Sorry, I'm out for a bit (was on sick leave, and am now on PTO). Transferring to Ryan.
Flags: needinfo?(pbrosset) → needinfo?(jryans)
Flags: needinfo?(jryans)
Summary: Variables declared in the devtools commandline aren't on |this| in the devtools commandline which confuses people → Variables declared in the web console aren't on |this| in the console which confuses people
I am not sure I follow what the problem is here.

The web console operates in the scope of the window of the page.

So, "this" in the console is the "window" object for that page.

In the bug title, it says "variables ... aren't on this", but in comment 0, it seems like they **are** currently, but you expect them not to be?
Flags: needinfo?(rodrigo5244)
(In reply to J. Ryan Stinnett [:jryans] (use ni?) from comment #5)
> I am not sure I follow what the problem is here.
> 
> The web console operates in the scope of the window of the page.
> 
> So, "this" in the console is the "window" object for that page.
> 
> In the bug title, it says "variables ... aren't on this", but in comment 0,
> it seems like they **are** currently, but you expect them not to be?

The title was changed by :Gijs Kruitbosch and does not reflect the problem anymore. The problem is not if variables are on |this| or not, that is irrelevant, the problem is that the attribute configurable can't be true since the variable was declared with the keyword var.
Flags: needinfo?(rodrigo5244)
Summary: Variables declared in the web console aren't on |this| in the console which confuses people → Variables declared in the web console are configurable which confuses people
Okay, I see what you mean now.  This is indeed different from the behavior of a regular page script, where "var a;" is **not** configurable.

Unfortunately, I am not sure what about the console leads to this.  Panos, do you know, or maybe you know someone who does?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(past)
Unfortunately I don't have time to investigate in the near term, but WCA_evalWithDebugger is probably where the magic happens. It's also possible that the Debugger API that we use under the hood does it automatically. If we can confirm that the Debugger API and not the console actor is the culprit, then jimb or fitzgen might be able to help.
Flags: needinfo?(past)
Product: Firefox → DevTools
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: