[Pkg-javascript-commits] [pdf.js] 22/141: Modify {get, set}Preferences in PdfStreamConverter.jsm to support async
David Prévot
taffit at moszumanska.debian.org
Sat Apr 19 22:40:26 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 4c9c43f82be35b1f8932eb42f8a91807f18034b1
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date: Wed Mar 26 19:38:56 2014 +0100
Modify {get, set}Preferences in PdfStreamConverter.jsm to support async
---
extensions/firefox/content/PdfStreamConverter.jsm | 13 ++++++++++---
web/firefoxcom.js | 10 +++++-----
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/extensions/firefox/content/PdfStreamConverter.jsm b/extensions/firefox/content/PdfStreamConverter.jsm
index 9e455a7..28ec7e1 100644
--- a/extensions/firefox/content/PdfStreamConverter.jsm
+++ b/extensions/firefox/content/PdfStreamConverter.jsm
@@ -452,7 +452,7 @@ ChromeActions.prototype = {
getChromeWindow(this.domWindow).gFindBar
.updateControlState(result, findPrevious);
},
- setPreferences: function(prefs) {
+ setPreferences: function(prefs, sendResponse) {
var defaultBranch = Services.prefs.getDefaultBranch(PREF_PREFIX + '.');
var numberOfPrefs = 0;
var prefValue, prefName;
@@ -483,8 +483,11 @@ ChromeActions.prototype = {
break;
}
}
+ if (sendResponse) {
+ sendResponse(true);
+ }
},
- getPreferences: function(prefs) {
+ getPreferences: function(prefs, sendResponse) {
var defaultBranch = Services.prefs.getDefaultBranch(PREF_PREFIX + '.');
var currentPrefs = {}, numberOfPrefs = 0;
var prefValue, prefName;
@@ -510,7 +513,11 @@ ChromeActions.prototype = {
break;
}
}
- return JSON.stringify(currentPrefs);
+ if (sendResponse) {
+ sendResponse(JSON.stringify(currentPrefs));
+ } else {
+ return JSON.stringify(currentPrefs);
+ }
}
};
diff --git a/web/firefoxcom.js b/web/firefoxcom.js
index 3e1b9b2..8ccb875 100644
--- a/web/firefoxcom.js
+++ b/web/firefoxcom.js
@@ -106,15 +106,15 @@ var DownloadManager = (function DownloadManagerClosure() {
Preferences._writeToStorage = function (prefObj) {
return new Promise(function (resolve) {
- FirefoxCom.requestSync('setPreferences', prefObj);
- resolve();
+ FirefoxCom.request('setPreferences', prefObj, resolve);
});
};
Preferences._readFromStorage = function (prefObj) {
return new Promise(function (resolve) {
- var readPrefs = JSON.parse(FirefoxCom.requestSync('getPreferences',
- prefObj));
- resolve(readPrefs);
+ FirefoxCom.request('getPreferences', prefObj, function (prefStr) {
+ var readPrefs = JSON.parse(prefStr);
+ resolve(readPrefs);
+ });
});
};
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list