summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/general/browser_PageMetaData_pushstate.js
diff options
context:
space:
mode:
Diffstat (limited to 'browser/base/content/test/general/browser_PageMetaData_pushstate.js')
-rw-r--r--browser/base/content/test/general/browser_PageMetaData_pushstate.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/browser/base/content/test/general/browser_PageMetaData_pushstate.js b/browser/base/content/test/general/browser_PageMetaData_pushstate.js
new file mode 100644
index 000000000..6f71c57a3
--- /dev/null
+++ b/browser/base/content/test/general/browser_PageMetaData_pushstate.js
@@ -0,0 +1,29 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+add_task(function* () {
+ let rooturi = "https://example.com/browser/toolkit/modules/tests/browser/";
+ yield BrowserTestUtils.openNewForegroundTab(gBrowser, rooturi + "metadata_simple.html");
+ yield ContentTask.spawn(gBrowser.selectedBrowser, { rooturi }, function* (args) {
+ let result = PageMetadata.getData(content.document);
+ // Result should have description.
+ Assert.equal(result.url, args.rooturi + "metadata_simple.html", "metadata url is correct");
+ Assert.equal(result.title, "Test Title", "metadata title is correct");
+ Assert.equal(result.description, "A very simple test page", "description is correct");
+
+ content.history.pushState({}, "2", "2.html");
+ result = PageMetadata.getData(content.document);
+ // Result should not have description.
+ Assert.equal(result.url, args.rooturi + "2.html", "metadata url is correct");
+ Assert.equal(result.title, "Test Title", "metadata title is correct");
+ Assert.ok(!result.description, "description is undefined");
+
+ Assert.equal(content.document.documentURI, args.rooturi + "2.html",
+ "content.document has correct url");
+ });
+
+ is(gBrowser.currentURI.spec, rooturi + "2.html", "gBrowser has correct url");
+
+ gBrowser.removeTab(gBrowser.selectedTab);
+});