--- a/toolkit/components/places/tests/Makefile.in
+++ b/toolkit/components/places/tests/Makefile.in
@@ -42,36 +42,37 @@ srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = toolkit/components/places/tests
include $(DEPTH)/config/autoconf.mk
MODULE = test_places
XPCSHELL_TESTS = \
- autocomplete \
- sync \
- bookmarks \
- queries \
- unit \
- $(NULL)
+ autocomplete \
+ sync \
+ bookmarks \
+ queries \
+ unit \
+ $(NULL)
# Simple MochiTests
-MOCHI_TESTS = mochitest/test_bug_405924.html \
- mochitest/test_bug_411966.html \
- mochitest/test_bug_461710.html \
- $(NULL)
+MOCHI_TESTS = \
+ mochitest/test_bug_405924.html \
+ mochitest/test_bug_411966.html \
+ mochitest/test_bug_461710.html \
+ $(NULL)
-MOCHI_CONTENT = mochitest/prompt_common.js \
- $(NULL)
+MOCHI_CONTENT = \
+ mochitest/prompt_common.js \
+ $(NULL)
DIRS = \
chrome \
mochitest/bug_411966 \
mochitest/bug_461710 \
-# These tests are disabled for the time being, see bug 416066
-# browser \
+ browser \
$(NULL)
include $(topsrcdir)/config/rules.mk
libs:: $(MOCHI_TESTS) $(MOCHI_CONTENT)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
deleted file mode 100644
--- a/toolkit/components/places/tests/browser/399606-history.go-0.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<html>
-<head>
-<title>history.go(0)</title>
-<script>
-setTimeout('history.go(0)', 1000);
-</script>
-</head>
-<body>
-Testing history.go(0)
-</body>
-</html>
deleted file mode 100644
--- a/toolkit/components/places/tests/browser/399606-httprefresh.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<html><head>
-<meta http-equiv="content-type" content="text/html; charset=UTF-8">
-
-<meta http-equiv="refresh" content="1">
-<title>httprefresh</title>
-</head><body>
-Testing httprefresh
-</body></html>
deleted file mode 100644
--- a/toolkit/components/places/tests/browser/399606-location.reload.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<html>
-<head>
-<title>location.reload()</title>
-<script>
-setTimeout('location.reload();', 100);
-</script>
-</head>
-<body>
-Testing location.reload();
-</body>
-</html>
deleted file mode 100644
--- a/toolkit/components/places/tests/browser/399606-location.replace.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<html>
-<head>
-<title>location.replace</title>
-<script>
-setTimeout('location.replace(window.location.href)', 1000);
-</script>
-</head>
-<body>
-Testing location.replace
-</body>
-</html>
deleted file mode 100644
--- a/toolkit/components/places/tests/browser/399606-window.location.href.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<html>
-<head>
-<title>window.location.href</title>
-<script>
-setTimeout('window.location.href = window.location.href', 1000);
-</script>
-</head>
-<body>
-Testing window.location.href
-</body>
-</html>
deleted file mode 100644
--- a/toolkit/components/places/tests/browser/399606-window.location.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<html>
-<head>
-<title>window.location</title>
-<script>
-setTimeout('window.location = window.location', 1000);
-</script>
-</head>
-<body>
-Testing window.location
-</body>
-</html>
--- a/toolkit/components/places/tests/browser/Makefile.in
+++ b/toolkit/components/places/tests/browser/Makefile.in
@@ -41,32 +41,27 @@ topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = toolkit/components/places/tests/browser
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_BROWSER_FILES = \
- browser_bug413985-httprefresh.js \
-# browser_bug413985-location.reload.js \
-# browser_bug413985-location.replace.js \
- browser_bug413985-window.location.href.js \
- browser_bug413985-window.location.js \
- browser_bug413985-history.go-0.js \
- $(NULL)
+ browser_bug399606.js \
+ $(NULL)
# These are files that need to be loaded via the HTTP proxy server
# Access them through http://example.com/
_HTTP_FILES = \
- 399606-httprefresh.html \
- 399606-location.reload.html \
- 399606-location.replace.html \
- 399606-window.location.href.html \
- 399606-window.location.html \
- 399606-history.go-0.html \
- $(NULL)
+ bug_399606/399606-httprefresh.html \
+ bug_399606/399606-location.reload.html \
+ bug_399606/399606-location.replace.html \
+ bug_399606/399606-window.location.href.html \
+ bug_399606/399606-window.location.html \
+ bug_399606/399606-history.go-0.html \
+ $(NULL)
libs:: $(_BROWSER_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
libs:: $(_HTTP_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
new file mode 100644
--- /dev/null
+++ b/toolkit/components/places/tests/browser/browser_bug399606.js
@@ -0,0 +1,111 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Shawn Wilsher <me@shawnwilsher.com> (Original Author)
+ * Marco Bonardo <mak77@bonardo.net>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+function test() {
+ // Due to LAZY_ADD this is an async test.
+ waitForExplicitFinish();
+ const LAZY_ADD_TIMER = 3000;
+
+ var URIs = [
+ "http://example.com/tests/toolkit/components/places/tests/browser/399606-window.location.href.html",
+ "http://example.com/tests/toolkit/components/places/tests/browser/399606-history.go-0.html",
+ "http://example.com/tests/toolkit/components/places/tests/browser/399606-location.replace.html",
+ "http://example.com/tests/toolkit/components/places/tests/browser/399606-location.reload.html",
+ "http://example.com/tests/toolkit/components/places/tests/browser/399606-httprefresh.html",
+ "http://example.com/tests/toolkit/components/places/tests/browser/399606-window.location.html",
+ ];
+ var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
+ getService(Ci.nsINavHistoryService);
+
+ // Create and add history observer.
+ var historyObserver = {
+ visitCount: Array(),
+ onBeginUpdateBatch: function() {},
+ onEndUpdateBatch: function() {},
+ onVisit: function(aURI, aVisitID, aTime, aSessionID, aReferringID,
+ aTransitionType) {
+ info("Received onVisit: " + aURI.spec);
+ if (aURI.spec in this.visitCount)
+ this.visitCount[aURI.spec]++;
+ else
+ this.visitCount[aURI.spec] = 1;
+ },
+ onTitleChanged: function(aURI, aPageTitle) {},
+ onBeforeDeleteURI: function(aURI) {},
+ onDeleteURI: function(aURI) {},
+ onClearHistory: function() {},
+ onPageChanged: function(aURI, aWhat, aValue) {},
+ onPageExpired: function(aURI, aVisitTime, aWholeEntry) {},
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsINavHistoryObserver])
+ };
+ hs.addObserver(historyObserver, false);
+
+ function confirm_results() {
+ hs.removeObserver(historyObserver, false);
+ for (let aURI in historyObserver.visitCount) {
+ is(historyObserver.visitCount[aURI], 1, "onVisit has been received right number of times for " + aURI);
+ }
+ hs.QueryInterface(Ci.nsIBrowserHistory).removeAllPages();
+ finish();
+ }
+
+ var loadCount = 0;
+ function handleLoad(aEvent) {
+ loadCount++;
+ info("new load count is " + loadCount);
+
+ if (loadCount == 3) {
+ window.getBrowser().removeEventListener("DOMContentLoaded", handleLoad, true);
+ window.content.document.location.href = "about:blank";
+ executeSoon(check_next_uri);
+ }
+ }
+
+ function check_next_uri() {
+ if (URIs.length) {
+ let uri = URIs.shift();
+ loadCount = 0;
+ window.getBrowser().addEventListener("DOMContentLoaded", handleLoad, true);
+ window.content.document.location.href = uri;
+ }
+ else {
+ setTimeout(confirm_results, LAZY_ADD_TIMER * 2);
+ }
+ }
+ executeSoon(check_next_uri);
+}
deleted file mode 100644
--- a/toolkit/components/places/tests/browser/browser_bug413985-history.go-0.js
+++ /dev/null
@@ -1,116 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Mozilla Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2008
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Shawn Wilsher <me@shawnwilsher.com> (Original Author)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-function test()
-{
- const TEST_URI = "http://example.com/tests/toolkit/components/places/tests/browser/399606-history.go-0.html";
-
- var histsvc = Cc["@mozilla.org/browser/nav-history-service;1"].
- getService(Ci.nsINavHistoryService);
-
- // create and add history observer
- var observer = {
- onBeginUpdateBatch: function() {},
- onEndUpdateBatch: function() {},
- onVisit: function(aURI, aVisitID, aTime, aSessionID, aReferringID,
- aTransitionType) {
- info("onVisit: " + aURI.spec);
- confirm_results();
-
- histsvc.removeObserver(observer, false);
- win.content.document.location.href = "about:blank";
- finish();
- },
- onTitleChanged: function(aURI, aPageTitle) {},
- onBeforeDeleteURI: function(aURI) {},
- onDeleteURI: function(aURI) {},
- onClearHistory: function() {},
- onPageChanged: function(aURI, aWhat, aValue) {},
- onPageExpired: function(aURI, aVisitTime, aWholeEntry) {},
- QueryInterface: function(iid) {
- if (iid.equals(Ci.nsINavHistoryObserver) ||
- iid.equals(Ci.nsISupports)) {
- return this;
- }
- throw Cr.NS_ERROR_NO_INTERFACE;
- }
- };
-
- histsvc.addObserver(observer, false);
-
- // If LAZY_ADD is ever disabled, this function will not be correct
- var loadCount = 0;
- function confirm_results() {
- var options = histsvc.getNewQueryOptions();
- options.resultType = options.RESULTS_AS_VISIT;
- options.includeHidden = true;
- var query = histsvc.getNewQuery();
- var uri = Cc["@mozilla.org/network/io-service;1"].
- getService(Ci.nsIIOService).
- newURI(TEST_URI, null, null);
- info("query uri is " + uri.spec);
- query.uri = uri;
- var result = histsvc.executeQuery(query, options);
- var root = result.root;
- root.containerOpen = true;
- var cc = root.childCount;
- is(cc, 1, "Visit count is what we expect");
- ok(loadCount > 1, "Load count is greater than 1");
- root.containerOpen = false;
- }
-
- var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
- getService(Ci.nsIWindowMediator);
- var win = wm.getMostRecentWindow("navigator:browser");
-
- function handleLoad(aEvent) {
- info("location is " + aEvent.originalTarget.location.href);
- loadCount++;
- info("new load count is " + loadCount);
-
- if (loadCount == 3)
- win.getBrowser().removeEventListener("DOMContentLoaded", handleLoad, false);
- }
-
- win.getBrowser().addEventListener("DOMContentLoaded", handleLoad, false);
-
- // load page
- win.content.document.location.href = TEST_URI;
-
- // let our load handler handle the rest of the test
- waitForExplicitFinish();
-}
deleted file mode 100644
--- a/toolkit/components/places/tests/browser/browser_bug413985-httprefresh.js
+++ /dev/null
@@ -1,116 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Mozilla Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2008
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Shawn Wilsher <me@shawnwilsher.com> (Original Author)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-function test()
-{
- const TEST_URI = "http://example.com/tests/toolkit/components/places/tests/browser/399606-httprefresh.html";
-
- var histsvc = Cc["@mozilla.org/browser/nav-history-service;1"].
- getService(Ci.nsINavHistoryService);
-
- // create and add history observer
- var observer = {
- onBeginUpdateBatch: function() {},
- onEndUpdateBatch: function() {},
- onVisit: function(aURI, aVisitID, aTime, aSessionID, aReferringID,
- aTransitionType) {
- info("onVisit: " + aURI.spec);
- confirm_results();
-
- histsvc.removeObserver(observer, false);
- win.content.document.location.href = "about:blank";
- finish();
- },
- onTitleChanged: function(aURI, aPageTitle) {},
- onBeforeDeleteURI: function(aURI) {},
- onDeleteURI: function(aURI) {},
- onClearHistory: function() {},
- onPageChanged: function(aURI, aWhat, aValue) {},
- onPageExpired: function(aURI, aVisitTime, aWholeEntry) {},
- QueryInterface: function(iid) {
- if (iid.equals(Ci.nsINavHistoryObserver) ||
- iid.equals(Ci.nsISupports)) {
- return this;
- }
- throw Cr.NS_ERROR_NO_INTERFACE;
- }
- };
-
- histsvc.addObserver(observer, false);
-
- // If LAZY_ADD is ever disabled, this function will not be correct
- var loadCount = 0;
- function confirm_results() {
- var options = histsvc.getNewQueryOptions();
- options.resultType = options.RESULTS_AS_VISIT;
- options.includeHidden = true;
- var query = histsvc.getNewQuery();
- var uri = Cc["@mozilla.org/network/io-service;1"].
- getService(Ci.nsIIOService).
- newURI(TEST_URI, null, null);
- info("query uri is " + uri.spec);
- query.uri = uri;
- var result = histsvc.executeQuery(query, options);
- var root = result.root;
- root.containerOpen = true;
- var cc = root.childCount;
- is(cc, 1, "Visit count is what we expect");
- ok(loadCount > 1, "Load count is greater than 1");
- root.containerOpen = false;
- }
-
- var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
- getService(Ci.nsIWindowMediator);
- var win = wm.getMostRecentWindow("navigator:browser");
-
- function handleLoad(aEvent) {
- info("location is " + aEvent.originalTarget.location.href);
- loadCount++;
- info("new load count is " + loadCount);
-
- if (loadCount == 3)
- win.getBrowser().removeEventListener("DOMContentLoaded", handleLoad, false);
- }
-
- win.getBrowser().addEventListener("DOMContentLoaded", handleLoad, false);
-
- // load page
- win.content.document.location.href = TEST_URI;
-
- // let our load handler handle the rest of the test
- waitForExplicitFinish();
-}
deleted file mode 100644
--- a/toolkit/components/places/tests/browser/browser_bug413985-location.reload.js
+++ /dev/null
@@ -1,116 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Mozilla Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2008
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Shawn Wilsher <me@shawnwilsher.com> (Original Author)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-function test()
-{
- const TEST_URI = "http://example.com/tests/toolkit/components/places/tests/browser/399606-location.reload.html";
-
- var histsvc = Cc["@mozilla.org/browser/nav-history-service;1"].
- getService(Ci.nsINavHistoryService);
-
- // create and add history observer
- var observer = {
- onBeginUpdateBatch: function() {},
- onEndUpdateBatch: function() {},
- onVisit: function(aURI, aVisitID, aTime, aSessionID, aReferringID,
- aTransitionType) {
- info("onVisit: " + aURI.spec);
- confirm_results();
-
- histsvc.removeObserver(observer, false);
- win.content.document.location.href = "about:blank";
- finish();
- },
- onTitleChanged: function(aURI, aPageTitle) {},
- onBeforeDeleteURI: function(aURI) {},
- onDeleteURI: function(aURI) {},
- onClearHistory: function() {},
- onPageChanged: function(aURI, aWhat, aValue) {},
- onPageExpired: function(aURI, aVisitTime, aWholeEntry) {},
- QueryInterface: function(iid) {
- if (iid.equals(Ci.nsINavHistoryObserver) ||
- iid.equals(Ci.nsISupports)) {
- return this;
- }
- throw Cr.NS_ERROR_NO_INTERFACE;
- }
- };
-
- histsvc.addObserver(observer, false);
-
- // If LAZY_ADD is ever disabled, this function will not be correct
- var loadCount = 0;
- function confirm_results() {
- var options = histsvc.getNewQueryOptions();
- options.resultType = options.RESULTS_AS_VISIT;
- options.includeHidden = true;
- var query = histsvc.getNewQuery();
- var uri = Cc["@mozilla.org/network/io-service;1"].
- getService(Ci.nsIIOService).
- newURI(TEST_URI, null, null);
- info("query uri is " + uri.spec);
- query.uri = uri;
- var result = histsvc.executeQuery(query, options);
- var root = result.root;
- root.containerOpen = true;
- var cc = root.childCount;
- is(cc, 1, "Visit count is what we expect");
- ok(loadCount > 1, "Load count is greater than 1");
- root.containerOpen = false;
- }
-
- var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
- getService(Ci.nsIWindowMediator);
- var win = wm.getMostRecentWindow("navigator:browser");
-
- function handleLoad(aEvent) {
- info("location is " + aEvent.originalTarget.location.href);
- loadCount++;
- info("new load count is " + loadCount);
-
- if (loadCount == 3)
- win.getBrowser().removeEventListener("DOMContentLoaded", handleLoad, true);
- }
-
- win.getBrowser().addEventListener("DOMContentLoaded", handleLoad, true);
-
- // load page
- win.content.document.location.href = TEST_URI;
-
- // let our load handler handle the rest of the test
- waitForExplicitFinish();
-}
deleted file mode 100644
--- a/toolkit/components/places/tests/browser/browser_bug413985-location.replace.js
+++ /dev/null
@@ -1,116 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Mozilla Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2008
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Shawn Wilsher <me@shawnwilsher.com> (Original Author)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-function test()
-{
- const TEST_URI = "http://example.com/tests/toolkit/components/places/tests/browser/399606-location.replace.html";
-
- var histsvc = Cc["@mozilla.org/browser/nav-history-service;1"].
- getService(Ci.nsINavHistoryService);
-
- // create and add history observer
- var observer = {
- onBeginUpdateBatch: function() {},
- onEndUpdateBatch: function() {},
- onVisit: function(aURI, aVisitID, aTime, aSessionID, aReferringID,
- aTransitionType) {
- info("onVisit: " + aURI.spec);
- confirm_results();
-
- histsvc.removeObserver(observer, false);
- win.content.document.location.href = "about:blank";
- finish();
- },
- onTitleChanged: function(aURI, aPageTitle) {},
- onBeforeDeleteURI: function(aURI) {},
- onDeleteURI: function(aURI) {},
- onClearHistory: function() {},
- onPageChanged: function(aURI, aWhat, aValue) {},
- onPageExpired: function(aURI, aVisitTime, aWholeEntry) {},
- QueryInterface: function(iid) {
- if (iid.equals(Ci.nsINavHistoryObserver) ||
- iid.equals(Ci.nsISupports)) {
- return this;
- }
- throw Cr.NS_ERROR_NO_INTERFACE;
- }
- };
-
- histsvc.addObserver(observer, false);
-
- // If LAZY_ADD is ever disabled, this function will not be correct
- var loadCount = 0;
- function confirm_results() {
- var options = histsvc.getNewQueryOptions();
- options.resultType = options.RESULTS_AS_VISIT;
- options.includeHidden = true;
- var query = histsvc.getNewQuery();
- var uri = Cc["@mozilla.org/network/io-service;1"].
- getService(Ci.nsIIOService).
- newURI(TEST_URI, null, null);
- info("query uri is " + uri.spec);
- query.uri = uri;
- var result = histsvc.executeQuery(query, options);
- var root = result.root;
- root.containerOpen = true;
- var cc = root.childCount;
- is(cc, 1, "Visit count is what we expect");
- ok(loadCount > 1, "Load count is greater than 1");
- root.containerOpen = false;
- }
-
- var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
- getService(Ci.nsIWindowMediator);
- var win = wm.getMostRecentWindow("navigator:browser");
-
- function handleLoad(aEvent) {
- info("location is " + aEvent.originalTarget.location.href);
- loadCount++;
- info("new load count is " + loadCount);
-
- if (loadCount == 3)
- win.getBrowser().removeEventListener("DOMContentLoaded", handleLoad, true);
- }
-
- win.getBrowser().addEventListener("DOMContentLoaded", handleLoad, true);
-
- // load page
- win.content.document.location.href = TEST_URI;
-
- // let our load handler handle the rest of the test
- waitForExplicitFinish();
-}
deleted file mode 100644
--- a/toolkit/components/places/tests/browser/browser_bug413985-window.location.href.js
+++ /dev/null
@@ -1,116 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Mozilla Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2008
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Shawn Wilsher <me@shawnwilsher.com> (Original Author)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-function test()
-{
- const TEST_URI = "http://example.com/tests/toolkit/components/places/tests/browser/399606-window.location.href.html";
-
- var histsvc = Cc["@mozilla.org/browser/nav-history-service;1"].
- getService(Ci.nsINavHistoryService);
-
- // create and add history observer
- var observer = {
- onBeginUpdateBatch: function() {},
- onEndUpdateBatch: function() {},
- onVisit: function(aURI, aVisitID, aTime, aSessionID, aReferringID,
- aTransitionType) {
- info("onVisit: " + aURI.spec);
- confirm_results();
-
- histsvc.removeObserver(observer, false);
- win.content.document.location.href = "about:blank";
- finish();
- },
- onTitleChanged: function(aURI, aPageTitle) {},
- onBeforeDeleteURI: function(aURI) {},
- onDeleteURI: function(aURI) {},
- onClearHistory: function() {},
- onPageChanged: function(aURI, aWhat, aValue) {},
- onPageExpired: function(aURI, aVisitTime, aWholeEntry) {},
- QueryInterface: function(iid) {
- if (iid.equals(Ci.nsINavHistoryObserver) ||
- iid.equals(Ci.nsISupports)) {
- return this;
- }
- throw Cr.NS_ERROR_NO_INTERFACE;
- }
- };
-
- histsvc.addObserver(observer, false);
-
- // If LAZY_ADD is ever disabled, this function will not be correct
- var loadCount = 0;
- function confirm_results() {
- var options = histsvc.getNewQueryOptions();
- options.resultType = options.RESULTS_AS_VISIT;
- options.includeHidden = true;
- var query = histsvc.getNewQuery();
- var uri = Cc["@mozilla.org/network/io-service;1"].
- getService(Ci.nsIIOService).
- newURI(TEST_URI, null, null);
- info("query uri is " + uri.spec);
- query.uri = uri;
- var result = histsvc.executeQuery(query, options);
- var root = result.root;
- root.containerOpen = true;
- var cc = root.childCount;
- is(cc, 1, "Visit count is what we expect");
- ok(loadCount > 1, "Load count is greater than 1");
- root.containerOpen = false;
- }
-
- var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
- getService(Ci.nsIWindowMediator);
- var win = wm.getMostRecentWindow("navigator:browser");
-
- function handleLoad(aEvent) {
- info("location is " + aEvent.originalTarget.location.href);
- loadCount++;
- info("new load count is " + loadCount);
-
- if (loadCount == 3)
- win.getBrowser().removeEventListener("DOMContentLoaded", handleLoad, true);
- }
-
- win.getBrowser().addEventListener("DOMContentLoaded", handleLoad, true);
-
- // load page
- win.content.document.location.href = TEST_URI;
-
- // let our load handler handle the rest of the test
- waitForExplicitFinish();
-}
deleted file mode 100644
--- a/toolkit/components/places/tests/browser/browser_bug413985-window.location.js
+++ /dev/null
@@ -1,116 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Mozilla Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2008
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Shawn Wilsher <me@shawnwilsher.com> (Original Author)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-function test()
-{
- const TEST_URI = "http://example.com/tests/toolkit/components/places/tests/browser/399606-window.location.html";
-
- var histsvc = Cc["@mozilla.org/browser/nav-history-service;1"].
- getService(Ci.nsINavHistoryService);
-
- // create and add history observer
- var observer = {
- onBeginUpdateBatch: function() {},
- onEndUpdateBatch: function() {},
- onVisit: function(aURI, aVisitID, aTime, aSessionID, aReferringID,
- aTransitionType) {
- info("onVisit: " + aURI.spec);
- confirm_results();
-
- histsvc.removeObserver(observer, false);
- win.content.document.location.href = "about:blank";
- finish();
- },
- onTitleChanged: function(aURI, aPageTitle) {},
- onBeforeDeleteURI: function(aURI) {},
- onDeleteURI: function(aURI) {},
- onClearHistory: function() {},
- onPageChanged: function(aURI, aWhat, aValue) {},
- onPageExpired: function(aURI, aVisitTime, aWholeEntry) {},
- QueryInterface: function(iid) {
- if (iid.equals(Ci.nsINavHistoryObserver) ||
- iid.equals(Ci.nsISupports)) {
- return this;
- }
- throw Cr.NS_ERROR_NO_INTERFACE;
- }
- };
-
- histsvc.addObserver(observer, false);
-
- // If LAZY_ADD is ever disabled, this function will not be correct
- var loadCount = 0;
- function confirm_results() {
- var options = histsvc.getNewQueryOptions();
- options.resultType = options.RESULTS_AS_VISIT;
- options.includeHidden = true;
- var query = histsvc.getNewQuery();
- var uri = Cc["@mozilla.org/network/io-service;1"].
- getService(Ci.nsIIOService).
- newURI(TEST_URI, null, null);
- info("query uri is " + uri.spec);
- query.uri = uri;
- var result = histsvc.executeQuery(query, options);
- var root = result.root;
- root.containerOpen = true;
- var cc = root.childCount;
- is(cc, 1, "Visit count is what we expect");
- ok(loadCount > 1, "Load count is greater than 1");
- root.containerOpen = false;
- }
-
- var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
- getService(Ci.nsIWindowMediator);
- var win = wm.getMostRecentWindow("navigator:browser");
-
- function handleLoad(aEvent) {
- info("location is " + aEvent.originalTarget.location.href);
- loadCount++;
- info("new load count is " + loadCount);
-
- if (loadCount == 3)
- win.getBrowser().removeEventListener("DOMContentLoaded", handleLoad, true);
- }
-
- win.getBrowser().addEventListener("DOMContentLoaded", handleLoad, true);
-
- // load page
- win.content.document.location.href = TEST_URI;
-
- // let our load handler handle the rest of the test
- waitForExplicitFinish();
-}
new file mode 100644
--- /dev/null
+++ b/toolkit/components/places/tests/browser/bug_399606/399606-history.go-0.html
@@ -0,0 +1,11 @@
+<html>
+<head>
+<title>history.go(0)</title>
+<script>
+setTimeout('history.go(0)', 1000);
+</script>
+</head>
+<body>
+Testing history.go(0)
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/toolkit/components/places/tests/browser/bug_399606/399606-httprefresh.html
@@ -0,0 +1,8 @@
+<html><head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+
+<meta http-equiv="refresh" content="1">
+<title>httprefresh</title>
+</head><body>
+Testing httprefresh
+</body></html>
new file mode 100644
--- /dev/null
+++ b/toolkit/components/places/tests/browser/bug_399606/399606-location.reload.html
@@ -0,0 +1,11 @@
+<html>
+<head>
+<title>location.reload()</title>
+<script>
+setTimeout('location.reload();', 100);
+</script>
+</head>
+<body>
+Testing location.reload();
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/toolkit/components/places/tests/browser/bug_399606/399606-location.replace.html
@@ -0,0 +1,11 @@
+<html>
+<head>
+<title>location.replace</title>
+<script>
+setTimeout('location.replace(window.location.href)', 1000);
+</script>
+</head>
+<body>
+Testing location.replace
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/toolkit/components/places/tests/browser/bug_399606/399606-window.location.href.html
@@ -0,0 +1,11 @@
+<html>
+<head>
+<title>window.location.href</title>
+<script>
+setTimeout('window.location.href = window.location.href', 1000);
+</script>
+</head>
+<body>
+Testing window.location.href
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/toolkit/components/places/tests/browser/bug_399606/399606-window.location.html
@@ -0,0 +1,11 @@
+<html>
+<head>
+<title>window.location</title>
+<script>
+setTimeout('window.location = window.location', 1000);
+</script>
+</head>
+<body>
+Testing window.location
+</body>
+</html>