browser_dead_object.js 937 B

12345678910111213141516171819202122
  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/.
  4. */
  5. // For bug 773980, test that Components.utils.isDeadWrapper works as expected.
  6. add_task(function* test() {
  7. const url = "http://mochi.test:8888/browser/js/xpconnect/tests/browser/browser_deadObjectOnUnload.html";
  8. let newTab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, url);
  9. let browser = gBrowser.selectedBrowser;
  10. let contentDocDead = yield ContentTask.spawn(browser,{}, function*(browser){
  11. let doc = content.document;
  12. let promise = ContentTaskUtils.waitForEvent(this, "DOMContentLoaded", true);
  13. content.location = "about:home";
  14. yield promise;
  15. return Components.utils.isDeadWrapper(doc);
  16. });
  17. is(contentDocDead, true, "wrapper is dead");
  18. yield BrowserTestUtils.removeTab(newTab);
  19. });