Closed Bug 17952 Opened 25 years ago Closed 25 years ago

Can't do window.setTimeout() or window.close() when attempted by way of xpconnect

Categories

(Core :: XPConnect, defect, P1)

All
Windows NT
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: law, Assigned: law)

References

Details

The code in mozilla/xpfe/components/xfer/resources/downloadProgress.js implements an xpcom interface (nsIObserver) in JavaScript and that implementation is called from C++ code (namely, ../src/nsStreamXferOp.cpp). When called to be notified that the download is complete, the dialog attempts to close itself. window.setTimeout( "window.close();", 2000 ); causes a JS exception to be thrown because there's no JSContext on the stack (some security manager code fails). window.close(); directly just fails. I think this is because the close gets scheduled as a "termination function" and it ultimately doesn't get called (or fails) due to the same root cause. This is a problem. Unfortunately, the code to reproduce this sits only in my working directory. If you need assistance reproducing it, let me know and I'll get you my changes or create a testcase that can reproduce this.
We're between worlds (broken JSContext overloading, fixed XPConnect ThreadJSContextStack usage) and it sucks. We need to move the DOM state that's mislocated in JSContext into the window object private, reparameterize as needed and stuff. I'll help. /be
Depends on: 17736
No longer depends on: 17736
This depends on (is sort of a duplicate of) bug 17736
Status: NEW → ASSIGNED
Depends on: 17736
Blocks: 18406
Blocks: 21564
Assignee: jband → law
Status: ASSIGNED → NEW
Bill, I believe this should be fixed with my xpconnect refactoring that went in today. The similar bug 17736 is fixed. I'm reasigning this to you. Could you please run whatever test you have - if it is not too difficult to set that up - and either mark it fixed or reassign to me if there is still a problem.
Status: NEW → ASSIGNED
I'll check it out (will have to change JS that was modified to bypass the problem). The setTimeout() started working a little while back but unfortunately caused a crash when it did window.close(). window.close() in a xpconnect invoked JS method was not working and may with this most recent fix.
Priority: P3 → P1
Target Milestone: M14
M14.
Is this fixed in M13? If so, its TM need not be M14. Just curious, /be
Target Milestone: M14 → M13
The problem is fixed. I just verified it on Mac and Linux (each of which had window closing quirks till recently). I have not reset the code in downloadProgress.js. I've got some other bug fixes in that file and am waiting for a code review to be completed. I hope to check that code in later today. I'm resetting this to M13 so I'll remember to close this one, too, after the code is checked in.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
JS code has been reverted to use the technique that was previously causing the problem. Everything looks good now.
No longer blocks: 21564
is bug 49138 a dup of this? If so, something has regressed.
You need to log in before you can comment on or make changes to this bug.