views:

32

answers:

2

In our (quite large and old) ASP.NET application we use a lot of pages loaded into frames, iframes, and modal dialogs (using window.showModalDialog). We are starting to see the error above quite a bit, and I can't seem to find a single rational explanation for it anywhere.

  1. Popup Blockers. Nope. We're not running them. Not even the built-in blocker.

  2. Trusted Zone. Nope. The application runs on LocalHost right now, and it's in the trusted sites list.

  3. Stray Cosmic Rays. Possible, but not probable. It's way too consistent.

I did eventually find the error message buried on Microsoft's site in some dusty tome about retrieving automation error message information. In it, they were talking about Excel, and they said: "In this example, Microsoft Excel is the server application. Referencing a workbook object once it is destroyed (or closed) generates the error."

That is probably as close as I've ever come to an explanation for the cause of the error, without a real, concrete explanation. Someone tried to use something after their reference to it was disposed of. Oddly, you can still see the windows on the screen. Curiously, however, this smacks suspiciously to me of the accepted answer to this.

So here's what happens.

  • Page A is the main page.
  • PageA displays PageB in a frame. PageB is a toolbar.
  • PageA displays PageC in another frame. That's the content.
  • PageC displays PageD in a nonmodal dialog.
  • PageD, for reasons unknown to me, wants to modify the controls in PageB. It's trying to use window.opener to do that, and failing horribly.

If someone could enlighten me as to why this is the case (the code works in FF), I'd appreciate it.

A: 

I should have updated this question earlier, and I apologize for the delay. I've learned a bit since I posted it, and here's what I've learned.

For windows opened with window.showModalDialog, the window.opener method returns null, rather than a reference to the opening window. To get a reference to the opening window, you have to pass it as a dialog argument.

It's unclear to me at this point whether or not this is intended behavior; it's apparently undocumented behavior. Further, according to MSDN, window.opener is only valid for pages loaded into frames and iframes.

Mike Hofer
A: 

I had the exact same error message in following scenario: window A pop ups wind B, user search something and wind B calls wind A passing some parameter. Method called on wind A suppose to close popup wind B after it finish doing what it's doing. I was passing parameter as object: p ={a: 1, b:"c"} after I rewrite the code to pass each parameter separately error disappeared. callingMethod(1,"c");

Hope that helps somebody...

krul