Bug 1842428 - Part 2: Remove unused imports. r=mccr8
[gecko.git] / js / xpconnect / tests / unit / test_rewrap_dead_wrapper.js
blob10934f550b48537d41ddc58f3b642b9bcfe6fd4a
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 /* See https://bugzilla.mozilla.org/show_bug.cgi?id=1354733 */
7 const global = this;
9 function run_test()
11   var sb = Cu.Sandbox(global);
12   let obj = new sb.Object();
13   Cu.nukeSandbox(sb);
15   ok(Cu.isDeadWrapper(obj), "object should be a dead wrapper");
17   // Create a new sandbox to wrap objects for.
19   var sb = Cu.Sandbox(global);
20   Cu.evalInSandbox(function echo(val) { return val; },
21                    sb);
23   let echoed = sb.echo(obj);
24   ok(Cu.isDeadWrapper(echoed), "Rewrapped object should be a dead wrapper");
25   ok(echoed !== obj, "Rewrapped object should be a new dead wrapper");
27   ok(obj === obj, "Dead wrapper object should be equal to itself");
29   let liveObj = {};
30   ok(liveObj === sb.echo(liveObj), "Rewrapped live object should be equal to itself");