Closed
Bug 410469
Opened 18 years ago
Closed 5 years ago
var foo = [].foo; does not generate expected(?) strict warning
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: neil, Unassigned)
References
(
URL
)
Details
Operations on [].foo used to always generate a strict JavaScript warning "reference to undefined property [].foo". Some of these warnings were turned off for ! && || ?: etc. but they also seem to have been turned off for =, which I'm not sure was expected. For instance, bar([].foo) generates a warning.
Updated•18 years ago
|
OS: Windows XP → All
Comment 1•18 years ago
|
||
Please attach (or inline if small) a specific testcase.
/be
the url triggers:
Warning: assignment to undeclared variable bar
Source file: javascript:bar%20=%20[].bar;%20var%20foo%20=%20[].foo;%20baz%20=%20[].baz;
Line: 1
Warning: assignment to undeclared variable baz
Source file: javascript:bar%20=%20[].bar;%20var%20foo%20=%20[].foo;%20baz%20=%20[].baz;
Line: 1
but no mention of foo.
URL: javascript:bar%20=%20[].bar;%20var%20...
Comment 3•18 years ago
|
||
Kinda unreadable with all those %20s, but ok.
This is intentional; see bug 248549. Had to use cvs annotate to remind myself.
/be
Comment 4•18 years ago
|
||
INVA then?
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Resolution: --- → INVALID
Comment 5•18 years ago
|
||
Bug 248549 is pretty long. Are any comments in that bug especially relevant to this bug?
Comment 6•18 years ago
|
||
I wouldn't go that far. The "detecting" logic is being used to good effect for things like undetected document.all support, but strict warnings could still be given for certain opcode sequences that should be considered "detecting".
This would require yet another opcode format flag, or a special case for an existing flag, or for a specific op. I'm not going to take this bug, but one idea is to use the existing JOF_SET flag as the special case: if it is set for the next op after the GET op that triggers the call to Detecting (jsobj.c), then (as today) Detecting should return true, but it could give a strict warning.
/be
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Comment 7•18 years ago
|
||
Sorry, comment 6 was in reply to comment 4.
Re: comment 5: I was looking through all the noise and drama, and I could not find the reasoning for including JOF_DETECTING among the JSOP_SET* opcodes' format flags -- I do recall it being necessary based on real-world pages that use (or used, this was 2004) undetected document.all.
/be
Status: UNCONFIRMED → NEW
Ever confirmed: true
| Reporter | ||
Comment 8•18 years ago
|
||
So people try to detect IE using var all = document.all; if (all) ...?
Comment 9•18 years ago
|
||
(In reply to comment #8)
> So people try to detect IE using var all = document.all; if (all) ...?
Yes, something like that. Perhaps bclary can scan for it and find some alexa top 1000 examples, but this was what jst and I were contending with, circa 2004.
/be
Comment 10•18 years ago
|
||
(In reply to comment #9)
closely related examples are in bug 259935 and bug 260685. the obj.ie stuff is still out there and is probably still used. Looking for a = document.all; ... if (a)... would take a while and require manual inspection of the matches to .all. I'll do it if there is a benefit to knowing the current answer, but not just for idle curiosity.
| Assignee | ||
Updated•12 years ago
|
Assignee: general → nobody
Comment 11•5 years ago
|
||
No longer valid after bug 1619177.
Status: NEW → RESOLVED
Closed: 18 years ago → 5 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•