37 const Cc = Components.classes;
38 const Ci = Components.interfaces;
48 var sessionData = document.getElementById(
"sessionData");
49 if (!sessionData.value) {
50 var ss =
Cc[
"@mozilla.org/browser/sessionstartup;1"].getService(
Ci.nsISessionStartup);
51 sessionData.value = ss.state;
52 if (!sessionData.value) {
53 document.getElementById(
"errorTryAgain").disabled =
true;
58 var
event = document.createEvent(
"UIEvents");
59 event.initUIEvent(
"input",
true,
true,
window, 0);
60 sessionData.dispatchEvent(
event);
62 var s =
new Components.utils.Sandbox(
"about:blank");
63 gStateObject = Components.utils.evalInSandbox(
"(" + sessionData.value +
")", s);
67 document.getElementById(
"errorTryAgain").focus();
71 var tabList = document.getElementById(
"tabList");
72 var winLabel = tabList.getAttribute(
"_window_label");
77 label: winLabel.replace(
"%S", (
aIx + 1)),
86 if (/^https?:/.
test(iconURL))
87 iconURL =
"moz-anno:favicon:" + iconURL;
89 label: entry.title || entry.url,
96 for each (var
tab in winState.tabs)
101 tabList.view.selection.select(0);
107 document.getElementById(
"errorTryAgain").disabled =
true;
126 var ss =
Cc[
"@mozilla.org/browser/sessionstore;1"].getService(
Ci.nsISessionStore);
130 if (top.gBrowser.tabContainer.childNodes.length == 1) {
131 ss.setWindowState(top, stateString,
true);
136 var newWindow = top.openDialog(top.location,
"_blank",
"chrome,dialog=no,all");
137 newWindow.addEventListener(
"load",
function() {
138 newWindow.removeEventListener(
"load",
arguments.callee,
true);
139 ss.setWindowState(newWindow, stateString,
true);
142 var
tabIndex = tabbrowser.getBrowserIndexForDocument(document);
143 tabbrowser.removeTab(tabbrowser.tabContainer.childNodes[tabIndex]);
148 var prefBranch =
Cc[
"@mozilla.org/preferences-service;1"].getService(
Ci.nsIPrefBranch);
149 if (prefBranch.getIntPref(
"browser.startup.page") == 0)
157 if (aEvent.button == 2)
160 var row = {}, col = {};
161 treeView.treeBox.getCellAt(aEvent.clientX, aEvent.clientY, row, col, {});
165 if ((aEvent.button == 1 || aEvent.ctrlKey) && col.value.id ==
"title" &&
168 else if (col.value.id ==
"restore")
174 switch (aEvent.keyCode)
176 case KeyEvent.DOM_VK_SPACE:
179 case KeyEvent.DOM_VK_RETURN:
180 var
ix = document.getElementById(
"tabList").currentIndex;
181 if (aEvent.ctrlKey && !
treeView.isContainer(ix))
184 case KeyEvent.DOM_VK_UP:
185 case KeyEvent.DOM_VK_DOWN:
186 case KeyEvent.DOM_VK_PAGE_UP:
187 case KeyEvent.DOM_VK_PAGE_DOWN:
188 case KeyEvent.DOM_VK_HOME:
189 case KeyEvent.DOM_VK_END:
190 aEvent.preventDefault();
198 return window.QueryInterface(
Ci.nsIInterfaceRequestor).getInterface(
Ci.nsIWebNavigation)
199 .QueryInterface(
Ci.nsIDocShellTreeItem).rootTreeItem
200 .QueryInterface(
Ci.nsIInterfaceRequestor).getInterface(
Ci.nsIDOMWindow);
205 item.checked = !item.checked;
208 function isChecked(aItem) aItem.checked;
212 for each (var
tab in item.tabs) {
213 tab.checked = item.checked;
219 item.parent.checked = item.parent.tabs.every(isChecked) ?
true :
220 item.parent.tabs.some(isChecked) ? 0 :
false;
224 document.getElementById(
"errorTryAgain").disabled = !
gTreeData.some(isChecked);
229 var newTab = tabbrowser.addTab();
232 var ss =
Cc[
"@mozilla.org/browser/sessionstore;1"].getService(
Ci.nsISessionStore);
235 ss.setTabState(newTab, tabState.toSource());
238 var prefBranch =
Cc[
"@mozilla.org/preferences-service;1"].getService(
Ci.nsIPrefBranch);
239 if (prefBranch.getBoolPref(
"browser.tabs.loadInBackground") != !aShifted)
240 tabbrowser.selectedTab = newTab;
247 _getAtom:
function(
aName)
249 if (!this._atoms[
aName]) {
250 var
as =
Cc[
"@mozilla.org/atom-service;1"].getService(
Ci.nsIAtomService);
251 this._atoms[
aName] = as.getAtom(aName);
253 return this._atoms[
aName];
259 get rowCount() {
return gTreeData.length; },
260 setTree:
function(treeBox) { this.treeBox = treeBox; },
261 getCellText:
function(idx, column) {
return gTreeData[idx].label; },
262 isContainer:
function(idx) {
return "open" in
gTreeData[idx]; },
263 getCellValue:
function(idx, column){
return gTreeData[idx].checked; },
264 isContainerOpen:
function(idx) {
return gTreeData[idx].open; },
265 isContainerEmpty:
function(idx) {
return false; },
266 isSeparator:
function(idx) {
return false; },
267 isSorted:
function() {
return false; },
268 isEditable:
function(idx, column) {
return false; },
269 getLevel:
function(idx) {
return this.isContainer(idx) ? 0 : 1; },
271 getParentIndex:
function(idx) {
272 if (!this.isContainer(idx))
273 for (var
t = idx - 1;
t >= 0 ;
t--)
274 if (this.isContainer(
t))
279 hasNextSibling:
function(idx, after) {
280 var thisLevel = this.getLevel(idx);
282 if (this.getLevel(
t) <= thisLevel)
283 return this.getLevel(
t) == thisLevel;
287 toggleOpenState:
function(idx) {
288 if (!this.isContainer(idx))
293 var thisLevel = this.getLevel(idx);
294 for (var
t = idx + 1;
t <
gTreeData.length && this.getLevel(
t) > thisLevel;
t++);
295 var deletecount =
t - idx - 1;
297 this.treeBox.rowCountChanged(idx + 1, -deletecount);
302 for (var
i = 0;
i < toinsert.length;
i++)
304 this.treeBox.rowCountChanged(idx + 1, toinsert.length);
306 item.open = !item.open;
307 this.treeBox.invalidateRow(idx);
311 if (column.id ==
"restore" &&
this.isContainer(idx) &&
gTreeData[idx].checked === 0)
312 prop.AppendElement(
this._getAtom(
"partial"));
313 if (column.id ==
"title")
314 prop.AppendElement(this._getAtom(this.getImageSrc(idx, column) ?
"icon" :
"noicon"));
317 getRowProperties:
function(idx, prop) {
319 if (winState.ix % 2 != 0)
320 prop.AppendElement(this._getAtom(
"alternate"));
323 getImageSrc:
function(idx, column) {
324 if (column.id ==
"title")
329 getProgressMode :
function(idx, column) { },
330 cycleHeader:
function(column) { },
331 cycleCell:
function(idx, column) { },
332 selectionChanged:
function() { },
333 performAction:
function(action) { },
334 performActionOnCell:
function(action, index, column) { },
335 getColumnProperties:
function(column, prop) { }
function restoreSingleTab(aIx, aShifted)
function getBrowserWindow()
function restoreSession()
gImageView getCellProperties
this _contentSandbox label
function onListKeyDown(aEvent)
_updateTextAndScrollDataForTab aTabData
BogusChannel prototype open
function onListClick(aEvent)
function startNewSession()
restoreHistoryPrecursor aIx
return!aWindow arguments!aWindow arguments[0]
function toggleRowChecked(aIx)
_getSelectedPageStyle s i
restoreWindowFeatures aWinData