diff --git a/browser/components/places/tests/browser/Makefile.in b/browser/components/places/tests/browser/Makefile.in index 6b757ece288..736870c5cbf 100644 --- a/browser/components/places/tests/browser/Makefile.in +++ b/browser/components/places/tests/browser/Makefile.in @@ -64,6 +64,7 @@ _BROWSER_TEST_FILES = \ browser_library_views_liveupdate.js \ browser_views_liveupdate.js \ browser_sidebarpanels_click.js \ + sidebarpanels_click_test_page.html \ browser_library_infoBox.js \ $(NULL) diff --git a/browser/components/places/tests/browser/browser_sidebarpanels_click.js b/browser/components/places/tests/browser/browser_sidebarpanels_click.js index 02654814205..e390e8656b7 100644 --- a/browser/components/places/tests/browser/browser_sidebarpanels_click.js +++ b/browser/components/places/tests/browser/browser_sidebarpanels_click.js @@ -59,7 +59,7 @@ function test() { toggleSidebar(); } - const TEST_URL = "javascript:alert(\"test\");"; + const TEST_URL = "http://mochi.test:8888/browser/browser/components/places/tests/browser/sidebarpanels_click_test_page.html"; let tests = []; tests.push({ @@ -87,8 +87,10 @@ function test() { init: function() { // Add a history entry. this.cleanup(); - hs.addVisit(PlacesUtils._uri(TEST_URL), Date.now() * 1000, - null, hs.TRANSITION_TYPED, false, 0); + let uri = PlacesUtils._uri(TEST_URL); + hs.addVisit(uri, Date.now() * 1000, null, hs.TRANSITION_TYPED, false, 0); + let gh = hs.QueryInterface(Ci.nsIGlobalHistory2); + ok(gh.isVisited(uri), "Item is visited"); }, prepare: function() { sidebar.contentDocument.getElementById("byvisited").doCommand(); diff --git a/browser/components/places/tests/browser/sidebarpanels_click_test_page.html b/browser/components/places/tests/browser/sidebarpanels_click_test_page.html new file mode 100644 index 00000000000..c73eaa54036 --- /dev/null +++ b/browser/components/places/tests/browser/sidebarpanels_click_test_page.html @@ -0,0 +1,7 @@ + + + browser_sidebarpanels_click.js test page + + + + diff --git a/toolkit/components/places/src/nsNavHistory.cpp b/toolkit/components/places/src/nsNavHistory.cpp index f00c49f6902..bf49930508d 100644 --- a/toolkit/components/places/src/nsNavHistory.cpp +++ b/toolkit/components/places/src/nsNavHistory.cpp @@ -2691,7 +2691,8 @@ nsNavHistory::CanAddURI(nsIURI* aURI, PRBool* canAdd) scheme.EqualsLiteral("view-source") || scheme.EqualsLiteral("chrome") || scheme.EqualsLiteral("data") || - scheme.EqualsLiteral("wyciwyg")) { + scheme.EqualsLiteral("wyciwyg") || + scheme.EqualsLiteral("javascript")) { *canAdd = PR_FALSE; return NS_OK; } diff --git a/toolkit/components/places/tests/autocomplete/test_417798.js b/toolkit/components/places/tests/autocomplete/test_417798.js index f41ee909303..851c7389b6f 100644 --- a/toolkit/components/places/tests/autocomplete/test_417798.js +++ b/toolkit/components/places/tests/autocomplete/test_417798.js @@ -49,7 +49,8 @@ let kTitles = [ ]; addPageBook(0, 0); // regular url -addPageBook(1, 0); // javascript: uri +// javascript: uri as bookmark (no visit) +addPageBook(1, 0, 0, undefined, undefined, undefined, true); // Provide for each test: description; search terms; array of gPages indices of // pages that should match; optional function to be run before the test