49 const Cc = Components.classes;
50 const Ci = Components.interfaces;
51 const Cr = Components.results;
53 var
wm =
Cc[
"@mozilla.org/appshell/window-mediator;1"].
55 var
win =
wm.getMostRecentWindow(
"navigator:browser");
56 var
ios =
Cc[
"@mozilla.org/network/io-service;1"].
58 var
hs =
Cc[
"@mozilla.org/browser/nav-history-service;1"].
60 var
bs =
Cc[
"@mozilla.org/browser/nav-bookmarks-service;1"].
63 var
sidebar = document.getElementById(
"sidebar");
66 var visitId = hs.addVisit(aURI,
76 var bId = bs.insertBookmark(bs.unfiledBookmarksFolder, aURI,
77 bs.DEFAULT_INDEX,
"bookmark/" + aURI.spec);
95 name:
"open_history_sidebar_bydayandsite",
99 var
start = Date.now();
100 sidebar.addEventListener(
"load",
function(aEvent) {
101 sidebar.removeEventListener(
"load",
arguments.callee,
true);
102 executeSoon(
function() {
104 toggleSidebar(
"viewHistorySidebar",
false);
105 self.times.push(duration);
112 toggleSidebar(
"viewHistorySidebar",
true);
122 name:
"history_sidebar_bysite",
126 var
start = Date.now();
127 sidebar.addEventListener(
"load",
function() {
128 sidebar.removeEventListener(
"load",
arguments.callee,
true);
129 executeSoon(
function() {
131 sidebar.contentDocument.getElementById(
"bysite").doCommand();
132 toggleSidebar(
"viewHistorySidebar",
false);
133 self.times.push(duration);
140 toggleSidebar(
"viewHistorySidebar",
true);
150 name:
"history_sidebar_byday",
154 var start = Date.now();
155 sidebar.addEventListener(
"load",
function() {
156 sidebar.removeEventListener(
"load",
arguments.callee,
true);
157 executeSoon(
function() {
158 var duration = Date.now() -
start;
159 sidebar.contentDocument.getElementById(
"byday").doCommand();
160 toggleSidebar(
"viewHistorySidebar",
false);
161 self.times.push(duration);
168 toggleSidebar(
"viewHistorySidebar",
true);
178 name:
"history_sidebar_byvisited",
182 var start = Date.now();
183 sidebar.addEventListener(
"load",
function() {
184 sidebar.removeEventListener(
"load",
arguments.callee,
true);
185 executeSoon(
function() {
186 var duration = Date.now() -
start;
187 sidebar.contentDocument.getElementById(
"byvisited").doCommand();
188 toggleSidebar(
"viewHistorySidebar",
false);
189 self.times.push(duration);
196 toggleSidebar(
"viewHistorySidebar",
true);
206 name:
"history_sidebar_bylastvisited",
210 var start = Date.now();
211 sidebar.addEventListener(
"load",
function() {
212 sidebar.removeEventListener(
"load",
arguments.callee,
true);
213 executeSoon(
function() {
214 var duration = Date.now() -
start;
215 sidebar.contentDocument.getElementById(
"bylastvisited").doCommand();
216 toggleSidebar(
"viewHistorySidebar",
false);
217 self.times.push(duration);
224 toggleSidebar(
"viewHistorySidebar",
true);
236 var totalDuration = aTest.times.reduce(
function(time,
total){
return time +
total; });
237 var avgDuration = totalDuration/aTest.times.length;
248 if (ptests.length > 0)
249 ptests.shift().run();
getService(Ci.sbIFaceplateManager)
return!aWindow arguments!aWindow arguments[0]