views:

154

answers:

3

I'm working with an embedded (Active X?) instance of IE within a VB6 application.

The browser displays demographic information based off the selected person (displayed as a list).

Everything works great until I try to quickly select different people from the list (clicking randomly over different people as fast as I can). After a few clicks, get two errors.

The first is an "Internet Explorer Script Error"

It says:

An Error has occurred in the script on this page
Line:
Char:
Error:
Code:
URL: Do you want to continue running scripts on this page? yes|No

(Line, Char, Error, Code, URL are all blank).

The second error pops up directly over the first.

It says:

"Message from webpage

An error has occurred in this dialog
Error:53 Permission denied
"

The page makes multiple ajax calls and also contains several iFrames (I'm thinking these are the cause).

Any advice on how to debug / resolve / avoid the problem would be most appreciated.

Thanks!

EDIT

Here is an image of the error

Error

EDIT

I get a JScript anonymous function, No source available when I do happen to catch the error.

No Source Available

EDIT

I've successfully caught some of the errors. It seems that they are stemming primarily from MicrosoftAjax.js

  • Occurs Consistently: MicrosoftAjax.js - Sys._Application.callBaseMethod(this,"initialize"); Object Expected
  • Occurred Once: jquery-1.4.2.min.js - b.InsertBefore(d,b.firstChild) Object Expected
  • Occurred Once: Out of Memory Exception.

My host application is not using MicrosoftAjax.js at all, but the child iFrame applications are all asp.Net applications.

+1  A: 

I've found that most of the IE "Permission denied" errors have to do with sharing Javascript objects between windows/frames. Since you produce it with rapid random clicking, I'm guessing this has to do with iframes/windows going away while their content is still being accessed.

One strategy you could use to avoid these problems is to never share any objects between frames. Wherever an object is created, that frame should be responsible for all operations and access to its members. Outside access should be controlled completely through calls to "interface" Javascript functions.

Jacob
I think your right about it being the iframes. After I took them out the error went away. I don't think I'm doing any object sharing, but I could be wrong (The applications running in the iframes are fairly extensive just by themselves, and I didn't write them). Would there be a way to "stop" all process within the iframes from the parent. Something like "window.onbeforeunload... $('iframe').stop();"?
Brandon Boone
I don't know how to do that, sorry. However, if you want to just suppress Javascript errors, try my other answer.
Jacob
+1  A: 

If you want to just suppress Javascript errors, try setting the Silent property of the WebBrowser to True.

Jacob
I think this is the solution we're going to go with, but I have to wait on the other dev team to implement the change before I can test. If it works, I'll mark this as the answer, though it would be nice to figure out exactly why the error is being thrown over just hiding it. Thanks for your help!
Brandon Boone
Just got back from testing with Development and setting Silent didn't work. We were still able to throw the error.
Brandon Boone
+1  A: 

After a lot of testing and trying to figure out if I really needed to edit MicrosoftAjax.js to fix the problem, I finally found a solution that seems to have resolved the issue.

I added,

<script type="text/javascript">         
  window.onerror = function (e) { return true; }        
</script>

to the header of ever application that I was pulling in via the iFrames, as well as to the parent page. It's been about two days since I made these changes and so far so good (though I'll need a few more days of testing to confirm that it's working 100%).

I had tried this before without success, but that was due to the position of the Script. I had other scripts (like jQuery and MicrosoftAjax) that were positioned before it. Those scripts threw errors before my window.onerror script was even evaluated.

Another interesting thing is that the iFrame errors seem to bubble up regardless of the error handling on the parent page. So I went into our Code repository and made the necessary changes to each of the applications I was pulling in.

Lastly, I want to say thank you to @Jacob for his initial help in troubleshooting this issue.

EDIT

Just wanted to add that I would have preferred to fix the error over burying it, but in the interest of time, this is the solution I've gone with for now.

Brandon Boone
Wow, `onerror` looks like a very helpful event. Didn't even know about that one.
Jacob