Avoid errors from elements without box object

This commit is contained in:
YUKI Hiroshi 2015-03-19 11:32:03 +09:00
parent a8d490f468
commit d2d68a6437

View File

@ -144,10 +144,10 @@ BrowserUIShowHideObserver.prototype = {
serializeBoxState : function BrowserUIShowHideObserver_serializeBoxState(aElement) serializeBoxState : function BrowserUIShowHideObserver_serializeBoxState(aElement)
{ {
aElement = aElement || this.box; aElement = aElement || this.box;
var box = aElement.boxObject; var box = aElement.boxObject || {}; // Some times there is no boxObject (ex. HTML element)
return JSON.stringify({ return JSON.stringify({
width : box.width, width : box.width || 0,
height : box.height, height : box.height || 0,
hidden : Boolean(aElement.hidden), hidden : Boolean(aElement.hidden),
collapsed : Boolean(aElement.collapsed) collapsed : Boolean(aElement.collapsed)
}); });