browser_bug477014.js
Go to the documentation of this file.
1 /* ***** BEGIN LICENSE BLOCK *****
2  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3  *
4  * The contents of this file are subject to the Mozilla Public License Version
5  * 1.1 (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  * http://www.mozilla.org/MPL/
8  *
9  * Software distributed under the License is distributed on an "AS IS" basis,
10  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11  * for the specific language governing rights and limitations under the
12  * License.
13  *
14  * The Original Code is bug 477014 test.
15  *
16  * The Initial Developer of the Original Code is
17  * Mozilla Corporation
18  * Portions created by the Initial Developer are Copyright (C) 2009
19  * the Initial Developer. All Rights Reserved.
20  *
21  * Contributor(s):
22  * Asaf Romano <mano@mozilla.com> (Original Author)
23  *
24  * Alternatively, the contents of this file may be used under the terms of
25  * either the GNU General Public License Version 2 or later (the "GPL"), or
26  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27  * in which case the provisions of the GPL or the LGPL are applicable instead
28  * of those above. If you wish to allow use of your version of this file only
29  * under the terms of either the GPL or the LGPL, and not to allow others to
30  * use your version of this file under the terms of the MPL, indicate your
31  * decision by deleting the provisions above and replace them with the notice
32  * and other provisions required by the GPL or the LGPL. If you do not delete
33  * the provisions above, a recipient may use your version of this file under
34  * the terms of any one of the MPL, the GPL or the LGPL.
35  *
36  * ***** END LICENSE BLOCK ***** */
37 
38 // That's a gecko!
39 const iconURLSpec = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz//z8DJQAggJiQOe/fv2fv7Oz8rays/N+VkfG/iYnJfyD/1+rVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw/8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi/G+QKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo+MXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia+CuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq/vLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg/kdypqCg4H8lUIACnQ/SOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD+aDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg==";
40 var testPage="data:text/plain,test bug 477014";
41 
42 function test() {
44 
45  var newWindow;
46  var tabToDetach;
47 
48  function onPageShow(event) {
49  // we get here if the test is executed before the pageshow
50  // event for the window's first tab
51  if (!tabToDetach ||
52  tabToDetach.linkedBrowser.contentDocument != event.target) {
53  return;
54  }
55 
56  if (!newWindow) {
57  var pageShowFunc = arguments.callee;
58  gBrowser.removeEventListener("pageshow", pageShowFunc, false);
59 
60  // prepare the tab (set icon and busy state)
61  // we have to set these only after onState* notification, otherwise
62  // they're overriden
63  setTimeout(function() {
64  gBrowser.setIcon(tabToDetach, iconURLSpec);
65  tabToDetach.setAttribute("busy", "true");
66 
67  // detach and set the listener on the new window
68  newWindow = gBrowser.replaceTabWithWindow(tabToDetach);
69  // wait for gBrowser to come along
70  function onLoad(event) {
71  newWindow.gBrowser
72  .addEventListener("pageshow", pageShowFunc, false);
73  newWindow.removeEventListener("load", arguments.callee, false);
74  }
75  newWindow.addEventListener("load", onLoad, false);
76  }, 0);
77  return;
78  }
79 
80  is(newWindow.gBrowser.selectedTab.hasAttribute("busy"), true);
81  is(newWindow.gBrowser.selectedTab.linkedBrowser.mIconURL,iconURLSpec);
82  newWindow.close();
83  finish();
84  }
85 
86  gBrowser.addEventListener("pageshow", onPageShow, false);
87  tabToDetach = gBrowser.addTab(testPage);
88 }
var event
Lastfm onLoad
Definition: mini.js:36
waitForExplicitFinish()
function test()
aWindow setTimeout(function(){_this.restoreHistory(aWindow, aTabs, aTabData, aIdMap);}, 0)
return!aWindow arguments!aWindow arguments[0]
const iconURLSpec
var testPage
function onPageShow()