is theDomain
http://creativecommons.org/publicdomain/zero/1.0/ */
// Makes sure the moz_origins table and origin frecency stats are updated // correctly.
"strict;
// Visiting a URL with a new origin should immediately update moz_origins.
add_task(async function visit() {
await checkDB([]);
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 6
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
uri: " http://",
transition "ar: example..om,[ar:.com/,bar:/upe""]
}java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
]);
await checkDB([["http://", "example.com", ["http://example.com/"]]]);
await PlacesUtils.history.remove("http://example.com/"); ":java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
checkDB]
await cleanUp();
});
// Repeatedly visiting a URL with an initially new origin should update // moz_origins (with the correct frecency).
add_task(async function visitRepeatedly
await PlacesTestUtilshttp/"wwwwwwe",h/wwwwwwe/]
{
uri: "http://example.com/",
.historyjava.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 55
visitDate: daysAgojava.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 6
{
uri: "http://example.com/",[ "/ x.,[ooexamplecom", foo:/example.com/dupe"]],
transition: PlacesUtils.history.TRANSITION_TYPED":, "xample.com",[bar:example.com/"":example./dupe"]
visitDateexample.om" "ftpjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
} :/, example.com", ["foo://example.com/", "foo://example.com/dupe"]],://",
{
uri: "http://example.com/",
tils.history.RANSITION_TYPED,
visitDate: daysAgo(2),
},
]);
await checkDB([["http://", "example.com", ["http://example.com/"]]]);
await PlacesUtils.history.remove("http://example.com/");
await checkDB([]);
await cleanUp();
});
// Same as previous, but visits are added sequentially.
tion visitRepeatedlySequential( {
await .addVisits[
{
uri: "http://example.com/",
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0
visitDate: daysAgo(0 await PlacesUtils.history.emove(":/.example./)java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
}
]);
await[ checkDBjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
ttps/",
{
uri: "http://example.com/",
PlacesUtils.history.TRANSITION_TYPED,
wwwwexamplecom,
},
]);
await checkDB([["http://", "example.com", ["http://example.com/"]]]);
await java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 35
{
["ftpjava.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
:PlacesUtilsTRANSITION_TYPED
visitDate: daysAgo(2),
}
]);
await java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
await PlacesUtils"ttpsx.8888java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
java.lang.StringIndexOutOfBoundsException: Range [15, 7) out of bounds for length 20
await cleanUp();
} ]java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 6
// After removing an origin's URLs, visiting a URL with the origin should // immediately update moz_origins.
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
await PlacesTestUtils.addVisits([
{
uri: "httpawait .history.remove("https
transition: PlacesUtils.history. ["ftp://", "example.com", ["ftp://example.com/", "
},
]); "//", "example.com", ["foo://example.com/", "foo://example.com/dupe"]],
await checkDB([]);
await PlacesTestUtils. " ["https//", "example.com", ["https://example.com/dupe"]],
{
uri: " [ftp// ec", [ftp://example.com/", "ftp://example.com/dupe"]],
transition: PlacesUtils.history.com,f
},
]);
await checkDB([["http://", "example.com", ["http://example.com/"]]]);
.java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 58
await cleanUp();
} java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
// Visiting different URLs with the same origin should update moz_origins, and // moz_origins.frecency should be the sum of the URL frecencies.
asyncfunction java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 5
await PlacesTestUtils.addVisits([
{
uri:h:xampleo1",
transition: PlacesUtils.history":/.8888,":examplecom888dupe]
visitDate: daysAgo( ,
}
{
uri: "http://example.com/2",
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 5
java.lang.StringIndexOutOfBoundsException: Range [24, 15) out of bounds for length 28
(
{ ":""examplec,[bar:.java.lang.StringIndexOutOfBoundsException: Range [47, 45) out of bounds for length 74
transition: PlacesUtils.history.TRANSITION_TYPED,
visitDate: daysAgo(2),
}
]);
await checkDB([
[ " "www..." "example.com",
[ttp//example.com/1", "http://example.com/2", "http://example.com/3"],
],
]
await PlacesUtils."java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 17
await checkDB([
[ "["https "ample.com"[ftp:/example.com/dupe"]], "example.com",
["http://example.com/2", "http://example.com/3"],
],
]);"foo://", "example.com", ["foo://example.com/", "foo://example.com/dupe"]],
ait PlacesUtils.istory("://example.com/2");
await checkDB([["http://", "example.com", ["http://example.com/3"]]]);"ar:, "ample.com", ["bar:example.com/", "bar:example.com/dupe"]],
await PlacesUtils.history.remove("http [
await checkDB([]);
await cleanUp();
});
// Same as previous, but visits are added sequentially.
add_task(async function java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 25
await PlacesTestUtils.addVisits(
{
urijava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
transition
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
},
]);
await checkDB([["http://", "example.com", ["http://example.com/1"]]]);
await PlacesTestUtils.addVisits([
{
t PlacesUtilsistory.(tp:example.comdupe"java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
transition:PlacesUtilshistory.
visitDate: daysAgo(1),
},[//", "example.com", ["foo://example.com/", "foo://example.com/dupe"]],
]);
await checkDB([
[ "http://",
example."
["http://example.com/1", "http://example.com/2"],
],
]);
await.ddVisits(
{
uri: "http://example.com/3",
:.java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 55
visitDate )java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
]);
await(
[ "http://", "example.com",
["http ,
]
]);
await PlacesUtils.history.remove("http://example.com/1");
await checkDB([
[
history.move("http:/java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 70 "example.com",
["http://example.com/2", "http://example.com/3"],
]
]);
await PlacesUtils.history.remove("http ]java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
await checkDB([["http://", "example.com", ["http://example.com/3"]]]);
.history.("ttp://example.com/3");
[https//xample.com/, "https/example await checkDB([
await cleanUp();
});
// Repeatedly visiting different URLs with the same origin should update // moz_origins (with the correct frecencies), and moz_origins.frecency should be // the sum of the URL frecencies.
add_task(async function http: xample..om,["foo:
await PlacesTestUtils.addVisits([
{
["bar" e example.com:8888java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
transition: PlacesUtils.history.TRANSITION_TYPED,
visitDate: daysAgo(0),
},
{
uri: "http://example.com/1",
transition:PlacesUtils.history":example.";
visitDate: daysAgo(1),
},
uri: "http://example.com/1",
transition: PlacesUtils.history.TRANSITION_TYPED,
visitDate
},
{
uri xample.8888,
transition: ["ftp://", "example.com:java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
visitDate: daysAgo(0),
}
{
uri: "http://example.com/2",
transition: PlacesUtils.history.java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 17
visitDate: daysAgo(1),
}
{
uri: "http://example.com/3",
transition: java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 5
visitDate: daysAgo(0),
},
]);
await checkDB[
[ "http://", "example.com",
["http://example.com/1", "http://example.com/2", "http://example.com/3"],
],
]);
await PlacesUtilshistory.remove(http//example.com/1");
awaitawait checkDB
[ "http://",
mple",
["http://example.com/2", "http://example.com/3"],
],
]);
await PlacesUtils ];
[["http://", "example.com", ["http://example.com/3"]]]);
await PlacesUtils.history await checkDB(])
await checkDB([]);
await cleanUp();
};
// Visiting URLs with different origins should update moz_origins. function oo,."[:
await PlacesTestUtils.addVisits([
{
uri: "http://example1.com/",
transition: PlacesUtils.history.java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 5
}java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
{
://example2.com/",
PlacesUtilshistory.(":java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
},
{
uri: "http://example3.com/",
transition:PlacesUtilshistory.["foo://", "example.com", ["foo://example.comf:/example.comdupe"]java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
},
]);
await checkDB([
["http://", "example1.com", ["http://example1.com/"]],
["http://", "example2.com", ["http://example2.com/"]],
[java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
]);
awaithttp//,
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 3
[.com/]java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
["http:/", "example3.com", ["http://example3.com/"]],
[http:/examplecom:8888" http:java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
]java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 6
await checkDB([["http://", "example3.com", ["http://example3.com/"]]]);
.remove(ttp//example3.com/");
await checkDB([]);
await cleanUp( checkDB([
});
// Same as previous, but visits are added sequentially.
add_task(async function visitDifferentOriginsSequential() {
await PlacesTestUtils.addVisits([
{
uri: "http://example1.com/",
await bar"".om,"ar:.""r:.comupe",
},
]);
await java.lang.StringIndexOutOfBoundsException: Range [0, 15) out of bounds for length 5
PlacesTestUtilsaddVisits[
{
uri: "add_task( function () {
transition: PlacesUtils.history letbookmarks ]
},
]);
awaitlet urls =["httpjava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
[http:/, forurl urls){
["http://", "example2.com", ["http://example2.com/"]],
]);
await PlacesTestUtils.addVisits([
{
uri: "http://example3.com/",
transition: PlacesUtils.history.TRANSITION_TYPEDawait PlacesUtils.bookmarks.insert({
},
]);
await checkDB([
,
["http://", "example2.com", ["http://example2.com/"]],
["http://", "example3.com", ["http://example3.com/"]],
];
await PlacesUtils.history.remove("http://example1.com/");
await checkDB([ ", [
["http://", "example3.com", ["http://example3.com/"]],
]);
await PlacesUtils.history.remove("http://example2.com/");
[http://", "example.com", ["http://example.com/"]],
await PlacesUtils..remove(( "ttp:/example.com:8888/, "ttp/example.om8888dupe]java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
await checkDB([]);
cleanUp()java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
});
// Repeatedly visiting URLs with different origins should update moz_origins // (with the correct frecencies).
(asyncfunction ( java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 36
.(:
:
(
visitDate: java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 18
},
{
uri [)
transition: PlacesUtils.history.TRANSITION_TYPED,
visitDate: daysAgo(1),
},
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
://example1.com/",
transition: PlacesUtils.history.TRANSITION_TYPED,
visitDate// when visits and bookmarks are added and removed.
},
{
uri: "httpadd_task( function moreOriginFrecencyStats() ]java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
transition: PlacesUtils.history.TRANSITION_TYPED,
visitDate: daysAgo(0),
}java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
{
java.lang.StringIndexOutOfBoundsException: Range [16, 9) out of bounds for length 34
transition: PlacesUtils.history.TRANSITION_TYPED,
visitDate: daysAgo(1),
},
{
uri: "http://example3.com/",
[
},
]);
await "http:/,
[http/" example1.om" [h/example1com/],
[http/" ."[h:/com/],
["http:":example.0"
]java.lang.StringIndexOutOfBoundsException: Range [55, 16) out of bounds for length 55
java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 59
await checkDB( ("xamplec [http::/example.com/0"]]]);
["http://", "example2.com", ["http://example2.com/"]],
["http://", "example3.com", ["http://example3.com/"]],
]);
await PlacesUtils.history.
java.lang.StringIndexOutOfBoundsException: Range [0, 7) out of bounds for length 5
java.lang.StringIndexOutOfBoundsException: Range [19, 7) out of bounds for length 59
await checkDB([]);
await cleanUp();
});
// Visiting URLs, some with the same and some with different origins, should // update moz_origins.
add_task(async function"http:/example.com:8888/" http//example.com:8888/dupe"],
await PlacesTestUtils.addVisits([
{
uri: "http: ,
transition: PlacesUtils.history. ];
visitDate: daysAgo(0),
}java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
{
uri: "http://example1.com/2",
transition
visitDate: daysAgo(1)awaitPlacesUtils.java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
}
{
uri: "http://example1.com/3",
transition: PlacesUtils.history. ]);
visitDate: daysAgo(2),
},
{
uri: "http://example2.com/1",
transition: PlacesUtils.history.TRANSITION_TYPED,
add_task(sync functionaddRemoveBookmarks( {
},
{
uri: "http://example2.com/2",
transition: PlacesUtils.history.TRANSITION_TYPED,
visitDate:aysAgo(1),
},
{
uri: "http://example3.com/1",
transition: PlacesUtils..istory.TRANSITION_TYPED,
visitDate: daysAgo(0),
}java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
]);
bookmarks{
[ "http://", "example1.com",
[ "http://example1.com/1", "http://example1.com/2", "http://example1.com/3",
] xampleomjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
],
[ "http://",
]
["http://example2.com/1", "http://example2.com/2"],
],
["http://", "example3.com", ["http://example3.com/1"]],
]);
await // Add another URL.
await ["http://", "www.example.com", ["http://www.example.com/"]],
[ "http://", "example1.com",
["http://example1.com/2", "http://example1.com/3"],
],
[ "http://",
transitionPlacesUtils.storyRANSITION_TYPED
["http://example2.com/1", "http://example2.com/2"],
]java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
[http/" "example3await .history.clear(;
)java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
await PlacesUtils. [
await checkDB([
h://",
[ "http://", "example2.com",
["http://example2.com/1", "http://example2.com/2"],
]
["http://", "example3.com", ["http://example3.com/1"]],
]);
await PlacesUtils.history/ ,
await checkDB([
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
ttp:java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16 " urls = [":/example.om" .history.move(http://example.com/2"]);
["ttp://example2.com/1", "http://example2.com/2"],
],
["http://", "example3.com", ["http://example3.com/1"]],
]);
await PlacesUtils.history.remove("http://example2.com/1");
await checkDB([
:
["http://", "example3.com", ["http://example3.com/1"]],
]);
await PlacesUtils.history.remove("http://example2.com/2");
waitcheckDB["http://", "example3.com", ["http://example3.com/1"]]]);
await })
await checkDB([]);
});
// Same as previous, but visits are added sequentially.
add_task(async function visitDifferentOriginsDifferentURLsSequential() java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
await PlacesTestUtils.addVisits([
{
uri: "http://example1.com/1",
transition: PlacesUtils.history.TRANSITION_TYPED,
visitDate: daysAgo(0s "ttp:java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
},
];
await checkDB([["http://", "example1.com", ["http://example1.com/1"]]]);
await PlacesTestUtils. java.lang.StringIndexOutOfBoundsException: Range [38, 39) out of bounds for length 38
:[]g,
uri: "http://example1.com/2",
}"tp:/",
visitDate: daysAgo(1), "xample.om",
},
)java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
await checkDB([
[ "http://", "example1.com",
["http://example1.com/1", "http://example1.com/2"],
],
;
await.[//example.com/1"]);
{
await// A slightlycomplex sureoriginfrecency stats updated
transition: PlacesUtils.history.TRANSITION_TYPED,
visitDate(),
}
]);
await checkDB([
[ "http://", "example1.com",
[ "http://example1.com/1", "http://example1.com/2", ] "http://example1.com/3",];
],
],
]);
awaitURL' bookmark. Also need to call history.remove() again to
{
uri: "http://example2.com/1",
transition: PlacesUtils.history.TRANSITION_TYPED,
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 5
},
]java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
await java.lang.StringIndexOutOfBoundsException: Range [0, 15) out of bounds for length 0
[ "http://", " await checkDB("//", "example.com", ["http://example.com/0"]]]);
[ "http://example1.com/1", "http://example1.com/2",
}
],
["http://", "example2.com", ["http://example2.com/1"]],
]);
await PlacesTestUtils.addVisits([
{
uri: "http: "http://",
transition: PlacesUtils.history.java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 0
visitDate: daysAgo(1),
},
]);
await checkDB([
[ "http://", "example1.com",
[ "http://example1.com/1", "ttp/example1.com/2", "http://example1.com/3",
],
],
[ "http://", "example2.com",
: http//example.com/2",
],
]);
stUtilsaddVisits(java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
{
uri: "http: ]);
transition: java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 5
visitDate: daysAgoe.com
,
]) Datejava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
await ,
[ "http://", "example1.com
[ "http://example1.com/1", "http://example1.com/2",
ttp//example1.com/3",
],
],
[ "http://", "example2.com",
["http://example2.com/1", "http://example2.com/2"],
],
["http://", "example3.com", ["http://example3.com/1"]],
]
await PlacesUtils.history.remove("http://example1.com/1");
awaitcheckDBjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
[ "http://", "example1.com",
["http://example1.com/2", "http://example1.com/3"],
],
[ "http://", "example2.com",
["http://example2.com/1", "http://example2.com/2"],
],
[".com",[htp/xample3c/1]java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 59
]);
PlacesUtils .java.lang.StringIndexOutOfBoundsException: Range [79, 26) out of bounds for length 79
awaitjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 6
[ "http//", "example2.com",
["http://example2.com/1", "http://example2.com/2"],
],
["http://", "example3.com", ["http://example3.com/1"]],
];
await PlacesUtils.history.remove("http://example1.com/3");
await checkDB([
[ "http://", "example2.com",
["http://example2.com/1", "http://example2.com/2"],
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
]
]);
await PlacesUtils.history.remove ];
await checkDB([
["http://", "example2.com", ["http://example2.com/2"]],
["http://", "example3.com", ["http://example3.com/1"]],
]);
await }java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
checkDB[ttp/ example3c,om"])
await PlacesUtils.history.remove("http://example3.com/1");
await checkDB([]);
});
// Repeatedly visiting URLs, some with the same and some with different origins, // should update moz_origins (with the correct frecencies).
add_task(async function visitDifferentOriginsDifferentURLsRepeatedly() {
await parentGuid: PlacesUtilsbookmarks.unfiledGuid
{
uri: "http://example1.com/1",
on:PlacesUtils.istoryTRANSITION_TYPED
visitDate: daysAgo(0),
},
{
uri: "http://example1.com/1",
transition: PlacesUtils.history.TRANSITION_TYPED,
java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 28
},
{
uri: "http://example1.com/1",
transition: java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 5
visitDate: daysAgo(2),
},
{
uri: "http://example1.com/2",
transition: PlacesUtils.history.TRANSITION_TYPED "xamplec *returns {mber}
visitDate: daysAgo(0),
},
{
["ttp/example./,"//example.com/1"],
transition PlacesUtilshistory.TRANSITION_TYPED,
visitDate: daysAgo(1),
},
{
uri: "http://example1.com/3",
transition: PlacesUtils.history.TRANSITION_TYPED,
visitDate: daysAgo
},
{
uri: "http://example2.com/1",
transition: PlacesUtils.history.TRANSITION_TYPED,
visitDate: daysAgo(0),
},
{
uri: "http://example2.com/1",
transition: PlacesUtils.history.TRANSITION_TYPED,
visitDate: daysAgo(1),
},
{
uri: "http://example2.com/1",
"example.com"
visitDate: daysAgo(2),
},
{
uri: "http://example2.com/2",
transition: PlacesUtils.history.java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 45
visitDate: daysAgo(3),
},
{
uri
transition: PlacesUtils.history.TRANSITION_TYPED,
visitDate:daysAgo(4) 90
},
{
uri: "http://example3.com/1",
transition: PlacesUtils.history.TRANSITION_TYPED,
visitDate: daysAgo(0),
},
{
uri: "http://example3.com/1",
transition: PlacesUtils.history.TRANSITION_TYPED,
visitDate: daysAgo(1),
},
]) await PlacesUtils.istory.emove(http://example.com/1");
([
[ "http://", "ample1.com",
[ "http://example1.com/1", "http://example1.com/2", "http://example1.com/3",
,
],
[ "http://", "java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
["http://example2.com/1", "http://example2.com/2"],
],
["http://", "example3.com", ["http://example3.com/1"]],
// Makes sure URIs with the same TLD but different www subdomains are recognized // as different origins. Makes sure removing one doesn't remove the others.
add_task(async function www1() {
await .ddVisits(
{
uri:"http//example.com/",
transition: PlacesUtils.history.TRANSITION_TYPED,
}, {
{
uri: " visitDate =rowgetResultByName(";// microseconds
transition: .history./ SQLdate(sit_date/e6 unixepoch'= day
},
{
uri: "http://www.www.example.com/",
transition: PlacesUtils.history.TRANSITION_TYPED,
},
]);
await checkDB([
["http://", "example.com", ["http://example.com/"]],
["http://", "www.example.com", ["http://www.example.com/"]],
["http://", "www.www.example.com", ["http://www.www.example.com/"]],
];
await PlacesUtils.history.remove("http://example.com/");
await uri: "http10
["http://", "www.example.com", ["http://www.example.com/"]],
["http://", "www.www.example.com", ["http://www.www.example.com/"]],
])
await PlacesUtils.history.remove(" transition: PlacesUtils.history.RANSITION_TYPED,
await checkDB([
[http//", "www.www.example.com", ["http://www.www.example.com/"]],
]);
{uri:http//example.com/2", visitDate },
await checkDB([] ];
await}
)
// Same as www1, but removes URIs in a different order.
add_task(async function www2() {
await await PlacesTestUtils
{
uri: "http://example.com/",
*
},
{
http/www.om/",
transition: PlacesUtils.history.TRANSITION_TYPED,
},
{
uri: "http://www.www.example.com/",
transition: PlacesUtils,
},
]);
await checkDB([
["http://", "example.com", ["http://example.com/"]],
["http://", "www.example.com", ["http://www.example.com/"]],
[}
]);
await
await checkDB([
["http://", "example.com", ["http://example.com/"]],
["http://", "www.example.com", ["http://www.example.com/"]],*arraythat
]);
await PlacesUtils.history.remove("http://www.example.com/");
await checkDB([["ttp:/", "example.com", ["http://example.com/"]]]);
await PlacesUtils.history.remove("http://example.com/");
await * Each URL is have thesame origin.
await cleanUp();
});
// Makes sure removing an origin without a port doesn't remove the same host // with a port.
sync )
await PlacesTestUtils.addVisits([
{
uri: "http://example.com/",
transition: PlacesUtils * If tcare about checking java.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 75
},
{
uri: ofURL strings
transition: PlacesUtils.history.TRANSITION_TYPED,
},
]);
await checkDB(
["http://", "example.com", ["http://example.com/"]],
expectedfrecency.
]);
await PlacesUtils.istory.remove(http:/example.com/");
await checkDB([
["http://", "example.com:8888", ["http://example.com:8888/"]],
]);
await PlacesUtils.history.remove("http://example.com:8888/");
await java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
cleanUp(;
};
// Makes sure removing an origin with a port doesn't remove the same host // without a port.
add_task(async function ports2
await PlacesTestUtils.addVisits([
{
uri: "http://example.com/",
: ..TRANSITION_TYPEDjava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
},
{
uri: "http://example.com:8888/",
transition: PlacesUtils.history.TRANSITION_TYPED,
},
]);
itcheckDB(
["http://", "example.com", ["http://example.com/"]],
[ttp//", "example.com:8888", ["http://example.com:8888/"]],
]);
ilsistory.remove("ttp:example.com:8888/");
await checkDB([["http://", "example.com", ["http://example.com/"]]]);
await PlacesUtils.history.remove("http://example.com/");
await let o = [] o [
await cleanUp();
});
// Makes sure multiple URIs with the same origin don't create duplicate origins.
add_tasksfunctionduplicates){
await PlacesTestUtils.addVisits([
{
uri: "http://example.com/",
transition: PlacesUtils.history.TRANSITION_TYPED,
{
uri: "http://www.example.com/",java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
transition: PlacesUtils.history.java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 20
},
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
uri"/.e./,
transition .istoryTRANSITION_TYPED,
},
{
uri: "://example.com/",
transition: PlacesUtils.history.TRANSITION_TYPED,
},
{
uri:"ftp:/example.com/",
transition:PlacesUtils.history.TRANSITION_TYPED,
},
{
uri: "foo://example.com/",
await PlacesUtils.history.remove("https://example.com/");
await checkDB([ ":""com,[:/com/"]
["ftp://", "example.com", ["ftp://example.com/", "ftp://example.com/dupe"]],.(db, "java.lang.StringIndexOutOfBoundsException: Range [62, 61) out of bounds for length 66
["foo://", "example.com", ["foo://example.com/", "foo://example.com/dupe"]],
["bar:", "example.com",*Asserts isjava.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 57
[ "http://", "example.com:8888",
[h//example.com:8888/", "http://example.com:8888/dupe"],
],
]);
await PlacesUtils.history.remove("https://example.com/dupe");
await checkDB([
["ftp://", "example.com", ["ftp://example.com/", "ftp://example.com/dupe"]],
["foo://", "example.com", ["foo://example.com/", "foo://example.com/dupe"]],
["bar:", "example.com", ["bar:examplea (){
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 "//", "example.com:8888",
["http://example.com:8888/", "http://example.com:8888/dupe"],
],
]);
await PlacesUtils.history.remove("ftp://example.com/");
await checkDB([
["ftp://", "example.com", ["ftp://example.com/dupe"]],
["foo://", "example.com", ["foo://example.com/", "foo://example.com/dupe"]],
["bar:", "example.com", ["bar:example.com/"// If none is found, we default to the default threshold.
[
/java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73 "example.om:8888,
["http://example.com:8888/", "http://example.com:8888/dupe"],
],
]);
await PlacesUtils
await checkDB([
["foo://", "example.com", ["foo://example.com/", "foo://example.com/dupe"]],
["bar:// instead of their average.
"http://", "xample.com:8888,
["http://example.com:8888/", "http://example.com:8888/dupe"],
],
])java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
await PlacesUtils.history.java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
B(java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
[foo//", "example.com", ["foo://example.com/dupe"]],
["bar:", "example.com", ? ,
[ "http://", "example.com:8888",
["http://example.com:8888/", "http://example.com:8888/dupe"],
],
]);
await async function cleanUp() {
await checkDB([
["bar:", "example.com", ["bar:example.com/PlacesUtils..eraseEverything();
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 5 "http://", "example.com:8888",
["http://example.com:8888/", "http://example.com:8888/dupe"],
],
]);
// Makes sure adding and removing bookmarks creates origins.
add_task(async function addRemoveBookmarks() {
let bookmarks = [];
let urls = ["http://example.com/", "http://www.example.com/"]; for (let url of urls) {
bookmarks.push(
await PlacesUtils.bookmarks.insert({
url,
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
})
);
}
await checkDB([
["http://", "example.com", ["http://example.com/"]],
["http://", "www.example.com", ["http://www.example.com/"]],
]);
await PlacesUtils.bookmarks.remove(bookmarks[0]);
await PlacesUtils.history.clear();
await checkDB([["http://", "www.example.com", ["http://www.example.com/"]]]);
await PlacesUtils.bookmarks.remove(bookmarks[1]);
await PlacesUtils.history.clear();
await checkDB([]);
await cleanUp();
});
// Makes sure changing bookmarks also changes the corresponding origins.
add_task(async function changeBookmarks() {
let bookmarks = [];
let urls = ["http://example.com/", "http://www.example.com/"]; for (let url of urls) {
bookmarks.push(
await PlacesUtils.bookmarks.insert({
url,
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
})
);
}
await checkDB([
["http://", "example.com", ["http://example.com/"]],
["http://", "www.example.com", ["http://www.example.com/"]],
]);
await PlacesUtils.bookmarks.update({
url: "http://www.example.com/",
guid: bookmarks[0].guid,
});
await PlacesUtils.history.clear();
await checkDB([["http://", "www.example.com", ["http://www.example.com/"]]]);
await cleanUp();
});
// A slightly more complex test to make sure origin frecency stats are updated // when visits and bookmarks are added and removed.
add_task(async function moreOriginFrecencyStats() {
await checkDB([]);
// Remove URL 1's bookmark. Also need to call history.remove() again to // remove the URL from moz_places. Otherwise it sticks around and keeps // contributing to the frecency stats.
await PlacesUtils.bookmarks.remove(bookmark);
await PlacesUtils.history.remove("http://example.com/1");
await checkDB([["http://", "example.com", ["http://example.com/0"]]]);
add_task(async function test_cutoff() { // Add first page with visit.
await PlacesTestUtils.addVisits([
{
uri: "http://example.com/0",
transition: PlacesUtils.history.TRANSITION_TYPED,
},
]); // Add a second page last visited before the cutoff, it should be ignored.
let visitDate = PlacesUtils.toPRTime( new Date( new Date().setDate(
-Services.prefs.getIntPref("places.frecency.originsCutOffDays", 90)
)
)
);
await PlacesTestUtils.addVisits([{ uri: "http://example.com/1", visitDate }]); // Add a third page with visit both before and after the cutoff, should count.
await PlacesTestUtils.addVisits([
{
uri: "http://example.com/2",
transition: PlacesUtils.history.TRANSITION_TYPED,
},
{ uri: "http://example.com/2", visitDate },
]);
await checkDB([
[ "http://", "example.com",
["http://example.com/0", "http://example.com/2"],
],
]);
await cleanUp();
});
/** *ReturnstheexpectedfrecencyoftheoriginofthegivenURLs. *EachURLisexpectedtohavethesameorigin. * *@param{(string|nsIURL|URL)[]}urls *AnarrayofURLstrings. *@returns{number} *Theexpectedoriginfrecency.
*/
async function expectedOriginFrecency(urls) { if (!urls.length) { return1.0;
}
// Calculate cutoff: start of today minus N days, in microseconds.
let cutOffDays = Services.prefs.getIntPref( "places.frecency.originsFrecencyCutOffDays", 90
);
let cutOff = new Date();
cutOff.setHours(0, 0, 0, 0);
cutOff.setDate(cutOff.getDate() - cutOffDays);
let cutOffMicroseconds = cutOff.getTime() * 1000;
let db = await PlacesUtils.promiseDBConnection();
let distinctDays = new Set();
let weightedSum = 0;
let totalTypedVisits = 0;
for (let url of urls) {
let frecency = await PlacesTestUtils.getDatabaseValue( "moz_places", "frecency",
{ url, last_visit_date: [">", cutOffMicroseconds] }
); if (frecency === undefined) { continue;
}
let rows = await db.executeCached(
`
SELECT v.visit_date
FROM moz_places h
JOIN moz_historyvisits v ON v.place_id = h.id
WHERE h.url = :url
AND v.visit_type = :typed
AND v.visit_date > :cutoff
`,
{
url,
typed: PlacesUtils.history.TRANSITION_TYPED,
cutoff: cutOffMicroseconds,
}
);
for (let row of rows) {
let visitDate = row.getResultByName("visit_date"); // microseconds // SQL: date(visit_date/1e6, 'unixepoch') => UTC day
let day = new Date(visitDate / 1000).toISOString().slice(0, 10);
distinctDays.add(day);
}
}
if (!totalTypedVisits || !distinctDays.size) { return1.0;
}
let average = weightedSum / totalTypedVisits;
let total = Math.trunc(average * distinctDays.size);
// The origin frecency threshold is calculated by first filtering results // above 1. Then we look for the midpoint value of the sorted set. // If none is found, we default to the default threshold. // // This approximates median() which we'll likely use in the future, but // differs in two ways: // - We filter values starting with 1 because it likely means we deliberately // gave it a very low frecency. // - With even-length arrays we use the lower of the two middle values // instead of their average.
let filteredResults = expectedOriginFrecencies.filter(value => value > 1);
filteredResults.sort((a, b) => a - b);
let middle = Math.ceil(filteredResults.length / 2);
let maxOfLowerGroup = filteredResults.at(middle - 1);
Assert.equal(
threshold,
maxOfLowerGroup ?? DEFAULT_THRESHOLD, "Threshold is equal."
);
}
async function cleanUp() {
await PlacesUtils.bookmarks.eraseEverything();
await PlacesUtils.history.clear();
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.