Skip to content

Commit

Permalink
[embedlite-components] Rename winid to winId. JB#49896
Browse files Browse the repository at this point in the history
  • Loading branch information
rainemak committed May 19, 2020
1 parent d3c36a9 commit 8a31f16
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 29 deletions.
8 changes: 4 additions & 4 deletions chromehelper/EmbedChromeListener.cpp
Expand Up @@ -63,9 +63,9 @@ EmbedChromeListener::HandleEvent(nsIDOMEvent* aEvent)
nsCOMPtr<nsIWritablePropertyBag2> root;
json->CreateObject(getter_AddRefs(root));

uint32_t winid;
mService->GetIDByWindow(DOMWindow, &winid);
NS_ENSURE_TRUE(winid , NS_ERROR_FAILURE);
uint32_t winId;
mService->GetIDByWindow(DOMWindow, &winId);
NS_ENSURE_TRUE(winId , NS_ERROR_FAILURE);
mozilla::dom::AutoNoJSAPI noJSAPI();

if (type.EqualsLiteral(MOZ_DOMMetaAdded)) {
Expand Down Expand Up @@ -132,7 +132,7 @@ EmbedChromeListener::HandleEvent(nsIDOMEvent* aEvent)

nsString outStr;
json->CreateJSON(root, message);
mService->SendAsyncMessage(winid, messageName.get(), message.get());
mService->SendAsyncMessage(winId, messageName.get(), message.get());

return NS_OK;
}
4 changes: 2 additions & 2 deletions jscomps/ContentPermissionPrompt.js
Expand Up @@ -116,8 +116,8 @@ ContentPermissionPrompt.prototype = {
let entityName = kEntities[perm.type];

Services.embedlite.addMessageListener("embedui:permissions", this);
var winid = Services.embedlite.getIDByWindow(request.window);
Services.embedlite.sendAsyncMessage(winid, "embed:permissions",
var winId = Services.embedlite.getIDByWindow(request.window);
Services.embedlite.sendAsyncMessage(winId, "embed:permissions",
JSON.stringify({title: entityName,
host: request.principal.URI.host,
id: reqkey}));
Expand Down
12 changes: 6 additions & 6 deletions jscomps/EmbedLiteFaviconService.js
Expand Up @@ -49,12 +49,12 @@ var gProgressListener = {
return;
}
let iconPath = domDoc.documentURIObject.prePath + "/favicon.ico";
let winid = Services.embedlite.getIDByWindow(aWebProgress.DOMWindow);
let winId = Services.embedlite.getIDByWindow(aWebProgress.DOMWindow);
NetUtil.asyncFetch(iconPath, function(aInputStream, aStatusCode, aRequest) {
if (!Components.isSuccessCode(aStatusCode) || aRequest.contentType == "text/html") {
return;
}
Services.embedlite.sendAsyncMessage(winid, "embed:faviconURL", JSON.stringify({url: resolveGeckoURI(iconPath)}));
Services.embedlite.sendAsyncMessage(winId, "embed:faviconURL", JSON.stringify({url: resolveGeckoURI(iconPath)}));
});
},
onSecurityChange: function() { },
Expand All @@ -67,12 +67,12 @@ var gProgressListener = {

function EventLinkListener(aWindow)
{
this._winID = Services.embedlite.getIDByWindow(aWindow);
this._targetWindow = Services.embedlite.getContentWindowByID(this._winID);
this._winId = Services.embedlite.getIDByWindow(aWindow);
this._targetWindow = Services.embedlite.getContentWindowByID(this._winId);
}

EventLinkListener.prototype = {
_winID: -1,
_winId: -1,
_targetWindow: null,
handleEvent: function Input_handleEvent(aEvent) {
switch (aEvent.type) {
Expand Down Expand Up @@ -100,7 +100,7 @@ EventLinkListener.prototype = {
if (list.indexOf("[icon]") == -1)
return;

Services.embedlite.sendAsyncMessage(this._winID, "embed:faviconURL", JSON.stringify({url: resolveGeckoURI(target.href)}));
Services.embedlite.sendAsyncMessage(this._winId, "embed:faviconURL", JSON.stringify({url: resolveGeckoURI(target.href)}));
break;
}
},
Expand Down
14 changes: 7 additions & 7 deletions jscomps/EmbedLiteWebAppInstall.js
Expand Up @@ -118,8 +118,8 @@ var WebappsUI = {
}).bind(this));
break;
case "webapps-sync-uninstall":
let winid = Services.embedlite.getIDByWindow(Services.ww.activeWindow);
Services.embedlite.sendAsyncMessage(winid, "WebApps:Uninstall", JSON.stringify({
let winId = Services.embedlite.getIDByWindow(Services.ww.activeWindow);
Services.embedlite.sendAsyncMessage(winId, "WebApps:Uninstall", JSON.stringify({
origin: data.origin
}));
break;
Expand Down Expand Up @@ -168,13 +168,13 @@ var WebappsUI = {
// if (!showPrompt || Services.prompt.confirm(null, "Install Web App", name + "\n" + aData.app.origin)) {
if (!showPrompt || Services.ww.activeWindow.confirm(name + "\n" + aData.app.origin)) {
// Get a profile for the app to be installed in. We'll download everything before creating the icons.
let winid = Services.embedlite.getIDByWindow(Services.ww.activeWindow);
let winId = Services.embedlite.getIDByWindow(Services.ww.activeWindow);
let message = JSON.stringify({
name: manifest.name,
manifestURL: aData.app.manifestURL,
origin: aData.app.origin
});
let response = Services.embedlite.sendSyncMessage(winid, "WebApps:PreInstall", message);
let response = Services.embedlite.sendSyncMessage(winId, "WebApps:PreInstall", message);
profilePath = JSON.parse(response).path;
let file = null;
if (profilePath) {
Expand Down Expand Up @@ -211,7 +211,7 @@ var WebappsUI = {
let source = Services.io.newURI(fullsizeIcon, "UTF8", null);
persist.saveURI(source, null, null, null, null, iconFile, null);

Services.embedlite.sendAsyncMessage(winid, "WebApps:PostInstall", JSON.stringify({
Services.embedlite.sendAsyncMessage(winId, "WebApps:PostInstall", JSON.stringify({
name: manifest.name,
manifestURL: aData.app.manifestURL,
origin: aData.app.origin,
Expand Down Expand Up @@ -259,8 +259,8 @@ var WebappsUI = {
},

openURL: function openURL(aManifestURL, aOrigin) {
let winid = Services.embedlite.getIDByWindow(Services.ww.activeWindow);
Services.embedlite.sendAsyncMessage(winid, "WebApps:Open", JSON.stringify({
let winId = Services.embedlite.getIDByWindow(Services.ww.activeWindow);
Services.embedlite.sendAsyncMessage(winId, "WebApps:Open", JSON.stringify({
manifestURL: aManifestURL,
origin: aOrigin
}));
Expand Down
4 changes: 2 additions & 2 deletions jscomps/LoginManagerPrompter.js
Expand Up @@ -179,9 +179,9 @@ LoginManagerPrompter.prototype = {
}

Services.embedlite.addMessageListener("embedui:login", this);
var winid = Services.embedlite.getIDByWindow(notifyWin);
var winId = Services.embedlite.getIDByWindow(notifyWin);
let uniqueid = this._getRandomId();
Services.embedlite.sendAsyncMessage(winid, "embed:login",
Services.embedlite.sendAsyncMessage(winId, "embed:login",
JSON.stringify(
{
name: aName,
Expand Down
16 changes: 8 additions & 8 deletions jsscripts/embedhelper.js
Expand Up @@ -217,8 +217,8 @@ EmbedHelper.prototype = {

let uri = this._getLinkURI(element);
if (uri && (uri instanceof Ci.nsIURI)) {
let winid = Services.embedlite.getIDByWindow(content);
Services.embedlite.sendAsyncMessage(winid, "embed:linkclicked",
let winId = Services.embedlite.getIDByWindow(content);
Services.embedlite.sendAsyncMessage(winId, "embed:linkclicked",
JSON.stringify({
"uri": uri.asciiSpec
}));
Expand Down Expand Up @@ -272,15 +272,15 @@ EmbedHelper.prototype = {
}
case "embedui:zoomToRect": {
if (aMessage.data) {
let winid = Services.embedlite.getIDByWindow(content);
let winId = Services.embedlite.getIDByWindow(content);
// This is a hackish way as zoomToRect does not work if x-value has not changed or viewport has not been scaled (zoom animation).
// Thus, we're missing animation when viewport has not been scaled.
let scroll = this._viewportData && this._viewportData.cssCompositedRect.width === aMessage.data.width;

if (scroll) {
content.scrollTo(aMessage.data.x, aMessage.data.y);
} else {
Services.embedlite.zoomToRect(winid, aMessage.data.x, aMessage.data.y, aMessage.data.width, aMessage.data.height);
Services.embedlite.zoomToRect(winId, aMessage.data.x, aMessage.data.y, aMessage.data.width, aMessage.data.height);
}
}
break;
Expand Down Expand Up @@ -518,8 +518,8 @@ EmbedHelper.prototype = {
aAllowZoom = !Util.fuzzyEquals(rect.w, this._viewportData.cssCompositedRect.width)

if (aAllowZoom) {
var winid = Services.embedlite.getIDByWindow(content);
Services.embedlite.zoomToRect(winid, rect.x, rect.y, rect.w, rect.h);
var winId = Services.embedlite.getIDByWindow(content);
Services.embedlite.zoomToRect(winId, rect.x, rect.y, rect.w, rect.h);
} else {
content.scrollTo(rect.x, rect.y);
}
Expand Down Expand Up @@ -602,9 +602,9 @@ EmbedHelper.prototype = {

_handleFullScreenChanged: function(aEvent) {
let window = aEvent.target.defaultView;
let winid = Services.embedlite.getIDByWindow(window);
let winId = Services.embedlite.getIDByWindow(window);
this.inFullScreen = aEvent.target.mozFullScreen;
Services.embedlite.sendAsyncMessage(winid, "embed:fullscreenchanged",
Services.embedlite.sendAsyncMessage(winId, "embed:fullscreenchanged",
JSON.stringify({
"fullscreen": aEvent.target.mozFullScreen
}));
Expand Down

0 comments on commit 8a31f16

Please sign in to comment.