michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: gBrowser.selectedTab = gBrowser.addTab(); michael@0: registerCleanupFunction(function() { michael@0: gBrowser.removeCurrentTab(); michael@0: }); michael@0: const TEST_URL = "http://mochi.test:8888/notFoundPage.html"; michael@0: // Used to verify errors are not marked as typed. michael@0: PlacesUtils.history.markPageAsTyped(NetUtil.newURI(TEST_URL)); michael@0: gBrowser.selectedTab.linkedBrowser.loadURI(TEST_URL); michael@0: michael@0: // Create and add history observer. michael@0: let historyObserver = { michael@0: onVisit: function (aURI, aVisitID, aTime, aSessionID, aReferringID, michael@0: aTransitionType) { michael@0: PlacesUtils.history.removeObserver(historyObserver); michael@0: info("Received onVisit: " + aURI.spec); michael@0: fieldForUrl(aURI, "frecency", function (aFrecency) { michael@0: is(aFrecency, 0, "Frecency should be 0"); michael@0: fieldForUrl(aURI, "hidden", function (aHidden) { michael@0: is(aHidden, 0, "Page should not be hidden"); michael@0: fieldForUrl(aURI, "typed", function (aTyped) { michael@0: is(aTyped, 0, "page should not be marked as typed"); michael@0: promiseClearHistory().then(finish); michael@0: }); michael@0: }); michael@0: }); michael@0: }, michael@0: onBeginUpdateBatch: function () {}, michael@0: onEndUpdateBatch: function () {}, michael@0: onTitleChanged: function () {}, michael@0: onDeleteURI: function () {}, michael@0: onClearHistory: function () {}, michael@0: onPageChanged: function () {}, michael@0: onDeleteVisits: function () {}, michael@0: QueryInterface: XPCOMUtils.generateQI([Ci.nsINavHistoryObserver]) michael@0: }; michael@0: PlacesUtils.history.addObserver(historyObserver, false); michael@0: }