easyXDM
easyXDM copied to clipboard
IE7, removeFromStack(), up is null or not an object
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.
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.
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.
Do the official examples work for you in IE7? If that's the case then this is implementation-bound.
Also try removing the namespacing (noConflict) and see if this has anything to do with it.
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..
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.
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:
- If I change remote url to something like "http://www.empty.com", the error disappear,
- 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); }
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.
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.
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..
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; } }
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.
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...
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...
Ok, opened #192 to track the noConflict issue.