Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert "Bug 793764 - Mozmill adds collected addons as string but not …

…as list to the report. r=jhammel" because of bug 794885

This reverts commit cc8dc7b.
  • Loading branch information...
commit 750a288ec1d7adf399dce1f8a4b78db78e25ddc8 1 parent ab1e936
@whimboo whimboo authored
View
1  mozmill/mozmill/__init__.py
@@ -425,7 +425,6 @@ def get_appinfo(self, bridge):
try:
mozmill = jsbridge.JSObject(bridge, js_module_mozmill)
app_info = json.loads(mozmill.getApplicationDetails())
-
except JSBridgeDisconnectError:
# We don't have to call report_disconnect here because
# start_runner() will handle this exception
View
35 mozmill/mozmill/extension/resource/driver/mozmill.js
@@ -93,11 +93,36 @@ function getStartupInfo() {
}
// keep list of installed addons to send to jsbridge for test run report
-var addons = "null";
-
+var addons = "null"; // this will be JSON parsed
if (typeof AddonManager != "undefined") {
- AddonManager.getAllAddons(function (aAddonList) {
- addons = aAddonList;
+ AddonManager.getAllAddons(function (addonList) {
+ var converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
+ .createInstance(Ci.nsIScriptableUnicodeConverter);
+ converter.charset = 'utf-8';
+
+ function replacer(key, value) {
+ if (typeof(value) == "string") {
+ try {
+ return converter.ConvertToUnicode(value);
+ } catch (e) {
+ var newstring = '';
+ for (var i=0; i < value.length; i++) {
+ replacement = '';
+ if ((32 <= value.charCodeAt(i)) && (value.charCodeAt(i) < 127)) {
+ // eliminate non-convertable characters;
+ newstring += value.charAt(i);
+ } else {
+ newstring += replacement;
+ }
+ }
+ return newstring;
+ }
+ }
+
+ return value;
+ }
+
+ addons = converter.ConvertToUnicode(JSON.stringify(addonList, replacer));
});
}
@@ -124,7 +149,7 @@ function getApplicationDetails() {
startupinfo: getStartupInfo()
};
- return utils.convertToUnicode(JSON.stringify(details));
+ return JSON.stringify(details);
}
function cleanQuit () {
View
41 mozmill/mozmill/extension/resource/stdlib/utils.js
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-var EXPORTED_SYMBOLS = ["convertToUnicode", "Copy", "getChromeWindow", "getWindows",
+var EXPORTED_SYMBOLS = ["Copy", "getChromeWindow", "getWindows",
"getWindowByTitle", "getWindowByType", "getWindowId",
"getMethodInWindows", "getPreference", "setPreference",
"sleep", "assert", "unwrapNode", "TimeoutError", "waitFor",
@@ -22,45 +22,6 @@ var hwindow = Cc["@mozilla.org/appshell/appShellService;1"]
var uuidgen = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator);
-
-/**
- * Converts the text from the source charset to Unicode.
- * Non-convertable characters will be replaced by a question mark.
- *
- * @param {String} aText Text to convert
- * @return {String} Unicode string
- */
-function convertToUnicode(aText) {
- var converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
- .createInstance(Ci.nsIScriptableUnicodeConverter);
- converter.charset = 'utf-8';
-
- function replacer(aKey, aValue) {
- if (typeof(aValue) === "string") {
- try {
- return converter.ConvertToUnicode(aValue);
- } catch (e) {
- var newstring = '';
- for (var i = 0; i < aValue.length; i++) {
- replacement = '?';
- if ((32 <= aValue.charCodeAt(i)) && (aValue.charCodeAt(i) < 127)) {
- // eliminate non-convertable characters;
- newstring += aValue.charAt(i);
- } else {
- newstring += replacement;
- }
- }
-
- return newstring;
- }
- }
-
- return aValue;
- }
-
- return converter.ConvertToUnicode(aText, replacer);
-}
-
function Copy (obj) {
for (var n in obj) {
this[n] = obj[n];
View
40 mutt/mutt/tests/python/test_appinfo.py
@@ -1,40 +0,0 @@
-import os
-import unittest
-import tempfile
-
-import mozmill
-
-
-class ModuleTest(unittest.TestCase):
- def make_test(self):
- """make an example test to run"""
- test = """var test_something = function() {}"""
- fd, path = tempfile.mkstemp()
- os.write(fd, test)
- os.close(fd)
-
- return path
-
- def test_appinfo(self):
- tests = [{'path': self.make_test()}]
-
- m = mozmill.MozMill.create()
- m.run(tests)
- results = m.finish()
-
- self.assertRegexpMatches(results.appinfo.get('application_id'), "^{.*}$")
- self.assertIsInstance(results.appinfo.get('application_name'), unicode)
- self.assertIsInstance(results.appinfo.get('application_version'), unicode)
- self.assertIsInstance(results.appinfo.get('application_locale'), unicode)
- self.assertRegexpMatches(results.appinfo.get('platform_buildid'), "^[0-9]*$")
- self.assertIsInstance(results.appinfo.get('application_version'), unicode)
- self.assertIsInstance(results.appinfo.get('startupinfo'), dict)
-
- addons = results.appinfo.get('addons')
- self.assertIsInstance(addons, list)
- self.assertGreaterEqual(len(addons), 2,
- "At least Mozmill and JSBridge should be installed.")
-
-
-if __name__ == '__main__':
- unittest.main()
View
1  mutt/mutt/tests/python/tests.ini
@@ -4,7 +4,6 @@ type = python
[include:cli/tests.ini]
[expectstacktest.py]
-[test_appinfo.py]
[test_bug690154.py]
[test_endTest.py]
[test_loggerListener.py]
Please sign in to comment.
Something went wrong with that request. Please try again.