Bug 706207 - Fix incorrect pageWidth in viewport update [r=dougt]

Missing pieces of the document resulted in pageWidth getting
assigned to NaN, which was serialized as null by JSON. This
resulted in an exception over in Java-land when deserialization
was attempted, and killed the viewport update entirely.
This commit is contained in:
Kartikaya Gupta 2011-11-30 14:22:40 -05:00
parent 98e78974cf
commit da116c45a0
2 changed files with 5 additions and 4 deletions

View File

@ -155,6 +155,7 @@ public class GeckoSoftwareLayerClient extends LayerClient implements GeckoEventL
});
}
} catch (JSONException e) {
Log.e(LOGTAG, "Bad viewport description: " + viewportDescription);
throw new RuntimeException(e);
}
}

View File

@ -1100,10 +1100,10 @@ Tab.prototype = {
let pageWidth = this._viewport.width;
let pageHeight = this._viewport.height;
if (doc != null) {
let body = doc.body || {};
let html = doc.documentElement || {};
pageWidth = Math.max(body.scrollWidth || 1, html.scrollWidth);
pageHeight = Math.max(body.scrollHeight || 1, html.scrollHeight);
let body = doc.body || { scrollWidth: pageWidth, scrollHeight: pageHeight };
let html = doc.documentElement || { scrollWidth: pageWidth, scrollHeight: pageHeight };
pageWidth = Math.max(body.scrollWidth, html.scrollWidth);
pageHeight = Math.max(body.scrollHeight, html.scrollHeight);
}
// Transform coordinates based on zoom