Skip to content

Commit

Permalink
Merge branch 'jb35447' into 'nemo_embedlite_38'
Browse files Browse the repository at this point in the history
Jb35447

Contains three commits: one cleaning up / fixing orientation listener removal (copy-paste error), moving last known orientation to "member" variable so that scopes work correct, and drop "embed:domcontentloaded" message. We can use "chrome:contentloaded" instead of "embed:domcontentloaded" is needed and yes will be needed.

See merge request !17
  • Loading branch information
rainemak committed Jun 30, 2016
2 parents a72513c + da8edb9 commit 9beee6e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
5 changes: 4 additions & 1 deletion jscomps/EmbedLiteOrientationChangeHandler.js
Expand Up @@ -53,7 +53,10 @@ EmbedLiteOrientationChangeHandler.prototype = {
},

onWindowClosed: function(aWindow) {
Services.embedlite.chromeEventHandler(aWindow).addEventListener("DOMContentLoaded", this._orientationListeners[aWindow], false);
let chromeEventHandler = Services.embedlite.chromeEventHandler(aWindow);
if (chromeEventHandler) {
chromeEventHandler.removeEventListener("DOMContentLoaded", this._orientationListeners[aWindow], false);
}
delete this._orientationListeners[aWindow];
},

Expand Down
9 changes: 5 additions & 4 deletions jsscripts/OrientationChangeHandler.jsm
Expand Up @@ -28,25 +28,26 @@ OrientationChangeHandler.prototype = {

lastOrientation: "portrait-primary",
isRegistered: false,
orientationChangeSent: false,

handleOrientationChange: function(evt) {
let that = this;
let newOrientation = that._targetWindow.screen.mozOrientation;
let fullSwitch = (newOrientation.split("-")[0] ==
that.lastOrientation.split("-")[0]);
let changeSent = false;
that.orientationChangeSent = false;
that.lastOrientation = newOrientation;

function sendOrientationChanged() {
if (changeSent) {
if (that.orientationChangeSent) {
return;
}
try {
Services.embedlite.sendAsyncMessage(that._winID, "embed:contentOrientationChanged",
JSON.stringify({
"orientation": newOrientation
"orientation": that.lastOrientation
}));
changeSent = true;
that.orientationChangeSent = true;
} catch (e) {
dump("EmbedLiteOrientationChangeHandler: Failed to report orientation change " + e + "\n")
}
Expand Down
11 changes: 0 additions & 11 deletions jsscripts/embedhelper.js
Expand Up @@ -536,7 +536,6 @@ EmbedHelper.prototype = {
if (LoginManagerContent.onContentLoaded) {
LoginManagerContent.onContentLoaded(aEvent);
}
this._handleDomContentLoaded(aEvent);
break;
}
case "DOMFormHasPassword": {
Expand Down Expand Up @@ -572,16 +571,6 @@ EmbedHelper.prototype = {
return this.contentDocumentIsDisplayed;
},

_handleDomContentLoaded: function(aEvent) {
let window = aEvent.target.defaultView;
if (window) {
let winid = Services.embedlite.getIDByWindow(window);
try {
Services.embedlite.sendAsyncMessage(winid, "embed:domcontentloaded", JSON.stringify({ "rootFrame": window.parent === window }));
} catch (e) {}
}
},

_handleFullScreenChanged: function(aEvent) {
let window = aEvent.target.defaultView;
let winid = Services.embedlite.getIDByWindow(window);
Expand Down

0 comments on commit 9beee6e

Please sign in to comment.