Skip to content

Commit

Permalink
Bug 734044 - Let livemarks skip the cache and avoid polluting tests a…
Browse files Browse the repository at this point in the history
…fter test_reloadLivemarks.xul

r=dietrich
  • Loading branch information
mak77 committed Mar 9, 2012
1 parent e203865 commit e9e35b8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion toolkit/components/places/nsLivemarkService.js
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ Livemark.prototype = {
QueryInterface(Ci.nsIHttpChannel);
channel.loadGroup = loadgroup;
channel.loadFlags |= Ci.nsIRequest.LOAD_BACKGROUND |
Ci.nsIRequest.VALIDATE_ALWAYS;
Ci.nsIRequest.LOAD_BYPASS_CACHE;
channel.requestMethod = "GET";
channel.setRequestHeader("X-Moz", "livebookmarks", false);

Expand Down
22 changes: 14 additions & 8 deletions toolkit/components/places/tests/chrome/test_reloadLivemarks.xul
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<window title="Reload Livemarks"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTest()">
onload="runTest()" onunload="cleanup()">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>

Expand Down Expand Up @@ -42,12 +42,6 @@ let gLivemarks = [
function runTest()
{
if (navigator.platform.indexOf("Lin") != -1) {
ok(true, "Bug 734044: This test is disabled on Linux for random timeouts.");
SimpleTest.finish();
return;
}
addLivemarks(function () {
reloadLivemarks(false, function () {
reloadLivemarks(true, function () {
Expand Down Expand Up @@ -132,11 +126,23 @@ resultObserver.prototype = {
if (this._livemark.status == Ci.mozILivemark.STATUS_LOADING)
return;
this._livemark.unregisterForUpdates(this._node);
this._terminate();
this._callback();
},
_terminate: function () {
if (!this._terminated) {
this._livemark.unregisterForUpdates(this._node);
this._terminated = true;
}
}
};
function cleanup() {
gLivemarks.forEach(function(aLivemarkData) {
if (aLivemarkData._observer)
aLivemarkData._observer._terminate();
});
}
]]>
</script>
</window>

0 comments on commit e9e35b8

Please sign in to comment.