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