easyXDM icon indicating copy to clipboard operation
easyXDM copied to clipboard

IE7, removeFromStack(), up is null or not an object

Open jonatrey opened this issue 14 years ago • 15 comments

Hello,

This issue seem to only happen in IE7. Library version: 2.4.15.118

This only happens in this specific case:

CRT_XDM.socket = new CRT_XDM.easyXDM.Socket({ remote: "remote_url", container: document.getElementById("container"), onMessage: function(message, origin){ this.container.getElementsByTagName("iframe")[0].style.height = parseInt(message) + "px"; }, onReady: function() { this.container.getElementsByTagName("iframe")[0].scrolling="no"; this.container.getElementsByTagName("iframe")[0].allowtransparency="true"; } });

var message_interval = setInterval(function() { var posTop = mypos;

var message = posTop+";"+document.documentElement.clientHeight;

if(message != prevMessage){
  CRT_XDM.socket.postMessage(message);
  prevMessage = message;
}

}, 1000);

If I move the postMessage in "onMessage" or outside the setInterval, the error disappear.

jonatrey avatar Sep 03 '11 21:09 jonatrey

scrolling and allowtransparancy can be applied directly using the props object.

I've not seen this error before, and to be honest, I don't see how it could come about as up will always be set... If you could set up a test case then I might get to look at it.

oyvindkinsey avatar Sep 05 '11 06:09 oyvindkinsey

Hello,

I've put a test case together:

http://reziew.com/site/testXDM

To see the issue, you have to use IE7 and resize de window. (since it's what is checked in setInterval). I was not able to reproduce it, nor on IE8, IE9, Chrome, firefox and safari.As a temporary fix, I removed messaging on IE7.

jonatrey avatar Sep 05 '11 07:09 jonatrey

Do the official examples work for you in IE7? If that's the case then this is implementation-bound.

oyvindkinsey avatar Sep 05 '11 08:09 oyvindkinsey

Also try removing the namespacing (noConflict) and see if this has anything to do with it.

oyvindkinsey avatar Sep 05 '11 08:09 oyvindkinsey

Why is the setTimeout in the top document and not in the iframe?

Why is http://static.reziew.com/optimzd/1315128138/widget.min.js loaded twice in the iframe? This could have something to do with it.

Never debug such things using minified code and packers..

oyvindkinsey avatar Sep 05 '11 08:09 oyvindkinsey

Yes, your examples do with IE7.

Removing the noConflicts also removes the error :-)

When digging around to find why I had this error, when I saw your comment about nConflict on post http://easyxdm.net/wp/2011/04/13/microsoft-security-bulletin-ms11-018/, I thought it couldn't be it.

jonatrey avatar Sep 05 '11 08:09 jonatrey

In fact those are not the same js, there is widget.min.js (my widget), and widget_iframe.min.js (easy XDM packed). The way I've build it the app, JS are compressed on the prod server and you don't have access to the dev server.

Looks like we are moving forward:

  1. If I change remote url to something like "http://www.empty.com", the error disappear,
  2. If I remove the "noConflict" part, the error disappear too.

I feel the error isn't triggered by the consumer, but rather the provider. But if really is the case, how would you explain that I can work around the error by simply adding that to my consumer:

if(ieversion == null || ieversion>=8){ socket.postMessage(message); }

jonatrey avatar Sep 05 '11 09:09 jonatrey

Just to answer your question about the setInterval:

I have a setInterval in both the consumer and the provider. Consumer: To detect the scroll position Provider: To detect the size of the div contained in the iframe

I need the scroll position to be able to center overlays that popup from inside the iframe. Without this scroll pos, the overlay would be vertically centered within the iframe and not within the doc.

jonatrey avatar Sep 05 '11 09:09 jonatrey

I just found the root cause, this is probably a user mistake: On my provider I was using the socket to post a message without checking whether it was ready or not. Issue closed.

jonatrey avatar Sep 09 '11 12:09 jonatrey

Using a socket before it's ready should not be a problem as the stack buffers these. So you it might actually be that you have found a bug in the way the QueueBehavior, that handles the buffering, removes itself from the queue after doing its job..

oyvindkinsey avatar Sep 10 '11 08:09 oyvindkinsey

Hello,

No matter how I use the socket, removeFromStack is always failing at some point on IE7 (element.up is null).

Here is how I modified the function to work around the error:

/**

  • This will remove a stackelement from its stack while leaving the stack functional.
  • @param {Object} element The elment to remove from the stack. */ function removeFromStack(element){ if (element.up == null) { element.up = element.down = null; } else { element.up.down = element.down; element.down.up = element.up; element.up = element.down = null; } }

jonatrey avatar Oct 15 '11 11:10 jonatrey

I'm seeing this error intermittently in IE7 however @jonatrey's workaround results in 2 iframes being added to the page. Happy to provide info.

paulyoung avatar Nov 28 '11 16:11 paulyoung

I also see this error but used the @jonatrey fix. It works for ie6/7 and these browsers are going the way of the dodo...

ghost avatar Jan 25 '12 03:01 ghost

Ok, this definitely deserves attention.

I have a popup implementation similar to the bridge.html example. Works fine in all browsers but IE. 2 days of debugging later, I have removed the noConflict directive after discovering this thread, and it works.

So, I'll be opening a new Issue for this, which I'll post here...

findchris avatar Aug 17 '12 22:08 findchris

Ok, opened #192 to track the noConflict issue.

findchris avatar Aug 17 '12 22:08 findchris