Closed
Bug 22098
Opened 25 years ago
Closed 25 years ago
arguments object is not defined in XUL (brutal sharing)
Categories
(Core :: DOM: Core & HTML, defect, P1)
Core
DOM: Core & HTML
Tracking
()
VERIFIED
FIXED
M13
People
(Reporter: rginda, Assigned: brendan)
Details
(Keywords: js1.5)
Attachments
(3 files)
(deleted),
text/plain
|
Details | |
(deleted),
text/html
|
Details | |
(deleted),
patch
|
Details | Diff | Splinter Review |
Starting with the DOM component, but cc'ing brendan just in case it's really a
JS engine issue.
Maybe this has something to do with the window.arguments object conflicting with
the core arguments object. (Isn't window.arguments an IEism?)
Problem:
core JavaScript arguments object is not defined for js functions embedded in
XUL.
To reproduce:
1) save arguments.xul on your disk
2) load it in Mozilla
The following message will be displayed on the console:
"JavaScript Error: ReferenceError: arguments is not defined
URL: file:///home/rginda/src/HTML/moztests/arguments.xul
LineNo: 9"
This is a Bad Thing.
To compare, load arguments.html instead. You should see:
"bar: arguments: [object Arguments]"
on the console. This is what is expected.
Reporter | ||
Comment 1•25 years ago
|
||
Reporter | ||
Comment 2•25 years ago
|
||
Comment 3•25 years ago
|
||
Just noting that this same bug blows up the new profile wizard (for
1999121708 WinNT). See bug #22080
Assignee | ||
Updated•25 years ago
|
Assignee: vidur → brendan
Assignee | ||
Comment 4•25 years ago
|
||
This is a brutal sharing bug -- should it be fixed for M12? What XUL in
M12 actually needs the arguments object?
/be
Assignee | ||
Updated•25 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 5•25 years ago
|
||
If I'm awake enough, I read the other bug 22080 as a dup of this, and also not
an M12 stopper (cuz the new profile wizard code didn't go into M12). Someone
check my sleepy sanity here.
I'll fix this tomorrow. Sorry about the regression.
/be
Reporter | ||
Comment 6•25 years ago
|
||
This affects beng's profile manager ( bug 22080 ), so I'd guess it's M12
material.
Reporter | ||
Comment 7•25 years ago
|
||
This seems to make any parameter passed into the function undefined as well (not
just the arguments object.) I would say this is DEFINATELY M12 material. I see
this in some chatzilla routines as well. I assume it must show up elsewhere.
Reporter | ||
Comment 8•25 years ago
|
||
brendan: sorry, I misread your last comment, and didn't realize the new profile
manager wasn't in M12, but this does seem to be more than just a profile manager
issue. I'd bet there are other bugs that are as-yet-unknown dups of this.
For example, 22048.
Assignee | ||
Comment 10•25 years ago
|
||
rginda: do you mean function arguments appear to be undefined in all XUL, or
only in XUL for those functions that refer to the arguments object?
/be
Comment 11•25 years ago
|
||
See bug 22117 which is related to this problem. The cookie viewer just stopped
working because of the arguments array being undefined. I assumed that somebody
intentionally removed arguments from the javascript interpreter in the past few
days because it is marked as a deprecated function in the javascript reference
manaual. Therefore I solved the cookie viewer problem by changing the
javascript code of the cookie viewer.
But my fix was on the tip, not the M12 build. So if this bug is also breaking
the cookie viewer on the M12 branch (I don't have a build of the branch to test
it), I would like to cast my vote for fixing this bug on the M12 branch.
Comment 12•25 years ago
|
||
yeah. I have an update for the Profile Wizard as well that sidesteps the
insanity at the script level. Like cookieviewer, if this is broken on the M12
branch, it's probably worth me checking the fix into both.
Reporter | ||
Comment 13•25 years ago
|
||
brendan: I had thought it affected arguments in all xul functions, but this
doesn't seem
to be the case. But there is certainly more broken than just the arguments
object.
Adding the following lines to the foo() function in arguments.xul
dump ("instanceof regexp: " + (/some regexp/ instanceof RegExp) + "\n");
dump(/some regexp/ + "\n");
results in
instanceof regexp: false
JavaScript Error: TypeError: can't convert RegExp to string
URL: file:///home/rginda/src/moztests/arguments.xul
LineNo: 10
This seems to be what broke chatzilla in bug 22048.
Also, "dump(/some regexp/);" (without the + "\n") produces no output.
All of this works in an HTML file and the shell.
Is it really just a coincidence that these two things broke at the same time, or
are they related? On your say-so I'll file a new bug for the regexp issue, and
repoen 22048.
Comment 14•25 years ago
|
||
The RegExp instanceof test is failing because the proto for the RegExp is set to
null. In fact, the global object that exists at compilation time doesn't have
constructors for RegExp Or Object, which is a little sad.
Assignee | ||
Comment 15•25 years ago
|
||
Waterson and shaver fixed memory leak bugs by compiling XUL scripts against a
pretty-blank object (owned by the XUL document). I assured them that the JS
compiler does not side-effect that object at compile time, which is true, but I
forgot that it does expect the standard RegExp class constructor to be defined
there, because the compiler creates RegExp objects.
Couple of thoughts:
1. Call JS_InitStandardClasses(cx) in the XUL code that makes this "prototype
global" object against which XUL scripts are compiled.
2. Change JS so the compiler never constructs RegExp instances for /re/ literals
-- instead it emits prolog bytecodes to define these using the runtime RegExp
constructor binding. ECMA ed 3. may in fact require this -- rogerl and waldemar
please comment.
/be
Assignee | ||
Updated•25 years ago
|
Target Milestone: M13
Assignee | ||
Updated•25 years ago
|
Priority: P3 → P1
Assignee | ||
Updated•25 years ago
|
Summary: arguments object is not defined → arguments object is not defined in XUL (brutal sharing)
Comment 16•25 years ago
|
||
Section 7.8.5 says:
"A regular expression literal is an input element that is converted to a RegExp
object (section 15.10) when it is scanned. The object is created before
evaluation of the containing program or function begins. Evaluation of the
literal produces a reference to that object; it does not create a new object."
I think that implies option 1. is the right path.
Assignee | ||
Updated•25 years ago
|
Hardware: PC → All
Assignee | ||
Comment 17•25 years ago
|
||
Assignee | ||
Comment 18•25 years ago
|
||
Rob, can you verify that this bug and 22048 are both fixed, either already, or
by the same (attached) patch? Thanks,
/be
Reporter | ||
Comment 19•25 years ago
|
||
Patch fixes both bugs. (They weren't fixed already.)
Assignee | ||
Updated•25 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 20•25 years ago
|
||
Fixed in rdf/content/src/nsXULPrototypeDocument.cpp.
/be
Comment 21•25 years ago
|
||
Robert do you want to verify this one ?
You need to log in
before you can comment on or make changes to this bug.
Description
•