Bug 1299613 - Grab ref to closingButton name prior to closing. r=Gijs
authorEric Rahm <erahm@mozilla.com>
Thu, 01 Sep 2016 13:33:52 -0700
changeset 312317 146e402be57e5c6fb052e0c1e2e7f781a4b4345e
parent 312316 6435e739a7ff8a1d9e9a3f6efccc34d4eb620f6d
child 312318 a66c6f541031b0922d54425354d507142d02812e
push id81334
push usererahm@mozilla.com
push dateThu, 01 Sep 2016 20:33:56 +0000
treeherdermozilla-inbound@146e402be57e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1299613
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1299613 - Grab ref to closingButton name prior to closing. r=Gijs In order to avoid poking a potentially dead wrapper we grab a ref to the button name prior to being destroyed.
browser/components/preferences/in-content/tests/browser_subdialogs.js
--- a/browser/components/preferences/in-content/tests/browser_subdialogs.js
+++ b/browser/components/preferences/in-content/tests/browser_subdialogs.js
@@ -54,28 +54,29 @@ function* open_subdialog_and_test_generi
 function* close_subdialog_and_test_generic_end_state(browser, closingFn, closingButton, acceptCount, options) {
   let dialogclosingPromise = ContentTask.spawn(browser, {closingButton, acceptCount}, function*(expectations) {
     let win = content.window;
     let subdialog = win.gSubDialog;
     let frame = subdialog._frame;
     info("waiting for dialogclosing");
     let closingEvent =
       yield ContentTaskUtils.waitForEvent(frame.contentWindow, "dialogclosing");
+    let closingButton = closingEvent.detail.button;
     let actualAcceptCount = frame.contentWindow.arguments &&
                             frame.contentWindow.arguments[0].acceptCount;
 
     info("waiting for about:blank load");
     yield ContentTaskUtils.waitForEvent(frame, "load");
 
     Assert.notEqual(win.getComputedStyle(subdialog._overlay, "").visibility, "visible",
       "overlay is not visible");
     Assert.equal(frame.getAttribute("style"), "", "inline styles should be cleared");
     Assert.equal(frame.contentWindow.location.href.toString(), "about:blank",
       "sub-dialog should be unloaded");
-    Assert.equal(closingEvent.detail.button, expectations.closingButton,
+    Assert.equal(closingButton, expectations.closingButton,
       "closing event should indicate button was '" + expectations.closingButton + "'");
     Assert.equal(actualAcceptCount, expectations.acceptCount,
       "should be 1 if accepted, 0 if canceled, undefined if closed w/out button");
   });
 
   if (options && options.runClosingFnOutsideOfContentTask) {
     yield closingFn();
   } else {