Skip to content

Commit

Permalink
Merge branch 'JB49896' into 'sailfishos-esr52'
Browse files Browse the repository at this point in the history
PromptService.js implementation

See merge request mer-core/embedlite-components!56
  • Loading branch information
rainemak committed May 27, 2020
2 parents 5486cbb + 8a31f16 commit b82f6b3
Show file tree
Hide file tree
Showing 23 changed files with 521 additions and 1,699 deletions.
1 change: 0 additions & 1 deletion EmbedLiteBinComponents.manifest
@@ -1,4 +1,3 @@
binary-component libprompt.so
binary-component libhistory.so
binary-component libchromehelper.so
binary-component libtouchhelper.so
Expand Down
2 changes: 1 addition & 1 deletion Makefile.am
@@ -1,7 +1,7 @@
EXTRA_DIST = \
autogen.sh

SUBDIRS = history chromehelper prompt widgetfactory jscomps touchhelper jsscripts overrides
SUBDIRS = history chromehelper widgetfactory jscomps touchhelper jsscripts overrides

AM_CPPFLAGS = $(DEPS_CFLAGS)

Expand Down
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;
}
1 change: 0 additions & 1 deletion configure.ac
Expand Up @@ -122,7 +122,6 @@ AC_OUTPUT([
Makefile
history/Makefile
chromehelper/Makefile
prompt/Makefile
jscomps/Makefile
touchhelper/Makefile
jsscripts/Makefile
Expand Down
2 changes: 0 additions & 2 deletions embedlite-components.pro
Expand Up @@ -3,14 +3,12 @@ TEMPLATE = subdirs
SOURCES += chromehelper/*.cpp \
logger/*.cpp \
history/*.cpp \
prompt/*.cpp \
touchhelper/*.cpp \
widgetfactory/*.cpp

HEADERS += chromehelper/*.h \
logger/*.h \
history/*.h \
prompt/*.h \
touchhelper/*.h \
widgetfactory/*.h

Expand Down
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
8 changes: 4 additions & 4 deletions jscomps/EmbedLiteJSComponents.manifest
Expand Up @@ -80,10 +80,10 @@ contract @mozilla.org/embedlite-webapp-installer;1 {62dea3ae-c36f-11e2-aa1d-b337
category app-startup EmbedLiteWebAppInstall service,@mozilla.org/embedlite-webapp-installer;1

# PromptService.js
# component {44df5fae-c5a1-11e2-8e91-1ff32ee4f840} PromptService.js
# contract @mozilla.org/prompter;1 {44df5fae-c5a1-11e2-8e91-1ff32ee4f840}
# contract @mozilla.org/embedcomp/prompt-service;1 {44df5fae-c5a1-11e2-8e91-1ff32ee4f840}
# category wakeup-request PromptService @mozilla.org/embedcomp/prompt-service;1,nsIPromptService,getService,Prompt:Call
component {44df5fae-c5a1-11e2-8e91-1ff32ee4f840} PromptService.js
contract @mozilla.org/prompter;1 {44df5fae-c5a1-11e2-8e91-1ff32ee4f840}
contract @mozilla.org/embedcomp/prompt-service;1 {44df5fae-c5a1-11e2-8e91-1ff32ee4f840}
contract @mozilla.org/network/authprompt-adapter-factory;1 {44df5fae-c5a1-11e2-8e91-1ff32ee4f840}

# PrivateDataManager.js
component {6a7dd2ef-b7c8-4ab5-8c35-c0e5d7557ccf} PrivateDataManager.js
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

0 comments on commit b82f6b3

Please sign in to comment.