Bug 1274708 Use Context.jsonStringify() in connectNative r=kmag

MozReview-Commit-ID: J7q49nLg4F3

--HG--
extra : rebase_source : 9bdddffa43811fdff10fa75ea77bc0641012c9a3
This commit is contained in:
Andrew Swan 2016-06-16 10:10:54 -07:00
Родитель 8bf4c1d66e
Коммит cedc1d8eaf
3 изменённых файлов: 13 добавлений и 10 удалений

Просмотреть файл

@ -267,7 +267,7 @@ this.NativeApp = class extends EventEmitter {
let json;
try {
json = JSON.stringify(msg);
json = this.context.jsonStringify(msg);
} catch (err) {
throw new this.context.cloneScope.Error(err.message);
}

Просмотреть файл

@ -248,15 +248,14 @@ add_task(function* test_happy_path() {
what: "object with several properties",
},
// enable with bug 1274708
//{
// data: {
// ignoreme: true,
// _json: {data: "i have a tojson method"},
// },
// expected: {data: "i have a tojson method"},
// what: "object with toJSON() method",
//},
{
data: {
ignoreme: true,
_json: {data: "i have a tojson method"},
},
expected: {data: "i have a tojson method"},
what: "object with toJSON() method",
},
];
for (let test of tests) {
extension.sendMessage("send", test.data);

Просмотреть файл

@ -70,9 +70,13 @@ add_task(function* setup() {
notEqual(PYTHON, null, "Found a suitable python interpreter");
});
let global = this;
// Test of HostManifestManager.lookupApplication() begin here...
let context = {
url: null,
jsonStringify(...args) { return JSON.stringify(...args); },
cloneScope: global,
logError() {},
preprocessors: {},
callOnClose: () => {},