toolkit/components/places/tests/browser/browser_notfound.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
michael@0 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 function test() {
michael@0 6 waitForExplicitFinish();
michael@0 7
michael@0 8 gBrowser.selectedTab = gBrowser.addTab();
michael@0 9 registerCleanupFunction(function() {
michael@0 10 gBrowser.removeCurrentTab();
michael@0 11 });
michael@0 12 const TEST_URL = "http://mochi.test:8888/notFoundPage.html";
michael@0 13 // Used to verify errors are not marked as typed.
michael@0 14 PlacesUtils.history.markPageAsTyped(NetUtil.newURI(TEST_URL));
michael@0 15 gBrowser.selectedTab.linkedBrowser.loadURI(TEST_URL);
michael@0 16
michael@0 17 // Create and add history observer.
michael@0 18 let historyObserver = {
michael@0 19 onVisit: function (aURI, aVisitID, aTime, aSessionID, aReferringID,
michael@0 20 aTransitionType) {
michael@0 21 PlacesUtils.history.removeObserver(historyObserver);
michael@0 22 info("Received onVisit: " + aURI.spec);
michael@0 23 fieldForUrl(aURI, "frecency", function (aFrecency) {
michael@0 24 is(aFrecency, 0, "Frecency should be 0");
michael@0 25 fieldForUrl(aURI, "hidden", function (aHidden) {
michael@0 26 is(aHidden, 0, "Page should not be hidden");
michael@0 27 fieldForUrl(aURI, "typed", function (aTyped) {
michael@0 28 is(aTyped, 0, "page should not be marked as typed");
michael@0 29 promiseClearHistory().then(finish);
michael@0 30 });
michael@0 31 });
michael@0 32 });
michael@0 33 },
michael@0 34 onBeginUpdateBatch: function () {},
michael@0 35 onEndUpdateBatch: function () {},
michael@0 36 onTitleChanged: function () {},
michael@0 37 onDeleteURI: function () {},
michael@0 38 onClearHistory: function () {},
michael@0 39 onPageChanged: function () {},
michael@0 40 onDeleteVisits: function () {},
michael@0 41 QueryInterface: XPCOMUtils.generateQI([Ci.nsINavHistoryObserver])
michael@0 42 };
michael@0 43 PlacesUtils.history.addObserver(historyObserver, false);
michael@0 44 }

mercurial