1 Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);
2 registerCleanupFunction(() => {
3 Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
9 "var customIterator = {",
10 " _array: [6, 7, 8, 9]",
12 "customIterator[Symbol.iterator] = function* () {",
13 " for (var i = 0; i < this._array.length; ++i)",
14 " yield this._array[i];",
18 function checkIterator(iterator) {
19 var control = [6, 7, 8, 9];
21 for (var item of iterator) {
22 Assert.equal(item, control[i]);
27 // First, try in our own scope.
29 checkIterator(customIterator);
31 // Next, try a vanilla CCW.
32 var sbChrome = Cu.Sandbox(this);
33 Cu.evalInSandbox(toEval, sbChrome, '1.7');
34 checkIterator(sbChrome.customIterator);
36 // Finally, try an Xray waiver.
37 var sbContent = Cu.Sandbox('http://www.example.com');
38 Cu.evalInSandbox(toEval, sbContent, '1.7');
39 checkIterator(Cu.waiveXrays(sbContent.customIterator));