1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/components/places/tests/browser/browser_notfound.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,44 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +function test() { 1.9 + waitForExplicitFinish(); 1.10 + 1.11 + gBrowser.selectedTab = gBrowser.addTab(); 1.12 + registerCleanupFunction(function() { 1.13 + gBrowser.removeCurrentTab(); 1.14 + }); 1.15 + const TEST_URL = "http://mochi.test:8888/notFoundPage.html"; 1.16 + // Used to verify errors are not marked as typed. 1.17 + PlacesUtils.history.markPageAsTyped(NetUtil.newURI(TEST_URL)); 1.18 + gBrowser.selectedTab.linkedBrowser.loadURI(TEST_URL); 1.19 + 1.20 + // Create and add history observer. 1.21 + let historyObserver = { 1.22 + onVisit: function (aURI, aVisitID, aTime, aSessionID, aReferringID, 1.23 + aTransitionType) { 1.24 + PlacesUtils.history.removeObserver(historyObserver); 1.25 + info("Received onVisit: " + aURI.spec); 1.26 + fieldForUrl(aURI, "frecency", function (aFrecency) { 1.27 + is(aFrecency, 0, "Frecency should be 0"); 1.28 + fieldForUrl(aURI, "hidden", function (aHidden) { 1.29 + is(aHidden, 0, "Page should not be hidden"); 1.30 + fieldForUrl(aURI, "typed", function (aTyped) { 1.31 + is(aTyped, 0, "page should not be marked as typed"); 1.32 + promiseClearHistory().then(finish); 1.33 + }); 1.34 + }); 1.35 + }); 1.36 + }, 1.37 + onBeginUpdateBatch: function () {}, 1.38 + onEndUpdateBatch: function () {}, 1.39 + onTitleChanged: function () {}, 1.40 + onDeleteURI: function () {}, 1.41 + onClearHistory: function () {}, 1.42 + onPageChanged: function () {}, 1.43 + onDeleteVisits: function () {}, 1.44 + QueryInterface: XPCOMUtils.generateQI([Ci.nsINavHistoryObserver]) 1.45 + }; 1.46 + PlacesUtils.history.addObserver(historyObserver, false); 1.47 +}