pacojerte / svgweb

Automatically exported from code.google.com/p/svgweb
Other
0 stars 0 forks source link

Null Reference Error in Clean-Up Code (IE9 Standards Mode) #617

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Load a page with svgweb in IE9 Standards mode
2. Navigate away or refresh
3. the method '_fireUnload', has the line: 
'svgweb.handlers[i].document.documentElement = null;' but the document is null.

What is the expected output? What do you see instead?
Expect no errors.

What version of the product are you using? On what operating system,
browser, and version of Flash?

Please provide any additional information below. Reduced test cases are
always appreciated!

Just needs a null check, I guess.

Original issue reported on code.google.com by joshua.p...@gmail.com on 24 May 2011 at 8:52

GoogleCodeExporter commented 8 years ago
I'm also experiencing this error. I worked around it like so:

On svg.js, on line 51, change from:
  ...else svgweb.handlers[a].document.documentElement=null;...
to:
  ...else{try{svgweb.handlers[a].document.documentElement=null}catch(x){}};...

Then however another error happened in that "_fireUnload" function, on the same 
minified line, no 51, for this piece of code:
  if(b=document.getElementById("__htc_container")){
this error (deeper down the stack):
  SCRIPT438: Object doesn't support property or method 'setProperty' 
  svg.js, line 1 character 319

So I added another try-catch-ignore block, around the whole "delete the HTC 
container" code paragraph (see 
http://code.google.com/p/svgweb/source/browse/trunk/src/svg.js#2126 )

So this minified code:
if(b=document.getElementById("__htc_container")){for(a=0;a<b.childNodes.length;a
++){var 
c=b.childNodes[a];if(c.nodeType==1&&c.namespaceURI==svgns){c.detachEvent("onprop
ertychange",c._fakeNode.style._changeListener);c.style.item=null;c.style.setProp
erty=null;c.style.getPropertyValue=null}if(c._fakeNode)c._fakeNode._htcNode=null
;c._fakeNode=null;c._handler=
null}b.parentNode.removeChild(b)};

became this:
try{if(b=document.getElementById("__htc_container")){for(a=0;a<b.childNodes.leng
th;a++){var 
c=b.childNodes[a];if(c.nodeType==1&&c.namespaceURI==svgns){c.detachEvent("onprop
ertychange",c._fakeNode.style._changeListener);c.style.item=null;c.style.setProp
erty=null;c.style.getPropertyValue=null}if(c._fakeNode)c._fakeNode._htcNode=null
;c._fakeNode=null;c._handler=
null}b.parentNode.removeChild(b)}}catch(x){};

And now it works just fine :-)  or so I hope.  (That is, no exceptions and 
error dialogs when I reload my Web page in IE 9.)

Best regards, KajMagnus

Original comment by kajmagnu...@gmail.com on 5 Feb 2012 at 9:26

GoogleCodeExporter commented 8 years ago
There's a patch, that solves another issue, and this issue too:
  http://code.google.com/p/svgweb/issues/detail?id=616#c3

(I reverted all changes I did, and used the patched version, and now there's no 
error.)

Original comment by kajmagnu...@gmail.com on 5 Feb 2012 at 10:02