зеркало из https://github.com/mozilla/gecko-dev.git
Merge autoland to mozilla-central. a=merge
This commit is contained in:
Коммит
9ba416fb81
|
@ -124,8 +124,14 @@ this.menusInternal = class extends ExtensionAPI {
|
||||||
onClickedProp.setListener(createProperties.id, onclick);
|
onClickedProp.setListener(createProperties.id, onclick);
|
||||||
}
|
}
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback();
|
context.runSafeWithoutClone(callback);
|
||||||
}
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
context.withLastError(error, null, () => {
|
||||||
|
if (callback) {
|
||||||
|
context.runSafeWithoutClone(callback);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
return createProperties.id;
|
return createProperties.id;
|
||||||
},
|
},
|
||||||
|
|
|
@ -103,6 +103,7 @@ skip-if = (verify && (os == 'linux' || os == 'mac'))
|
||||||
[browser_ext_incognito_popup.js]
|
[browser_ext_incognito_popup.js]
|
||||||
[browser_ext_lastError.js]
|
[browser_ext_lastError.js]
|
||||||
[browser_ext_menus.js]
|
[browser_ext_menus.js]
|
||||||
|
[browser_ext_menus_errors.js]
|
||||||
[browser_ext_menus_event_order.js]
|
[browser_ext_menus_event_order.js]
|
||||||
[browser_ext_menus_events.js]
|
[browser_ext_menus_events.js]
|
||||||
[browser_ext_menus_refresh.js]
|
[browser_ext_menus_refresh.js]
|
||||||
|
|
|
@ -0,0 +1,94 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
add_task(async function test_create_error() {
|
||||||
|
// lastError is the only means to communicate errors in the menus.create API,
|
||||||
|
// so make sure that a warning is logged to the console if the error is not
|
||||||
|
// checked.
|
||||||
|
let waitForConsole = new Promise(resolve => {
|
||||||
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
SimpleTest.monitorConsole(resolve, [
|
||||||
|
// Callback exists, lastError is checked. Should not be logged.
|
||||||
|
{message: /Unchecked lastError value: Error: ID already exists: some_id/, forbid: true},
|
||||||
|
// No callback, lastError not checked. Should be logged.
|
||||||
|
{message: /Unchecked lastError value: Error: Could not find any MenuItem with id: noCb/},
|
||||||
|
// Callback exists, lastError not checked. Should be logged.
|
||||||
|
{message: /Unchecked lastError value: Error: Could not find any MenuItem with id: cbIgnoreError/},
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
async function background() {
|
||||||
|
// Note: browser.menus.create returns the menu ID instead of a promise, so
|
||||||
|
// we have to use callbacks.
|
||||||
|
await new Promise(resolve => {
|
||||||
|
browser.menus.create({id: "some_id", title: "menu item"}, () => {
|
||||||
|
browser.test.assertEq(null, browser.runtime.lastError, "Expected no error");
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Callback exists, lastError is checked:
|
||||||
|
await new Promise(resolve => {
|
||||||
|
browser.menus.create({id: "some_id", title: "menu item"}, () => {
|
||||||
|
browser.test.assertEq("ID already exists: some_id", browser.runtime.lastError.message, "Expected error");
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// No callback, lastError not checked:
|
||||||
|
browser.menus.create({id: "noCb", parentId: "noCb", title: "menu item"});
|
||||||
|
|
||||||
|
// Callback exists, lastError not checked:
|
||||||
|
await new Promise(resolve => {
|
||||||
|
browser.menus.create({id: "cbIgnoreError", parentId: "cbIgnoreError", title: "menu item"}, () => {
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Do another roundtrip with the menus API to ensure that any console
|
||||||
|
// error messages from the previous call are flushed.
|
||||||
|
await browser.menus.removeAll();
|
||||||
|
|
||||||
|
browser.test.sendMessage("done");
|
||||||
|
}
|
||||||
|
|
||||||
|
const extension = ExtensionTestUtils.loadExtension({
|
||||||
|
manifest: {permissions: ["menus"]},
|
||||||
|
background,
|
||||||
|
});
|
||||||
|
await extension.startup();
|
||||||
|
await extension.awaitMessage("done");
|
||||||
|
|
||||||
|
await extension.unload();
|
||||||
|
|
||||||
|
SimpleTest.endMonitorConsole();
|
||||||
|
await waitForConsole;
|
||||||
|
});
|
||||||
|
|
||||||
|
add_task(async function test_update_error() {
|
||||||
|
async function background() {
|
||||||
|
const id = browser.menus.create({title: "menu item"});
|
||||||
|
|
||||||
|
await browser.test.assertRejects(
|
||||||
|
browser.menus.update(id, {parentId: "bogus"}),
|
||||||
|
"Could not find any MenuItem with id: bogus",
|
||||||
|
"menus.update with invalid parentMenuId should fail");
|
||||||
|
|
||||||
|
await browser.test.assertRejects(
|
||||||
|
browser.menus.update(id, {parentId: id}),
|
||||||
|
"MenuItem cannot be an ancestor (or self) of its new parent.",
|
||||||
|
"menus.update cannot assign itself as the parent of a menu.");
|
||||||
|
|
||||||
|
browser.test.sendMessage("done");
|
||||||
|
}
|
||||||
|
|
||||||
|
const extension = ExtensionTestUtils.loadExtension({
|
||||||
|
manifest: {permissions: ["menus"]},
|
||||||
|
background,
|
||||||
|
});
|
||||||
|
await extension.startup();
|
||||||
|
await extension.awaitMessage("done");
|
||||||
|
await extension.unload();
|
||||||
|
});
|
|
@ -233,7 +233,7 @@ var gEditItemOverlay = {
|
||||||
if (showOrCollapse("tagsRow", isURI || bulkTagging, "tags"))
|
if (showOrCollapse("tagsRow", isURI || bulkTagging, "tags"))
|
||||||
this._initTagsField();
|
this._initTagsField();
|
||||||
else if (!this._element("tagsSelectorRow").collapsed)
|
else if (!this._element("tagsSelectorRow").collapsed)
|
||||||
this.toggleTagsSelector();
|
this.toggleTagsSelector().catch(Cu.reportError);
|
||||||
|
|
||||||
// Folder picker.
|
// Folder picker.
|
||||||
// Technically we should check that the item is not moveable, but that's
|
// Technically we should check that the item is not moveable, but that's
|
||||||
|
@ -435,7 +435,7 @@ var gEditItemOverlay = {
|
||||||
// Hide the tag selector if it was previously visible.
|
// Hide the tag selector if it was previously visible.
|
||||||
var tagsSelectorRow = this._element("tagsSelectorRow");
|
var tagsSelectorRow = this._element("tagsSelectorRow");
|
||||||
if (!tagsSelectorRow.collapsed)
|
if (!tagsSelectorRow.collapsed)
|
||||||
this.toggleTagsSelector();
|
this.toggleTagsSelector().catch(Cu.reportError);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._observersAdded) {
|
if (this._observersAdded) {
|
||||||
|
@ -741,7 +741,7 @@ var gEditItemOverlay = {
|
||||||
folderItem.doCommand();
|
folderItem.doCommand();
|
||||||
},
|
},
|
||||||
|
|
||||||
_rebuildTagsSelectorList() {
|
async _rebuildTagsSelectorList() {
|
||||||
let tagsSelector = this._element("tagsSelector");
|
let tagsSelector = this._element("tagsSelector");
|
||||||
let tagsSelectorRow = this._element("tagsSelectorRow");
|
let tagsSelectorRow = this._element("tagsSelectorRow");
|
||||||
if (tagsSelectorRow.collapsed)
|
if (tagsSelectorRow.collapsed)
|
||||||
|
@ -756,10 +756,10 @@ var gEditItemOverlay = {
|
||||||
}
|
}
|
||||||
|
|
||||||
let tagsInField = this._getTagsArrayFromTagsInputField();
|
let tagsInField = this._getTagsArrayFromTagsInputField();
|
||||||
let allTags = PlacesUtils.tagging.allTags;
|
let allTags = await PlacesUtils.bookmarks.fetchTags();
|
||||||
let fragment = document.createDocumentFragment();
|
let fragment = document.createDocumentFragment();
|
||||||
for (var i = 0; i < allTags.length; i++) {
|
for (let i = 0; i < allTags.length; i++) {
|
||||||
let tag = allTags[i];
|
let tag = allTags[i].name;
|
||||||
let elt = document.createElement("richlistitem");
|
let elt = document.createElement("richlistitem");
|
||||||
elt.appendChild(document.createElement("image"));
|
elt.appendChild(document.createElement("image"));
|
||||||
let label = document.createElement("label");
|
let label = document.createElement("label");
|
||||||
|
@ -778,9 +778,11 @@ var gEditItemOverlay = {
|
||||||
tagsSelector.selectedIndex = selectedIndex;
|
tagsSelector.selectedIndex = selectedIndex;
|
||||||
tagsSelector.ensureIndexIsVisible(selectedIndex);
|
tagsSelector.ensureIndexIsVisible(selectedIndex);
|
||||||
}
|
}
|
||||||
|
let event = new CustomEvent("BookmarkTagsSelectorUpdated", { bubbles: true });
|
||||||
|
tagsSelector.dispatchEvent(event);
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleTagsSelector() {
|
async toggleTagsSelector() {
|
||||||
var tagsSelector = this._element("tagsSelector");
|
var tagsSelector = this._element("tagsSelector");
|
||||||
var tagsSelectorRow = this._element("tagsSelectorRow");
|
var tagsSelectorRow = this._element("tagsSelectorRow");
|
||||||
var expander = this._element("tagsSelectorExpander");
|
var expander = this._element("tagsSelectorExpander");
|
||||||
|
@ -789,7 +791,7 @@ var gEditItemOverlay = {
|
||||||
expander.setAttribute("tooltiptext",
|
expander.setAttribute("tooltiptext",
|
||||||
expander.getAttribute("tooltiptextup"));
|
expander.getAttribute("tooltiptextup"));
|
||||||
tagsSelectorRow.collapsed = false;
|
tagsSelectorRow.collapsed = false;
|
||||||
this._rebuildTagsSelectorList();
|
await this._rebuildTagsSelectorList();
|
||||||
|
|
||||||
// This is a no-op if we've added the listener.
|
// This is a no-op if we've added the listener.
|
||||||
tagsSelector.addEventListener("mousedown", this);
|
tagsSelector.addEventListener("mousedown", this);
|
||||||
|
@ -934,7 +936,7 @@ var gEditItemOverlay = {
|
||||||
this._initTagsField();
|
this._initTagsField();
|
||||||
// Any tags change should be reflected in the tags selector.
|
// Any tags change should be reflected in the tags selector.
|
||||||
if (this._element("tagsSelector")) {
|
if (this._element("tagsSelector")) {
|
||||||
this._rebuildTagsSelectorList();
|
await this._rebuildTagsSelectorList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -102,7 +102,7 @@
|
||||||
tooltiptext="&editBookmarkOverlay.tagsExpanderDown.tooltip;"
|
tooltiptext="&editBookmarkOverlay.tagsExpanderDown.tooltip;"
|
||||||
tooltiptextdown="&editBookmarkOverlay.tagsExpanderDown.tooltip;"
|
tooltiptextdown="&editBookmarkOverlay.tagsExpanderDown.tooltip;"
|
||||||
tooltiptextup="&editBookmarkOverlay.expanderUp.tooltip;"
|
tooltiptextup="&editBookmarkOverlay.expanderUp.tooltip;"
|
||||||
oncommand="gEditItemOverlay.toggleTagsSelector();"/>
|
oncommand="gEditItemOverlay.toggleTagsSelector().catch(Cu.reportError);"/>
|
||||||
</hbox>
|
</hbox>
|
||||||
</vbox>
|
</vbox>
|
||||||
|
|
||||||
|
|
|
@ -78,10 +78,10 @@ add_task(async function() {
|
||||||
let selectedTag = listItem.label;
|
let selectedTag = listItem.label;
|
||||||
|
|
||||||
// Uncheck the tag.
|
// Uncheck the tag.
|
||||||
let promiseNotification = PlacesTestUtils.waitForNotification(
|
let promise = BrowserTestUtils.waitForEvent(tagsSelector,
|
||||||
"onItemChanged", (id, property) => property == "tags");
|
"BookmarkTagsSelectorUpdated");
|
||||||
EventUtils.synthesizeMouseAtCenter(listItem.firstChild, {});
|
EventUtils.synthesizeMouseAtCenter(listItem.firstChild, {});
|
||||||
await promiseNotification;
|
await promise;
|
||||||
is(scrollTop, tagsSelector.scrollTop, "Scroll position did not change");
|
is(scrollTop, tagsSelector.scrollTop, "Scroll position did not change");
|
||||||
|
|
||||||
// The listbox is rebuilt, so we have to get the new element.
|
// The listbox is rebuilt, so we have to get the new element.
|
||||||
|
@ -91,10 +91,10 @@ add_task(async function() {
|
||||||
is(newItem.label, selectedTag, "Correct tag is still selected");
|
is(newItem.label, selectedTag, "Correct tag is still selected");
|
||||||
|
|
||||||
// Check the tag.
|
// Check the tag.
|
||||||
promiseNotification = PlacesTestUtils.waitForNotification(
|
promise = BrowserTestUtils.waitForEvent(tagsSelector,
|
||||||
"onItemChanged", (id, property) => property == "tags");
|
"BookmarkTagsSelectorUpdated");
|
||||||
EventUtils.synthesizeMouseAtCenter(newItem.firstChild, {});
|
EventUtils.synthesizeMouseAtCenter(newItem.firstChild, {});
|
||||||
await promiseNotification;
|
await promise;
|
||||||
is(scrollTop, tagsSelector.scrollTop, "Scroll position did not change");
|
is(scrollTop, tagsSelector.scrollTop, "Scroll position did not change");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,10 +114,10 @@ add_task(async function() {
|
||||||
ok(listItem.hasAttribute("checked"), "Item is checked " + i);
|
ok(listItem.hasAttribute("checked"), "Item is checked " + i);
|
||||||
|
|
||||||
// Uncheck the tag.
|
// Uncheck the tag.
|
||||||
let promiseNotification = PlacesTestUtils.waitForNotification(
|
let promise = BrowserTestUtils.waitForEvent(tagsSelector,
|
||||||
"onItemChanged", (id, property) => property == "tags");
|
"BookmarkTagsSelectorUpdated");
|
||||||
EventUtils.synthesizeMouseAtCenter(listItem.firstChild, {});
|
EventUtils.synthesizeMouseAtCenter(listItem.firstChild, {});
|
||||||
await promiseNotification;
|
await promise;
|
||||||
|
|
||||||
// The listbox is rebuilt, so we have to get the new element.
|
// The listbox is rebuilt, so we have to get the new element.
|
||||||
let topItem = [...tagsSelector.children].find(e => e.label == topTag);
|
let topItem = [...tagsSelector.children].find(e => e.label == topTag);
|
||||||
|
@ -140,13 +140,9 @@ add_task(async function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
function openTagSelector() {
|
function openTagSelector() {
|
||||||
// Wait for the tags selector to be open.
|
let promise = BrowserTestUtils.waitForEvent(
|
||||||
let promise = new Promise(resolve => {
|
document.getElementById("editBMPanel_tagsSelector"),
|
||||||
let row = document.getElementById("editBMPanel_tagsSelectorRow");
|
"BookmarkTagsSelectorUpdated");
|
||||||
row.addEventListener("DOMAttrModified", function onAttrModified() {
|
|
||||||
resolve();
|
|
||||||
}, {once: true});
|
|
||||||
});
|
|
||||||
// Open the tags selector.
|
// Open the tags selector.
|
||||||
document.getElementById("editBMPanel_tagsSelectorExpander").doCommand();
|
document.getElementById("editBMPanel_tagsSelectorExpander").doCommand();
|
||||||
return promise;
|
return promise;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function checkTagsSelector(aAvailableTags, aCheckedTags) {
|
async function checkTagsSelector(aAvailableTags, aCheckedTags) {
|
||||||
is(PlacesUtils.tagging.allTags.length, aAvailableTags.length,
|
let tags = await PlacesUtils.bookmarks.fetchTags();
|
||||||
"tagging service is in sync.");
|
is(tags.length, aAvailableTags.length, "Check tags list");
|
||||||
let tagsSelector = document.getElementById("editBMPanel_tagsSelector");
|
let tagsSelector = document.getElementById("editBMPanel_tagsSelector");
|
||||||
let children = tagsSelector.childNodes;
|
let children = tagsSelector.childNodes;
|
||||||
is(children.length, aAvailableTags.length,
|
is(children.length, aAvailableTags.length,
|
||||||
|
@ -49,7 +49,7 @@ add_task(async function() {
|
||||||
await BrowserTestUtils.waitForCondition(
|
await BrowserTestUtils.waitForCondition(
|
||||||
() => document.getElementById("editBMPanel_tagsField").value == TEST_TAG,
|
() => document.getElementById("editBMPanel_tagsField").value == TEST_TAG,
|
||||||
"Editing a single bookmark shows the added tag.");
|
"Editing a single bookmark shows the added tag.");
|
||||||
checkTagsSelector([TEST_TAG], [TEST_TAG]);
|
await checkTagsSelector([TEST_TAG], [TEST_TAG]);
|
||||||
|
|
||||||
// Remove tag.
|
// Remove tag.
|
||||||
PlacesUtils.tagging.untagURI(TEST_URI, [TEST_TAG]);
|
PlacesUtils.tagging.untagURI(TEST_URI, [TEST_TAG]);
|
||||||
|
@ -58,7 +58,7 @@ add_task(async function() {
|
||||||
await BrowserTestUtils.waitForCondition(
|
await BrowserTestUtils.waitForCondition(
|
||||||
() => document.getElementById("editBMPanel_tagsField").value == "",
|
() => document.getElementById("editBMPanel_tagsField").value == "",
|
||||||
"Editing a single bookmark should not show any tag");
|
"Editing a single bookmark should not show any tag");
|
||||||
checkTagsSelector([], []);
|
await checkTagsSelector([], []);
|
||||||
|
|
||||||
// Add a second bookmark.
|
// Add a second bookmark.
|
||||||
let bm2 = await PlacesUtils.bookmarks.insert({
|
let bm2 = await PlacesUtils.bookmarks.insert({
|
||||||
|
@ -79,7 +79,7 @@ add_task(async function() {
|
||||||
await BrowserTestUtils.waitForCondition(
|
await BrowserTestUtils.waitForCondition(
|
||||||
() => document.getElementById("editBMPanel_tagsField").value == "",
|
() => document.getElementById("editBMPanel_tagsField").value == "",
|
||||||
"Editing multiple bookmarks without matching tags should not show any tag.");
|
"Editing multiple bookmarks without matching tags should not show any tag.");
|
||||||
checkTagsSelector([TEST_TAG], []);
|
await checkTagsSelector([TEST_TAG], []);
|
||||||
|
|
||||||
// Add a tag to the second uri.
|
// Add a tag to the second uri.
|
||||||
PlacesUtils.tagging.tagURI(TEST_URI2, [TEST_TAG]);
|
PlacesUtils.tagging.tagURI(TEST_URI2, [TEST_TAG]);
|
||||||
|
@ -88,7 +88,7 @@ add_task(async function() {
|
||||||
await BrowserTestUtils.waitForCondition(
|
await BrowserTestUtils.waitForCondition(
|
||||||
() => document.getElementById("editBMPanel_tagsField").value == TEST_TAG,
|
() => document.getElementById("editBMPanel_tagsField").value == TEST_TAG,
|
||||||
"Editing multiple bookmarks should show matching tags.");
|
"Editing multiple bookmarks should show matching tags.");
|
||||||
checkTagsSelector([TEST_TAG], [TEST_TAG]);
|
await checkTagsSelector([TEST_TAG], [TEST_TAG]);
|
||||||
|
|
||||||
// Remove tag from the first bookmark.
|
// Remove tag from the first bookmark.
|
||||||
PlacesUtils.tagging.untagURI(TEST_URI, [TEST_TAG]);
|
PlacesUtils.tagging.untagURI(TEST_URI, [TEST_TAG]);
|
||||||
|
@ -97,7 +97,7 @@ add_task(async function() {
|
||||||
await BrowserTestUtils.waitForCondition(
|
await BrowserTestUtils.waitForCondition(
|
||||||
() => document.getElementById("editBMPanel_tagsField").value == "",
|
() => document.getElementById("editBMPanel_tagsField").value == "",
|
||||||
"Editing multiple bookmarks without matching tags should not show any tag.");
|
"Editing multiple bookmarks without matching tags should not show any tag.");
|
||||||
checkTagsSelector([TEST_TAG], []);
|
await checkTagsSelector([TEST_TAG], []);
|
||||||
|
|
||||||
// Remove tag from the second bookmark.
|
// Remove tag from the second bookmark.
|
||||||
PlacesUtils.tagging.untagURI(TEST_URI2, [TEST_TAG]);
|
PlacesUtils.tagging.untagURI(TEST_URI2, [TEST_TAG]);
|
||||||
|
@ -106,7 +106,7 @@ add_task(async function() {
|
||||||
await BrowserTestUtils.waitForCondition(
|
await BrowserTestUtils.waitForCondition(
|
||||||
() => document.getElementById("editBMPanel_tagsField").value == "",
|
() => document.getElementById("editBMPanel_tagsField").value == "",
|
||||||
"Editing multiple bookmarks without matching tags should not show any tag.");
|
"Editing multiple bookmarks without matching tags should not show any tag.");
|
||||||
checkTagsSelector([], []);
|
await checkTagsSelector([], []);
|
||||||
|
|
||||||
// Init panel with a nsIURI entry.
|
// Init panel with a nsIURI entry.
|
||||||
gEditItemOverlay.initPanel({ uris: [TEST_URI] });
|
gEditItemOverlay.initPanel({ uris: [TEST_URI] });
|
||||||
|
@ -118,7 +118,7 @@ add_task(async function() {
|
||||||
await BrowserTestUtils.waitForCondition(
|
await BrowserTestUtils.waitForCondition(
|
||||||
() => document.getElementById("editBMPanel_tagsField").value == TEST_TAG,
|
() => document.getElementById("editBMPanel_tagsField").value == TEST_TAG,
|
||||||
"Editing a single nsIURI entry shows the added tag.");
|
"Editing a single nsIURI entry shows the added tag.");
|
||||||
checkTagsSelector([TEST_TAG], [TEST_TAG]);
|
await checkTagsSelector([TEST_TAG], [TEST_TAG]);
|
||||||
|
|
||||||
// Remove tag.
|
// Remove tag.
|
||||||
PlacesUtils.tagging.untagURI(TEST_URI, [TEST_TAG]);
|
PlacesUtils.tagging.untagURI(TEST_URI, [TEST_TAG]);
|
||||||
|
@ -127,7 +127,7 @@ add_task(async function() {
|
||||||
await BrowserTestUtils.waitForCondition(
|
await BrowserTestUtils.waitForCondition(
|
||||||
() => document.getElementById("editBMPanel_tagsField").value == "",
|
() => document.getElementById("editBMPanel_tagsField").value == "",
|
||||||
"Editing a single nsIURI entry should not show any tag.");
|
"Editing a single nsIURI entry should not show any tag.");
|
||||||
checkTagsSelector([], []);
|
await checkTagsSelector([], []);
|
||||||
|
|
||||||
// Init panel with multiple nsIURI entries.
|
// Init panel with multiple nsIURI entries.
|
||||||
gEditItemOverlay.initPanel({ uris: [TEST_URI, TEST_URI2] });
|
gEditItemOverlay.initPanel({ uris: [TEST_URI, TEST_URI2] });
|
||||||
|
@ -139,7 +139,7 @@ add_task(async function() {
|
||||||
await BrowserTestUtils.waitForCondition(
|
await BrowserTestUtils.waitForCondition(
|
||||||
() => document.getElementById("editBMPanel_tagsField").value == "",
|
() => document.getElementById("editBMPanel_tagsField").value == "",
|
||||||
"Editing multiple nsIURIs without matching tags should not show any tag.");
|
"Editing multiple nsIURIs without matching tags should not show any tag.");
|
||||||
checkTagsSelector([TEST_TAG], []);
|
await checkTagsSelector([TEST_TAG], []);
|
||||||
|
|
||||||
// Add a tag to the second entry.
|
// Add a tag to the second entry.
|
||||||
PlacesUtils.tagging.tagURI(TEST_URI2, [TEST_TAG]);
|
PlacesUtils.tagging.tagURI(TEST_URI2, [TEST_TAG]);
|
||||||
|
@ -148,7 +148,7 @@ add_task(async function() {
|
||||||
await BrowserTestUtils.waitForCondition(
|
await BrowserTestUtils.waitForCondition(
|
||||||
() => document.getElementById("editBMPanel_tagsField").value == TEST_TAG,
|
() => document.getElementById("editBMPanel_tagsField").value == TEST_TAG,
|
||||||
"Editing multiple nsIURIs should show matching tags.");
|
"Editing multiple nsIURIs should show matching tags.");
|
||||||
checkTagsSelector([TEST_TAG], [TEST_TAG]);
|
await checkTagsSelector([TEST_TAG], [TEST_TAG]);
|
||||||
|
|
||||||
// Remove tag from the first entry.
|
// Remove tag from the first entry.
|
||||||
PlacesUtils.tagging.untagURI(TEST_URI, [TEST_TAG]);
|
PlacesUtils.tagging.untagURI(TEST_URI, [TEST_TAG]);
|
||||||
|
@ -157,7 +157,7 @@ add_task(async function() {
|
||||||
await BrowserTestUtils.waitForCondition(
|
await BrowserTestUtils.waitForCondition(
|
||||||
() => document.getElementById("editBMPanel_tagsField").value == "",
|
() => document.getElementById("editBMPanel_tagsField").value == "",
|
||||||
"Editing multiple nsIURIs without matching tags should not show any tag.");
|
"Editing multiple nsIURIs without matching tags should not show any tag.");
|
||||||
checkTagsSelector([TEST_TAG], []);
|
await checkTagsSelector([TEST_TAG], []);
|
||||||
|
|
||||||
// Remove tag from the second entry.
|
// Remove tag from the second entry.
|
||||||
PlacesUtils.tagging.untagURI(TEST_URI2, [TEST_TAG]);
|
PlacesUtils.tagging.untagURI(TEST_URI2, [TEST_TAG]);
|
||||||
|
@ -166,7 +166,7 @@ add_task(async function() {
|
||||||
await BrowserTestUtils.waitForCondition(
|
await BrowserTestUtils.waitForCondition(
|
||||||
() => document.getElementById("editBMPanel_tagsField").value == "",
|
() => document.getElementById("editBMPanel_tagsField").value == "",
|
||||||
"Editing multiple nsIURIs without matching tags should not show any tag.");
|
"Editing multiple nsIURIs without matching tags should not show any tag.");
|
||||||
checkTagsSelector([], []);
|
await checkTagsSelector([], []);
|
||||||
|
|
||||||
// Cleanup.
|
// Cleanup.
|
||||||
await PlacesUtils.bookmarks.remove(bm.guid);
|
await PlacesUtils.bookmarks.remove(bm.guid);
|
||||||
|
|
|
@ -58,7 +58,7 @@ buildscript {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.0.1'
|
classpath 'com.android.tools.build:gradle:3.1.0'
|
||||||
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
|
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,6 @@ disabled=Bug 962258
|
||||||
[browser_toolbox_remoteness_change.js]
|
[browser_toolbox_remoteness_change.js]
|
||||||
run-if = e10s
|
run-if = e10s
|
||||||
[browser_toolbox_select_event.js]
|
[browser_toolbox_select_event.js]
|
||||||
skip-if = e10s # Bug 1069044 - destroyInspector may hang during shutdown
|
|
||||||
[browser_toolbox_selected_tool_unavailable.js]
|
[browser_toolbox_selected_tool_unavailable.js]
|
||||||
[browser_toolbox_selectionchanged_event.js]
|
[browser_toolbox_selectionchanged_event.js]
|
||||||
[browser_toolbox_sidebar.js]
|
[browser_toolbox_sidebar.js]
|
||||||
|
|
|
@ -158,7 +158,9 @@ function fetchStylesheetFromNetworkMonitor(href, consoleActor) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const content = request._response.content;
|
const content = request._response.content;
|
||||||
if (request._discardResponseBody || request._truncated || !content) {
|
if (request._discardResponseBody || request._truncated || !content || !content.size) {
|
||||||
|
// Do not return the stylesheet text if there is no meaningful content or if it's
|
||||||
|
// still loading. Let the caller handle it by doing its own separate request.
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,6 @@ skip-if = e10s # Bug 1183605 - devtools/server/tests/browser/ tests are still di
|
||||||
[browser_markers-styles.js]
|
[browser_markers-styles.js]
|
||||||
[browser_markers-timestamp.js]
|
[browser_markers-timestamp.js]
|
||||||
[browser_navigateEvents.js]
|
[browser_navigateEvents.js]
|
||||||
skip-if = e10s # Bug 1183605 - devtools/server/tests/browser/ tests are still disabled in E10S
|
|
||||||
[browser_perf-01.js]
|
[browser_perf-01.js]
|
||||||
[browser_perf-02.js]
|
[browser_perf-02.js]
|
||||||
[browser_perf-03.js]
|
[browser_perf-03.js]
|
||||||
|
|
|
@ -104,8 +104,9 @@ static bool
|
||||||
IsMediaElementAllowedToPlay(const HTMLMediaElement& aElement)
|
IsMediaElementAllowedToPlay(const HTMLMediaElement& aElement)
|
||||||
{
|
{
|
||||||
return ((aElement.Volume() == 0.0 || aElement.Muted()) &&
|
return ((aElement.Volume() == 0.0 || aElement.Muted()) &&
|
||||||
Preferences::GetBool("media.autoplay.allow-muted", true)) ||
|
Preferences::GetBool("media.autoplay.allow-muted", true)) ||
|
||||||
IsWindowAllowedToPlay(aElement.OwnerDoc()->GetInnerWindow());
|
IsWindowAllowedToPlay(aElement.OwnerDoc()->GetInnerWindow()) ||
|
||||||
|
(aElement.OwnerDoc()->MediaDocumentKind() == nsIDocument::MediaDocumentKind::Video);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ bool
|
/* static */ bool
|
||||||
|
|
|
@ -3,5 +3,5 @@ distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
|
||||||
distributionSha256Sum=5c07b3bac2209fbc98fb1fdf6fd831f72429cdf8c503807404eae03d8c8099e5
|
distributionSha256Sum=7a2c66d1a78f811d5f37d14630ad21cec5e77a2a4dc61e787e2257a6341016ce
|
||||||
|
|
|
@ -552,7 +552,7 @@ nsDisplayXULImage::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBui
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!imageFrame->mImageRequest) {
|
if (!imageFrame->mImageRequest) {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t flags = imgIContainer::FLAG_SYNC_DECODE_IF_FAST;
|
uint32_t flags = imgIContainer::FLAG_SYNC_DECODE_IF_FAST;
|
||||||
|
|
|
@ -1409,8 +1409,8 @@ do_QueryObjectReferent(nsIWeakReference* aRawPtr) {
|
||||||
|
|
||||||
|
|
||||||
// Not a member function so that we don't need to keep the PC live.
|
// Not a member function so that we don't need to keep the PC live.
|
||||||
static void NotifyDataChannel_m(RefPtr<nsDOMDataChannel> aChannel,
|
static void NotifyDataChannel_m(const RefPtr<nsDOMDataChannel>& aChannel,
|
||||||
RefPtr<PeerConnectionObserver> aObserver)
|
const RefPtr<PeerConnectionObserver>& aObserver)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
JSErrorResult rv;
|
JSErrorResult rv;
|
||||||
|
@ -3048,7 +3048,7 @@ PeerConnectionImpl::CandidateReady(const std::string& candidate,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SendLocalIceCandidateToContentImpl(nsWeakPtr weakPCObserver,
|
SendLocalIceCandidateToContentImpl(const nsWeakPtr& weakPCObserver,
|
||||||
uint16_t level,
|
uint16_t level,
|
||||||
const std::string& mid,
|
const std::string& mid,
|
||||||
const std::string& candidate) {
|
const std::string& candidate) {
|
||||||
|
@ -3689,7 +3689,7 @@ void PeerConnectionImpl::GetStatsForPCObserver_s(
|
||||||
void PeerConnectionImpl::DeliverStatsReportToPCObserver_m(
|
void PeerConnectionImpl::DeliverStatsReportToPCObserver_m(
|
||||||
const std::string& pcHandle,
|
const std::string& pcHandle,
|
||||||
nsresult result,
|
nsresult result,
|
||||||
nsAutoPtr<RTCStatsQuery> query) {
|
const nsAutoPtr<RTCStatsQuery>& query) {
|
||||||
|
|
||||||
// Is the PeerConnectionImpl still around?
|
// Is the PeerConnectionImpl still around?
|
||||||
PeerConnectionWrapper pcw(pcHandle);
|
PeerConnectionWrapper pcw(pcHandle);
|
||||||
|
|
|
@ -721,7 +721,7 @@ private:
|
||||||
static void DeliverStatsReportToPCObserver_m(
|
static void DeliverStatsReportToPCObserver_m(
|
||||||
const std::string& pcHandle,
|
const std::string& pcHandle,
|
||||||
nsresult result,
|
nsresult result,
|
||||||
nsAutoPtr<RTCStatsQuery> query);
|
const nsAutoPtr<RTCStatsQuery>& query);
|
||||||
|
|
||||||
// When ICE completes, we record a bunch of statistics that outlive the
|
// When ICE completes, we record a bunch of statistics that outlive the
|
||||||
// PeerConnection. This is just telemetry right now, but this can also
|
// PeerConnection. This is just telemetry right now, but this can also
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
<issue id="LongLogTag" severity="warning" />
|
<issue id="LongLogTag" severity="warning" />
|
||||||
<issue id="MissingPermission" severity="warning" />
|
<issue id="MissingPermission" severity="warning" />
|
||||||
<issue id="OnClick" severity="warning" />
|
<issue id="OnClick" severity="warning" />
|
||||||
|
<issue id="ProtectedPermissions" severity="warning" />
|
||||||
<issue id="ReferenceType" severity="warning" />
|
<issue id="ReferenceType" severity="warning" />
|
||||||
<issue id="ResourceAsColor" severity="warning" />
|
<issue id="ResourceAsColor" severity="warning" />
|
||||||
<issue id="ResourceType" severity="warning" />
|
<issue id="ResourceType" severity="warning" />
|
||||||
|
@ -195,7 +196,6 @@
|
||||||
<issue id="Proguard" severity="error" />
|
<issue id="Proguard" severity="error" />
|
||||||
<issue id="ProguardSplit" severity="error" />
|
<issue id="ProguardSplit" severity="error" />
|
||||||
<issue id="PropertyEscape" severity="error" />
|
<issue id="PropertyEscape" severity="error" />
|
||||||
<issue id="ProtectedPermissions" severity="error" />
|
|
||||||
<issue id="PxUsage" severity="error" />
|
<issue id="PxUsage" severity="error" />
|
||||||
<issue id="Range" severity="error" />
|
<issue id="Range" severity="error" />
|
||||||
<issue id="RelativeOverlap" severity="error" />
|
<issue id="RelativeOverlap" severity="error" />
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/edit_folder_name"
|
android:id="@+id/edit_folder_name"
|
||||||
|
android:inputType="text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/edit_bookmark_name"
|
android:id="@+id/edit_bookmark_name"
|
||||||
|
android:inputType="text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
|
@ -42,6 +43,7 @@
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/edit_bookmark_keyword"
|
android:id="@+id/edit_bookmark_keyword"
|
||||||
|
android:inputType="text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
android:id="@+id/edit_bookmark_name"
|
android:id="@+id/edit_bookmark_name"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="text"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:gravity="start"
|
android:gravity="start"
|
||||||
android:hint="@string/bookmark_edit_name"
|
android:hint="@string/bookmark_edit_name"
|
||||||
|
|
|
@ -13,17 +13,17 @@
|
||||||
-->
|
-->
|
||||||
<style name="Widget"/>
|
<style name="Widget"/>
|
||||||
|
|
||||||
<style name="Widget.BaseButton" parent="android:style/Widget.Button"/>
|
<style name="Widget.BaseButton" parent="@android:style/Widget.Button"/>
|
||||||
|
|
||||||
<style name="Widget.BaseDropDownItem" parent="android:style/Widget.DropDownItem"/>
|
<style name="Widget.BaseDropDownItem" parent="@android:style/Widget.DropDownItem"/>
|
||||||
|
|
||||||
<style name="Widget.BaseEditText" parent="android:style/Widget.EditText"/>
|
<style name="Widget.BaseEditText" parent="@android:style/Widget.EditText"/>
|
||||||
|
|
||||||
<style name="Widget.BaseListView" parent="android:style/Widget.ListView"/>
|
<style name="Widget.BaseListView" parent="@android:style/Widget.ListView"/>
|
||||||
|
|
||||||
<style name="Widget.BaseGridView" parent="android:style/Widget.GridView"/>
|
<style name="Widget.BaseGridView" parent="@android:style/Widget.GridView"/>
|
||||||
|
|
||||||
<style name="Widget.BaseTextView" parent="android:style/Widget.TextView"/>
|
<style name="Widget.BaseTextView" parent="@android:style/Widget.TextView"/>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Application styles. All customizations that are not specific
|
Application styles. All customizations that are not specific
|
||||||
|
@ -75,7 +75,7 @@
|
||||||
<item name="android:ellipsize">marquee</item>
|
<item name="android:ellipsize">marquee</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Widget.Spinner" parent="android:style/Widget.Spinner">
|
<style name="Widget.Spinner" parent="@android:style/Widget.Spinner">
|
||||||
<item name="android:minWidth">@dimen/doorhanger_input_width</item>
|
<item name="android:minWidth">@dimen/doorhanger_input_width</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
|
@ -318,7 +318,7 @@ public class AnimatedProgressBar extends ThemedProgressBar {
|
||||||
int duration,
|
int duration,
|
||||||
@InterpolatorRes int itplId) {
|
@InterpolatorRes int itplId) {
|
||||||
if (isWrap) {
|
if (isWrap) {
|
||||||
final Interpolator interpolator = (itplId > 0)
|
final Interpolator interpolator = (itplId != 0)
|
||||||
? AnimationUtils.loadInterpolator(getContext(), itplId)
|
? AnimationUtils.loadInterpolator(getContext(), itplId)
|
||||||
: null;
|
: null;
|
||||||
return new ShiftDrawable(original, duration, interpolator);
|
return new ShiftDrawable(original, duration, interpolator);
|
||||||
|
|
|
@ -224,7 +224,9 @@ android.libraryVariants.all { variant ->
|
||||||
def javadoc = task "javadoc${name.capitalize()}"(type: Javadoc) {
|
def javadoc = task "javadoc${name.capitalize()}"(type: Javadoc) {
|
||||||
description = "Generate Javadoc for build variant $name"
|
description = "Generate Javadoc for build variant $name"
|
||||||
destinationDir = new File(destinationDir, variant.baseName)
|
destinationDir = new File(destinationDir, variant.baseName)
|
||||||
classpath = files(variant.javaCompile.classpath.files)
|
doFirst {
|
||||||
|
classpath = files(variant.javaCompile.classpath.files)
|
||||||
|
}
|
||||||
|
|
||||||
source = files(variant.javaCompile.source)
|
source = files(variant.javaCompile.source)
|
||||||
exclude '**/R.java', '**/BuildConfig.java'
|
exclude '**/R.java', '**/BuildConfig.java'
|
||||||
|
|
|
@ -2057,7 +2057,7 @@ dnl ========================================================
|
||||||
|
|
||||||
case "$MOZ_BUILD_APP" in
|
case "$MOZ_BUILD_APP" in
|
||||||
mobile/android)
|
mobile/android)
|
||||||
MOZ_ANDROID_SDK(26, 26, 26.0.2)
|
MOZ_ANDROID_SDK(26, 26, 27.0.3)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
platform-tools
|
platform-tools
|
||||||
build-tools;26.0.2
|
build-tools;27.0.3
|
||||||
platforms;android-26
|
platforms;android-26
|
||||||
extras;android;m2repository
|
extras;android;m2repository
|
||||||
extras;google;m2repository
|
extras;google;m2repository
|
||||||
|
|
|
@ -25,9 +25,9 @@ job-defaults:
|
||||||
default:
|
default:
|
||||||
- raptor/linux_config.py
|
- raptor/linux_config.py
|
||||||
|
|
||||||
raptor-firefox-tp6:
|
raptor-tp6-firefox:
|
||||||
description: "Raptor Firefox tp6"
|
description: "Raptor tp6 on Firefox"
|
||||||
try-name: raptor-firefox-tp6
|
try-name: raptor-tp6-firefox
|
||||||
treeherder-symbol: Rap(tp6)
|
treeherder-symbol: Rap(tp6)
|
||||||
run-on-projects: ['try', 'mozilla-central']
|
run-on-projects: ['try', 'mozilla-central']
|
||||||
max-run-time: 1200
|
max-run-time: 1200
|
||||||
|
@ -35,9 +35,20 @@ raptor-firefox-tp6:
|
||||||
extra-options:
|
extra-options:
|
||||||
- --test=raptor-tp6
|
- --test=raptor-tp6
|
||||||
|
|
||||||
raptor-firefox-speedometer:
|
raptor-tp6-chrome:
|
||||||
description: "Raptor Firefox Speedometer"
|
description: "Raptor tp6 on Chrome"
|
||||||
try-name: raptor-firefox-speedometer
|
try-name: raptor-tp6-chrome
|
||||||
|
treeherder-symbol: Rap-C(tp6)
|
||||||
|
run-on-projects: ['try']
|
||||||
|
max-run-time: 1200
|
||||||
|
mozharness:
|
||||||
|
extra-options:
|
||||||
|
- --test=raptor-tp6
|
||||||
|
- --app=chrome
|
||||||
|
|
||||||
|
raptor-speedometer-firefox:
|
||||||
|
description: "Raptor Speedometer on Firefox"
|
||||||
|
try-name: raptor-speedometer-firefox
|
||||||
treeherder-symbol: Rap(sp)
|
treeherder-symbol: Rap(sp)
|
||||||
run-on-projects: ['try', 'mozilla-central']
|
run-on-projects: ['try', 'mozilla-central']
|
||||||
max-run-time: 1500
|
max-run-time: 1500
|
||||||
|
@ -45,73 +56,9 @@ raptor-firefox-speedometer:
|
||||||
extra-options:
|
extra-options:
|
||||||
- --test=raptor-speedometer
|
- --test=raptor-speedometer
|
||||||
|
|
||||||
raptor-firefox-stylebench:
|
raptor-speedometer-chrome:
|
||||||
description: "Raptor Firefox StyleBench"
|
description: "Raptor Speedometer on Chrome"
|
||||||
try-name: raptor-firefox-stylebench
|
try-name: raptor-speedometer-chrome
|
||||||
treeherder-symbol: Rap(sb)
|
|
||||||
run-on-projects: ['try', 'mozilla-central']
|
|
||||||
max-run-time: 1800
|
|
||||||
mozharness:
|
|
||||||
extra-options:
|
|
||||||
- --test=raptor-stylebench
|
|
||||||
|
|
||||||
raptor-firefox-sunspider:
|
|
||||||
description: "Raptor Firefox SunSpider"
|
|
||||||
try-name: raptor-firefox-sunspider
|
|
||||||
treeherder-symbol: Rap(ss)
|
|
||||||
run-on-projects: ['try', 'mozilla-central']
|
|
||||||
max-run-time: 1800
|
|
||||||
mozharness:
|
|
||||||
extra-options:
|
|
||||||
- --test=raptor-sunspider
|
|
||||||
|
|
||||||
raptor-firefox-motionmark-htmlsuite:
|
|
||||||
description: "Raptor Firefox MotionMark HtmlSuite"
|
|
||||||
try-name: raptor-firefox-motionmark-htmlsuite
|
|
||||||
treeherder-symbol: Rap(mm-h)
|
|
||||||
run-on-projects: ['try', 'mozilla-central']
|
|
||||||
max-run-time: 1800
|
|
||||||
mozharness:
|
|
||||||
extra-options:
|
|
||||||
- --test=raptor-motionmark-htmlsuite
|
|
||||||
|
|
||||||
raptor-firefox-motionmark-animometer:
|
|
||||||
description: "Raptor Firefox MotionMark Animometer"
|
|
||||||
try-name: raptor-firefox-motionmark-animometer
|
|
||||||
treeherder-symbol: Rap(mm-a)
|
|
||||||
run-on-projects: ['try', 'mozilla-central']
|
|
||||||
max-run-time: 1800
|
|
||||||
mozharness:
|
|
||||||
extra-options:
|
|
||||||
- --test=raptor-motionmark-animometer
|
|
||||||
|
|
||||||
raptor-firefox-webaudio:
|
|
||||||
description: "Raptor Firefox WebAudio benchmark"
|
|
||||||
try-name: raptor-firefox-webaudio
|
|
||||||
treeherder-symbol: Rap(wa)
|
|
||||||
run-on-projects: ['try', 'mozilla-central']
|
|
||||||
max-run-time: 1800
|
|
||||||
mozharness:
|
|
||||||
extra-options:
|
|
||||||
- --test=raptor-webaudio
|
|
||||||
|
|
||||||
raptor-chrome-tp6:
|
|
||||||
description: "Raptor Chrome tp6"
|
|
||||||
try-name: raptor-chrome-tp6
|
|
||||||
treeherder-symbol: Rap-C(tp6)
|
|
||||||
run-on-projects:
|
|
||||||
by-test-platform:
|
|
||||||
.*-qr/.*: ['try']
|
|
||||||
default: ['try']
|
|
||||||
max-run-time: 1200
|
|
||||||
mozharness:
|
|
||||||
extra-options:
|
|
||||||
- --test=raptor-tp6
|
|
||||||
- --app=chrome
|
|
||||||
|
|
||||||
raptor-chrome-speedometer:
|
|
||||||
description: "Raptor Chrome Speedometer"
|
|
||||||
try-name: raptor-chrome-speedometer
|
|
||||||
treeherder-symbol: Rap-C(sp)
|
treeherder-symbol: Rap-C(sp)
|
||||||
run-on-projects: ['try', 'mozilla-central']
|
run-on-projects: ['try', 'mozilla-central']
|
||||||
max-run-time: 1500
|
max-run-time: 1500
|
||||||
|
@ -120,9 +67,19 @@ raptor-chrome-speedometer:
|
||||||
- --test=raptor-speedometer
|
- --test=raptor-speedometer
|
||||||
- --app=chrome
|
- --app=chrome
|
||||||
|
|
||||||
raptor-chrome-stylebench:
|
raptor-stylebench-firefox:
|
||||||
description: "Raptor Chrome StyleBench"
|
description: "Raptor StyleBench on Firefox"
|
||||||
try-name: raptor-chrome-stylebench
|
try-name: raptor-stylebench-firefox
|
||||||
|
treeherder-symbol: Rap(sb)
|
||||||
|
run-on-projects: ['try', 'mozilla-central']
|
||||||
|
max-run-time: 1800
|
||||||
|
mozharness:
|
||||||
|
extra-options:
|
||||||
|
- --test=raptor-stylebench
|
||||||
|
|
||||||
|
raptor-stylebench-chrome:
|
||||||
|
description: "Raptor StyleBench on Chrome"
|
||||||
|
try-name: raptor-stylebench-chrome
|
||||||
treeherder-symbol: Rap-C(sb)
|
treeherder-symbol: Rap-C(sb)
|
||||||
run-on-projects: ['try', 'mozilla-central']
|
run-on-projects: ['try', 'mozilla-central']
|
||||||
max-run-time: 1800
|
max-run-time: 1800
|
||||||
|
@ -131,20 +88,19 @@ raptor-chrome-stylebench:
|
||||||
- --test=raptor-stylebench
|
- --test=raptor-stylebench
|
||||||
- --app=chrome
|
- --app=chrome
|
||||||
|
|
||||||
raptor-chrome-sunspider:
|
raptor-motionmark-htmlsuite-firefox:
|
||||||
description: "Raptor Chrome SunSpider"
|
description: "Raptor MotionMark HtmlSuite on Firefox"
|
||||||
try-name: raptor-chrome-sunspider
|
try-name: raptor-motionmark-htmlsuite-firefox
|
||||||
treeherder-symbol: Rap-C(ss)
|
treeherder-symbol: Rap(mm-h)
|
||||||
run-on-projects: ['try', 'mozilla-central']
|
run-on-projects: ['try', 'mozilla-central']
|
||||||
max-run-time: 1800
|
max-run-time: 1800
|
||||||
mozharness:
|
mozharness:
|
||||||
extra-options:
|
extra-options:
|
||||||
- --test=raptor-sunspider
|
- --test=raptor-motionmark-htmlsuite
|
||||||
- --app=chrome
|
|
||||||
|
|
||||||
raptor-chrome-motionmark-htmlsuite:
|
raptor-motionmark-htmlsuite-chrome:
|
||||||
description: "Raptor Chrome MotionMark HtmlSuite"
|
description: "Raptor MotionMark HtmlSuite on Chrome"
|
||||||
try-name: raptor-chrome-motionmark-htmlsuite
|
try-name: raptor-motionmark-htmlsuite-chrome
|
||||||
treeherder-symbol: Rap-C(mm-h)
|
treeherder-symbol: Rap-C(mm-h)
|
||||||
run-on-projects: ['try', 'mozilla-central']
|
run-on-projects: ['try', 'mozilla-central']
|
||||||
max-run-time: 1800
|
max-run-time: 1800
|
||||||
|
@ -153,9 +109,19 @@ raptor-chrome-motionmark-htmlsuite:
|
||||||
- --test=raptor-motionmark-htmlsuite
|
- --test=raptor-motionmark-htmlsuite
|
||||||
- --app=chrome
|
- --app=chrome
|
||||||
|
|
||||||
raptor-chrome-motionmark-animometer:
|
raptor-motionmark-animometer-firefox:
|
||||||
description: "Raptor Chrome MotionMark Animometer"
|
description: "Raptor MotionMark Animometer on Firefox"
|
||||||
try-name: raptor-chrome-motionmark-animometer
|
try-name: raptor-motionmark-animometer-firefox
|
||||||
|
treeherder-symbol: Rap(mm-a)
|
||||||
|
run-on-projects: ['try', 'mozilla-central']
|
||||||
|
max-run-time: 1800
|
||||||
|
mozharness:
|
||||||
|
extra-options:
|
||||||
|
- --test=raptor-motionmark-animometer
|
||||||
|
|
||||||
|
raptor-motionmark-animometer-chrome:
|
||||||
|
description: "Raptor MotionMark Animometer on Chrome"
|
||||||
|
try-name: raptor-motionmark-animometer-chrome
|
||||||
treeherder-symbol: Rap-C(mm-a)
|
treeherder-symbol: Rap-C(mm-a)
|
||||||
run-on-projects: ['try', 'mozilla-central']
|
run-on-projects: ['try', 'mozilla-central']
|
||||||
max-run-time: 1800
|
max-run-time: 1800
|
||||||
|
@ -164,9 +130,19 @@ raptor-chrome-motionmark-animometer:
|
||||||
- --test=raptor-motionmark-animometer
|
- --test=raptor-motionmark-animometer
|
||||||
- --app=chrome
|
- --app=chrome
|
||||||
|
|
||||||
raptor-chrome-webaudio:
|
raptor-webaudio-firefox:
|
||||||
description: "Raptor Chrome WebAudio benchmark"
|
description: "Raptor WebAudio on Firefox"
|
||||||
try-name: raptor-chrome-webaudio
|
try-name: raptor-webaudio-firefox
|
||||||
|
treeherder-symbol: Rap(wa)
|
||||||
|
run-on-projects: ['try', 'mozilla-central']
|
||||||
|
max-run-time: 1800
|
||||||
|
mozharness:
|
||||||
|
extra-options:
|
||||||
|
- --test=raptor-webaudio
|
||||||
|
|
||||||
|
raptor-webaudio-chrome:
|
||||||
|
description: "Raptor WebAudio on Chrome"
|
||||||
|
try-name: raptor-webaudio-chrome
|
||||||
treeherder-symbol: Rap-C(wa)
|
treeherder-symbol: Rap-C(wa)
|
||||||
run-on-projects: ['try', 'mozilla-central']
|
run-on-projects: ['try', 'mozilla-central']
|
||||||
max-run-time: 1800
|
max-run-time: 1800
|
||||||
|
@ -174,3 +150,45 @@ raptor-chrome-webaudio:
|
||||||
extra-options:
|
extra-options:
|
||||||
- --test=raptor-webaudio
|
- --test=raptor-webaudio
|
||||||
- --app=chrome
|
- --app=chrome
|
||||||
|
|
||||||
|
raptor-gdocs-firefox:
|
||||||
|
description: "Raptor gdocs on Firefox"
|
||||||
|
try-name: raptor-gdocs-firefox
|
||||||
|
treeherder-symbol: Rap(gdocs)
|
||||||
|
run-on-projects: ['try', 'mozilla-central']
|
||||||
|
max-run-time: 1800
|
||||||
|
mozharness:
|
||||||
|
extra-options:
|
||||||
|
- --test=raptor-gdocs
|
||||||
|
|
||||||
|
raptor-gdocs-chrome:
|
||||||
|
description: "Raptor gdocs on Chrome"
|
||||||
|
try-name: raptor-gdocs-chrome
|
||||||
|
treeherder-symbol: Rap-C(gdocs)
|
||||||
|
run-on-projects: ['try']
|
||||||
|
max-run-time: 1800
|
||||||
|
mozharness:
|
||||||
|
extra-options:
|
||||||
|
- --test=raptor-gdocs
|
||||||
|
- --app=chrome
|
||||||
|
|
||||||
|
raptor-sunspider-firefox:
|
||||||
|
description: "Raptor SunSpider on Firefox"
|
||||||
|
try-name: raptor-sunspider-firefox
|
||||||
|
treeherder-symbol: Rap(ss)
|
||||||
|
run-on-projects: ['try', 'mozilla-central']
|
||||||
|
max-run-time: 1800
|
||||||
|
mozharness:
|
||||||
|
extra-options:
|
||||||
|
- --test=raptor-sunspider
|
||||||
|
|
||||||
|
raptor-sunspider-chrome:
|
||||||
|
description: "Raptor SunSpider on Chrome"
|
||||||
|
try-name: raptor-sunspider-chrome
|
||||||
|
treeherder-symbol: Rap-C(ss)
|
||||||
|
run-on-projects: ['try', 'mozilla-central']
|
||||||
|
max-run-time: 1800
|
||||||
|
mozharness:
|
||||||
|
extra-options:
|
||||||
|
- --test=raptor-sunspider
|
||||||
|
- --app=chrome
|
||||||
|
|
|
@ -81,18 +81,22 @@ talos:
|
||||||
- talos-h2
|
- talos-h2
|
||||||
|
|
||||||
raptor:
|
raptor:
|
||||||
- raptor-firefox-tp6
|
- raptor-tp6-firefox
|
||||||
- raptor-firefox-speedometer
|
- raptor-tp6-chrome
|
||||||
- raptor-firefox-stylebench
|
- raptor-speedometer-firefox
|
||||||
- raptor-firefox-sunspider
|
- raptor-speedometer-chrome
|
||||||
- raptor-firefox-motionmark-htmlsuite
|
- raptor-stylebench-firefox
|
||||||
- raptor-firefox-motionmark-animometer
|
- raptor-stylebench-chrome
|
||||||
- raptor-firefox-webaudio
|
- raptor-motionmark-htmlsuite-firefox
|
||||||
- raptor-chrome-tp6
|
- raptor-motionmark-htmlsuite-chrome
|
||||||
- raptor-chrome-speedometer
|
- raptor-motionmark-animometer-firefox
|
||||||
- raptor-chrome-stylebench
|
- raptor-motionmark-animometer-chrome
|
||||||
- raptor-chrome-sunspider
|
- raptor-webaudio-firefox
|
||||||
- raptor-chrome-webaudio
|
- raptor-webaudio-chrome
|
||||||
|
- raptor-gdocs-firefox
|
||||||
|
- raptor-gdocs-chrome
|
||||||
|
- raptor-sunspider-firefox
|
||||||
|
- raptor-sunspider-chrome
|
||||||
|
|
||||||
awsy:
|
awsy:
|
||||||
- awsy
|
- awsy
|
||||||
|
|
|
@ -5,7 +5,7 @@ set -x -e
|
||||||
echo "running as" $(id)
|
echo "running as" $(id)
|
||||||
|
|
||||||
: WORKSPACE ${WORKSPACE:=/builds/worker/workspace}
|
: WORKSPACE ${WORKSPACE:=/builds/worker/workspace}
|
||||||
: GRADLE_VERSION ${GRADLE_VERSION:=4.1}
|
: GRADLE_VERSION ${GRADLE_VERSION:=4.4}
|
||||||
|
|
||||||
set -v
|
set -v
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"filename": "mitmproxy-recordings-raptor-gdocs.zip",
|
||||||
|
"size": 26179496,
|
||||||
|
"digest": "eb32218815d3c2187807f3a18d6df1657e01a215820deaaa7a035f06d180780ac9652479ac7db1d8cde3728a890521aff2e0a5c4738304966b2a93ce1b7f33bb",
|
||||||
|
"algorithm": "sha512",
|
||||||
|
"unpack": true
|
||||||
|
}
|
||||||
|
]
|
|
@ -6,3 +6,4 @@
|
||||||
[include:tests/raptor-motionmark-htmlsuite.ini]
|
[include:tests/raptor-motionmark-htmlsuite.ini]
|
||||||
[include:tests/raptor-motionmark-animometer.ini]
|
[include:tests/raptor-motionmark-animometer.ini]
|
||||||
[include:tests/raptor-webaudio.ini]
|
[include:tests/raptor-webaudio.ini]
|
||||||
|
[include:tests/raptor-gdocs.ini]
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
# raptor gdocs
|
||||||
|
|
||||||
|
[DEFAULT]
|
||||||
|
type = pageload
|
||||||
|
playback = mitmproxy
|
||||||
|
playback_binary_manifest = mitmproxy-rel-bin-{platform}.manifest
|
||||||
|
python3_win_manifest = python3{x64}.manifest
|
||||||
|
playback_pageset_manifest = mitmproxy-recordings-raptor-gdocs.manifest
|
||||||
|
page_cycles = 25
|
||||||
|
unit = ms
|
||||||
|
lower_is_better = true
|
||||||
|
alert_threshold = 2.0
|
||||||
|
page_timeout = 30000
|
||||||
|
|
||||||
|
[raptor-google-docs-firefox]
|
||||||
|
apps = firefox
|
||||||
|
test_url = https://docs.google.com/document/d/1US-07msg12slQtI_xchzYxcKlTs6Fp7WqIc6W5GK5M8/edit?usp=sharing
|
||||||
|
playback_recordings = google-docs.mp
|
||||||
|
measure = fnbpaint
|
||||||
|
|
||||||
|
[raptor-google-sheets-firefox]
|
||||||
|
apps = firefox
|
||||||
|
test_url = https://docs.google.com/spreadsheets/d/1jT9qfZFAeqNoOK97gruc34Zb7y_Q-O_drZ8kSXT-4D4/edit?usp=sharing
|
||||||
|
playback_recordings = google-sheets.mp
|
||||||
|
measure = fnbpaint
|
||||||
|
|
||||||
|
[raptor-google-slides-firefox]
|
||||||
|
apps = firefox
|
||||||
|
test_url = https://docs.google.com/presentation/d/1Ici0ceWwpFvmIb3EmKeWSq_vAQdmmdFcWqaiLqUkJng/edit?usp=sharing
|
||||||
|
playback_recordings = google-slides.mp
|
||||||
|
measure = fnbpaint
|
||||||
|
|
||||||
|
[raptor-google-docs-chrome]
|
||||||
|
apps = chrome
|
||||||
|
test_url = https://docs.google.com/document/d/1US-07msg12slQtI_xchzYxcKlTs6Fp7WqIc6W5GK5M8/edit?usp=sharing
|
||||||
|
playback_recordings = google-docs.mp
|
||||||
|
measure = fcp
|
||||||
|
|
||||||
|
[raptor-google-sheets-chrome]
|
||||||
|
apps = chrome
|
||||||
|
test_url = https://docs.google.com/spreadsheets/d/1jT9qfZFAeqNoOK97gruc34Zb7y_Q-O_drZ8kSXT-4D4/edit?usp=sharing
|
||||||
|
playback_recordings = google-sheets.mp
|
||||||
|
measure = fcp
|
||||||
|
|
||||||
|
[raptor-google-slides-chrome]
|
||||||
|
apps = chrome
|
||||||
|
test_url = https://docs.google.com/presentation/d/1Ici0ceWwpFvmIb3EmKeWSq_vAQdmmdFcWqaiLqUkJng/edit?usp=sharing
|
||||||
|
playback_recordings = google-slides.mp
|
||||||
|
measure = fcp
|
|
@ -15,19 +15,19 @@ unit = ms
|
||||||
lower_is_better = true
|
lower_is_better = true
|
||||||
alert_threshold = 2.0
|
alert_threshold = 2.0
|
||||||
|
|
||||||
[raptor-firefox-tp6-amazon]
|
[raptor-tp6-amazon-firefox]
|
||||||
apps = firefox
|
apps = firefox
|
||||||
test_url = https://www.amazon.com/s/url=search-alias%3Daps&field-keywords=laptop
|
test_url = https://www.amazon.com/s/url=search-alias%3Daps&field-keywords=laptop
|
||||||
playback_recordings = amazon.mp
|
playback_recordings = amazon.mp
|
||||||
measure = fnbpaint
|
measure = fnbpaint
|
||||||
|
|
||||||
[raptor-firefox-tp6-facebook]
|
[raptor-tp6-facebook-firefox]
|
||||||
apps = firefox
|
apps = firefox
|
||||||
test_url = https://www.facebook.com
|
test_url = https://www.facebook.com
|
||||||
playback_recordings = facebook.mp
|
playback_recordings = facebook.mp
|
||||||
measure = fnbpaint
|
measure = fnbpaint
|
||||||
|
|
||||||
[raptor-firefox-tp6-google]
|
[raptor-tp6-google-firefox]
|
||||||
apps = firefox
|
apps = firefox
|
||||||
# note: use the full url as the first part (without '&cad=h') redirects
|
# note: use the full url as the first part (without '&cad=h') redirects
|
||||||
# to the url + '&cad=h'; that redirection causes measure.js content
|
# to the url + '&cad=h'; that redirection causes measure.js content
|
||||||
|
@ -36,31 +36,31 @@ test_url = https://www.google.com/search?hl=en&q=barack+obama&cad=h
|
||||||
playback_recordings = google-search.mp
|
playback_recordings = google-search.mp
|
||||||
measure = fnbpaint
|
measure = fnbpaint
|
||||||
|
|
||||||
[raptor-firefox-tp6-youtube]
|
[raptor-tp6-youtube-firefox]
|
||||||
apps = firefox
|
apps = firefox
|
||||||
test_url = https://www.youtube.com
|
test_url = https://www.youtube.com
|
||||||
playback_recordings = youtube.mp
|
playback_recordings = youtube.mp
|
||||||
measure = fnbpaint
|
measure = fnbpaint
|
||||||
|
|
||||||
[raptor-chrome-tp6-amazon]
|
[raptor-tp6-amazon-chrome]
|
||||||
apps = chrome
|
apps = chrome
|
||||||
test_url = https://www.amazon.com/s/url=search-alias%3Daps&field-keywords=laptop
|
test_url = https://www.amazon.com/s/url=search-alias%3Daps&field-keywords=laptop
|
||||||
playback_recordings = amazon.mp
|
playback_recordings = amazon.mp
|
||||||
measure = fcp
|
measure = fcp
|
||||||
|
|
||||||
[raptor-chrome-tp6-facebook]
|
[raptor-tp6-facebook-chrome]
|
||||||
apps = chrome
|
apps = chrome
|
||||||
test_url = https://www.facebook.com
|
test_url = https://www.facebook.com
|
||||||
playback_recordings = facebook.mp
|
playback_recordings = facebook.mp
|
||||||
measure = fcp
|
measure = fcp
|
||||||
|
|
||||||
[raptor-chrome-tp6-google]
|
[raptor-tp6-google-chrome]
|
||||||
apps = chrome
|
apps = chrome
|
||||||
test_url = https://www.google.com/#hl=en&q=barack+obama
|
test_url = https://www.google.com/#hl=en&q=barack+obama
|
||||||
playback_recordings = google-search.mp
|
playback_recordings = google-search.mp
|
||||||
measure = fcp
|
measure = fcp
|
||||||
|
|
||||||
[raptor-chrome-tp6-youtube]
|
[raptor-tp6-youtube-chrome]
|
||||||
apps = chrome
|
apps = chrome
|
||||||
test_url = https://www.youtube.com
|
test_url = https://www.youtube.com
|
||||||
playback_recordings = youtube.mp
|
playback_recordings = youtube.mp
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
[ctor-constantsource.html]
|
|
||||||
[X node0.channelCount is not equal to 2. Got 1.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[< [default constructor\] 1 out of 8 assertions were failed.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[# AUDIT TASK RUNNER FINISHED: 1 out of 3 tasks were failed.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ var DownloadHistory = {
|
||||||
Services.io.newURI(download.source.url),
|
Services.io.newURI(download.source.url),
|
||||||
METADATA_ANNO,
|
METADATA_ANNO,
|
||||||
JSON.stringify(metaData), 0,
|
JSON.stringify(metaData), 0,
|
||||||
PlacesUtils.annotations.EXPIRE_WITH_HISTORY);
|
PlacesUtils.annotations.EXPIRE_NEVER);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
Cu.reportError(ex);
|
Cu.reportError(ex);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1365,6 +1365,34 @@ var Bookmarks = Object.freeze({
|
||||||
throw new Error("Not yet implemented");
|
throw new Error("Not yet implemented");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch all the existing tags, sorted alphabetically.
|
||||||
|
* @return {Promise} resolves to an array of objects representing tags, when
|
||||||
|
* fetching is complete.
|
||||||
|
* Each object looks like {
|
||||||
|
* name: the name of the tag,
|
||||||
|
* count: number of bookmarks with this tag
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
async fetchTags() {
|
||||||
|
// TODO: Once the tagging API is implemented in Bookmarks.jsm, we can cache
|
||||||
|
// the list of tags, instead of querying every time.
|
||||||
|
let db = await PlacesUtils.promiseDBConnection();
|
||||||
|
let rows = await db.executeCached(`
|
||||||
|
SELECT b.title AS name, count(*) AS count
|
||||||
|
FROM moz_bookmarks b
|
||||||
|
JOIN moz_bookmarks p ON b.parent = p.id
|
||||||
|
JOIN moz_bookmarks c ON c.parent = b.id
|
||||||
|
WHERE p.guid = :tagsGuid
|
||||||
|
GROUP BY name
|
||||||
|
ORDER BY name COLLATE nocase ASC
|
||||||
|
`, { tagsGuid: this.tagsGuid });
|
||||||
|
return rows.map(r => ({
|
||||||
|
name: r.getResultByName("name"),
|
||||||
|
count: r.getResultByName("count")
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reorders contents of a folder based on a provided array of GUIDs.
|
* Reorders contents of a folder based on a provided array of GUIDs.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1525,7 +1525,7 @@ public:
|
||||||
DESTINATIONFILEURI_ANNO,
|
DESTINATIONFILEURI_ANNO,
|
||||||
NS_ConvertUTF8toUTF16(destinationURISpec),
|
NS_ConvertUTF8toUTF16(destinationURISpec),
|
||||||
0,
|
0,
|
||||||
nsIAnnotationService::EXPIRE_WITH_HISTORY
|
nsIAnnotationService::EXPIRE_NEVER
|
||||||
);
|
);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
|
|
@ -801,19 +801,15 @@ var clear = async function(db) {
|
||||||
EXCEPT
|
EXCEPT
|
||||||
SELECT icon_id FROM moz_icons_to_pages
|
SELECT icon_id FROM moz_icons_to_pages
|
||||||
)`);
|
)`);
|
||||||
|
await db.executeCached(`DELETE FROM moz_icons
|
||||||
|
WHERE root = 1
|
||||||
|
AND get_host_and_port(icon_url) NOT IN (SELECT host FROM moz_origins)
|
||||||
|
AND fixup_url(get_host_and_port(icon_url)) NOT IN (SELECT host FROM moz_origins)`);
|
||||||
|
|
||||||
// Expire annotations.
|
// Expire annotations.
|
||||||
await db.execute(`DELETE FROM moz_items_annos WHERE expiration = :expire_session`,
|
await db.execute(`DELETE FROM moz_annos WHERE NOT EXISTS (
|
||||||
{ expire_session: Ci.nsIAnnotationService.EXPIRE_SESSION });
|
SELECT 1 FROM moz_places WHERE id = place_id
|
||||||
await db.execute(`DELETE FROM moz_annos WHERE id in (
|
)`);
|
||||||
SELECT a.id FROM moz_annos a
|
|
||||||
LEFT JOIN moz_places h ON a.place_id = h.id
|
|
||||||
WHERE h.id IS NULL
|
|
||||||
OR expiration = :expire_session
|
|
||||||
OR (expiration = :expire_with_history
|
|
||||||
AND h.last_visit_date ISNULL)
|
|
||||||
)`, { expire_session: Ci.nsIAnnotationService.EXPIRE_SESSION,
|
|
||||||
expire_with_history: Ci.nsIAnnotationService.EXPIRE_WITH_HISTORY });
|
|
||||||
|
|
||||||
// Expire inputhistory.
|
// Expire inputhistory.
|
||||||
await db.execute(`DELETE FROM moz_inputhistory WHERE place_id IN (
|
await db.execute(`DELETE FROM moz_inputhistory WHERE place_id IN (
|
||||||
|
@ -894,6 +890,10 @@ var cleanupPages = async function(db, pages) {
|
||||||
EXCEPT
|
EXCEPT
|
||||||
SELECT icon_id FROM moz_icons_to_pages
|
SELECT icon_id FROM moz_icons_to_pages
|
||||||
)`);
|
)`);
|
||||||
|
await db.executeCached(`DELETE FROM moz_icons
|
||||||
|
WHERE root = 1
|
||||||
|
AND get_host_and_port(icon_url) NOT IN (SELECT host FROM moz_origins)
|
||||||
|
AND fixup_url(get_host_and_port(icon_url)) NOT IN (SELECT host FROM moz_origins)`);
|
||||||
|
|
||||||
await db.execute(`DELETE FROM moz_annos
|
await db.execute(`DELETE FROM moz_annos
|
||||||
WHERE place_id IN ( ${ idsList } )`);
|
WHERE place_id IN ( ${ idsList } )`);
|
||||||
|
|
|
@ -536,6 +536,13 @@ var PlacesDBUtils = {
|
||||||
)`
|
)`
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{ query:
|
||||||
|
`DELETE FROM moz_icons
|
||||||
|
WHERE root = 1
|
||||||
|
AND get_host_and_port(icon_url) NOT IN (SELECT host FROM moz_origins)
|
||||||
|
AND fixup_url(get_host_and_port(icon_url)) NOT IN (SELECT host FROM moz_origins)`
|
||||||
|
},
|
||||||
|
|
||||||
// MOZ_HISTORYVISITS
|
// MOZ_HISTORYVISITS
|
||||||
// F.1 remove orphan visits
|
// F.1 remove orphan visits
|
||||||
{ query:
|
{ query:
|
||||||
|
|
|
@ -292,12 +292,12 @@ function originQuery(conditions = "", bookmarkedFragment = "NULL") {
|
||||||
return `${SQL_AUTOFILL_WITH}
|
return `${SQL_AUTOFILL_WITH}
|
||||||
SELECT :query_type,
|
SELECT :query_type,
|
||||||
fixed_up_host || '/',
|
fixed_up_host || '/',
|
||||||
prefix || moz_origins.host || '/',
|
IFNULL(:prefix, prefix) || moz_origins.host || '/',
|
||||||
frecency,
|
frecency,
|
||||||
bookmarked,
|
bookmarked,
|
||||||
id
|
id
|
||||||
FROM (
|
FROM (
|
||||||
SELECT host AS host,
|
SELECT host,
|
||||||
host AS fixed_up_host,
|
host AS fixed_up_host,
|
||||||
TOTAL(frecency) AS host_frecency,
|
TOTAL(frecency) AS host_frecency,
|
||||||
${bookmarkedFragment} AS bookmarked
|
${bookmarkedFragment} AS bookmarked
|
||||||
|
@ -307,7 +307,7 @@ function originQuery(conditions = "", bookmarkedFragment = "NULL") {
|
||||||
GROUP BY host
|
GROUP BY host
|
||||||
HAVING host_frecency >= ${SQL_AUTOFILL_FRECENCY_THRESHOLD}
|
HAVING host_frecency >= ${SQL_AUTOFILL_FRECENCY_THRESHOLD}
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT host AS host,
|
SELECT host,
|
||||||
fixup_url(host) AS fixed_up_host,
|
fixup_url(host) AS fixed_up_host,
|
||||||
TOTAL(frecency) AS host_frecency,
|
TOTAL(frecency) AS host_frecency,
|
||||||
${bookmarkedFragment} AS bookmarked
|
${bookmarkedFragment} AS bookmarked
|
||||||
|
@ -2436,7 +2436,6 @@ Search.prototype = {
|
||||||
|
|
||||||
let bookmarked = this.hasBehavior("bookmark") &&
|
let bookmarked = this.hasBehavior("bookmark") &&
|
||||||
!this.hasBehavior("history");
|
!this.hasBehavior("history");
|
||||||
|
|
||||||
if (this._strippedPrefix) {
|
if (this._strippedPrefix) {
|
||||||
opts.prefix = this._strippedPrefix;
|
opts.prefix = this._strippedPrefix;
|
||||||
if (bookmarked) {
|
if (bookmarked) {
|
||||||
|
|
|
@ -140,13 +140,11 @@ PLACES_FACTORY_SINGLETON_IMPLEMENTATION(nsAnnotationService, gAnnotationService)
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(nsAnnotationService
|
NS_IMPL_ISUPPORTS(nsAnnotationService
|
||||||
, nsIAnnotationService
|
, nsIAnnotationService
|
||||||
, nsIObserver
|
|
||||||
, nsISupportsWeakReference
|
, nsISupportsWeakReference
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
nsAnnotationService::nsAnnotationService()
|
nsAnnotationService::nsAnnotationService()
|
||||||
: mHasSessionAnnotations(false)
|
|
||||||
{
|
{
|
||||||
NS_ASSERTION(!gAnnotationService,
|
NS_ASSERTION(!gAnnotationService,
|
||||||
"Attempting to create two instances of the service!");
|
"Attempting to create two instances of the service!");
|
||||||
|
@ -169,11 +167,6 @@ nsAnnotationService::Init()
|
||||||
mDB = Database::GetDatabase();
|
mDB = Database::GetDatabase();
|
||||||
NS_ENSURE_STATE(mDB);
|
NS_ENSURE_STATE(mDB);
|
||||||
|
|
||||||
nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService();
|
|
||||||
if (obsSvc) {
|
|
||||||
(void)obsSvc->AddObserver(this, TOPIC_PLACES_SHUTDOWN, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,9 +295,6 @@ nsAnnotationService::SetItemAnnotation(int64_t aItemId,
|
||||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||||
NS_ENSURE_ARG(aValue);
|
NS_ENSURE_ARG(aValue);
|
||||||
|
|
||||||
if (aExpiration == EXPIRE_WITH_HISTORY)
|
|
||||||
return NS_ERROR_INVALID_ARG;
|
|
||||||
|
|
||||||
uint16_t dataType;
|
uint16_t dataType;
|
||||||
nsresult rv = aValue->GetDataType(&dataType);
|
nsresult rv = aValue->GetDataType(&dataType);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
@ -407,9 +397,6 @@ nsAnnotationService::SetItemAnnotationString(int64_t aItemId,
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||||
|
|
||||||
if (aExpiration == EXPIRE_WITH_HISTORY)
|
|
||||||
return NS_ERROR_INVALID_ARG;
|
|
||||||
|
|
||||||
BookmarkData bookmark;
|
BookmarkData bookmark;
|
||||||
nsresult rv = SetAnnotationStringInternal(nullptr, aItemId, &bookmark, aName,
|
nsresult rv = SetAnnotationStringInternal(nullptr, aItemId, &bookmark, aName,
|
||||||
aValue, aFlags, aExpiration);
|
aValue, aFlags, aExpiration);
|
||||||
|
@ -484,9 +471,6 @@ nsAnnotationService::SetItemAnnotationInt32(int64_t aItemId,
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||||
|
|
||||||
if (aExpiration == EXPIRE_WITH_HISTORY)
|
|
||||||
return NS_ERROR_INVALID_ARG;
|
|
||||||
|
|
||||||
BookmarkData bookmark;
|
BookmarkData bookmark;
|
||||||
nsresult rv = SetAnnotationInt32Internal(nullptr, aItemId, &bookmark, aName,
|
nsresult rv = SetAnnotationInt32Internal(nullptr, aItemId, &bookmark, aName,
|
||||||
aValue, aFlags, aExpiration);
|
aValue, aFlags, aExpiration);
|
||||||
|
@ -561,9 +545,6 @@ nsAnnotationService::SetItemAnnotationInt64(int64_t aItemId,
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||||
|
|
||||||
if (aExpiration == EXPIRE_WITH_HISTORY)
|
|
||||||
return NS_ERROR_INVALID_ARG;
|
|
||||||
|
|
||||||
BookmarkData bookmark;
|
BookmarkData bookmark;
|
||||||
nsresult rv = SetAnnotationInt64Internal(nullptr, aItemId, &bookmark, aName,
|
nsresult rv = SetAnnotationInt64Internal(nullptr, aItemId, &bookmark, aName,
|
||||||
aValue, aFlags, aExpiration);
|
aValue, aFlags, aExpiration);
|
||||||
|
@ -638,9 +619,6 @@ nsAnnotationService::SetItemAnnotationDouble(int64_t aItemId,
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_MIN(aItemId, 1);
|
NS_ENSURE_ARG_MIN(aItemId, 1);
|
||||||
|
|
||||||
if (aExpiration == EXPIRE_WITH_HISTORY)
|
|
||||||
return NS_ERROR_INVALID_ARG;
|
|
||||||
|
|
||||||
BookmarkData bookmark;
|
BookmarkData bookmark;
|
||||||
nsresult rv = SetAnnotationDoubleInternal(nullptr, aItemId, &bookmark,
|
nsresult rv = SetAnnotationDoubleInternal(nullptr, aItemId, &bookmark,
|
||||||
aName, aValue, aFlags, aExpiration);
|
aName, aValue, aFlags, aExpiration);
|
||||||
|
@ -1445,11 +1423,10 @@ nsAnnotationService::StartSetAnnotation(nsIURI* aURI,
|
||||||
uint16_t aType,
|
uint16_t aType,
|
||||||
nsCOMPtr<mozIStorageStatement>& aStatement)
|
nsCOMPtr<mozIStorageStatement>& aStatement)
|
||||||
{
|
{
|
||||||
bool isItemAnnotation = (aItemId > 0);
|
MOZ_ASSERT(aExpiration == EXPIRE_NEVER, "Only EXPIRE_NEVER is supported");
|
||||||
|
NS_ENSURE_ARG(aExpiration == EXPIRE_NEVER);
|
||||||
|
|
||||||
if (aExpiration == EXPIRE_SESSION) {
|
bool isItemAnnotation = (aItemId > 0);
|
||||||
mHasSessionAnnotations = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure the annotation name exists.
|
// Ensure the annotation name exists.
|
||||||
nsCOMPtr<mozIStorageStatement> addNameStmt = mDB->GetStatement(
|
nsCOMPtr<mozIStorageStatement> addNameStmt = mDB->GetStatement(
|
||||||
|
@ -1588,51 +1565,3 @@ nsAnnotationService::StartSetAnnotation(nsIURI* aURI,
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//// nsIObserver
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsAnnotationService::Observe(nsISupports *aSubject,
|
|
||||||
const char *aTopic,
|
|
||||||
const char16_t *aData)
|
|
||||||
{
|
|
||||||
NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread");
|
|
||||||
|
|
||||||
if (strcmp(aTopic, TOPIC_PLACES_SHUTDOWN) == 0) {
|
|
||||||
// Remove all session annotations, if any.
|
|
||||||
if (mHasSessionAnnotations) {
|
|
||||||
nsCOMPtr<mozIStorageAsyncStatement> pageAnnoStmt = mDB->GetAsyncStatement(
|
|
||||||
"DELETE FROM moz_annos WHERE expiration = :expire_session"
|
|
||||||
);
|
|
||||||
NS_ENSURE_STATE(pageAnnoStmt);
|
|
||||||
nsresult rv = pageAnnoStmt->BindInt32ByName(NS_LITERAL_CSTRING("expire_session"),
|
|
||||||
EXPIRE_SESSION);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
nsCOMPtr<mozIStorageAsyncStatement> itemAnnoStmt = mDB->GetAsyncStatement(
|
|
||||||
"DELETE FROM moz_items_annos WHERE expiration = :expire_session"
|
|
||||||
);
|
|
||||||
NS_ENSURE_STATE(itemAnnoStmt);
|
|
||||||
rv = itemAnnoStmt->BindInt32ByName(NS_LITERAL_CSTRING("expire_session"),
|
|
||||||
EXPIRE_SESSION);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
mozIStorageBaseStatement *stmts[] = {
|
|
||||||
pageAnnoStmt.get()
|
|
||||||
, itemAnnoStmt.get()
|
|
||||||
};
|
|
||||||
|
|
||||||
nsCOMPtr<mozIStorageConnection> conn = mDB->MainConn();
|
|
||||||
if (!conn) {
|
|
||||||
return NS_ERROR_UNEXPECTED;
|
|
||||||
}
|
|
||||||
nsCOMPtr<mozIStoragePendingStatement> ps;
|
|
||||||
rv = conn->ExecuteAsync(stmts, ArrayLength(stmts), nullptr,
|
|
||||||
getter_AddRefs(ps));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
|
@ -43,14 +43,13 @@ private:
|
||||||
} // namespace places
|
} // namespace places
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
|
|
||||||
class nsAnnotationService final : public nsIAnnotationService
|
class nsAnnotationService final : public nsIAnnotationService
|
||||||
, public nsIObserver
|
|
||||||
, public nsSupportsWeakReference
|
, public nsSupportsWeakReference
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
NS_DECL_NSIANNOTATIONSERVICE
|
NS_DECL_NSIANNOTATIONSERVICE
|
||||||
NS_DECL_NSIOBSERVER
|
|
||||||
|
|
||||||
nsAnnotationService();
|
nsAnnotationService();
|
||||||
|
|
||||||
|
@ -87,7 +86,6 @@ protected:
|
||||||
RefPtr<mozilla::places::Database> mDB;
|
RefPtr<mozilla::places::Database> mDB;
|
||||||
|
|
||||||
nsCOMArray<nsIAnnotationObserver> mObservers;
|
nsCOMArray<nsIAnnotationObserver> mObservers;
|
||||||
bool mHasSessionAnnotations;
|
|
||||||
|
|
||||||
static nsAnnotationService* gAnnotationService;
|
static nsAnnotationService* gAnnotationService;
|
||||||
|
|
||||||
|
|
|
@ -374,11 +374,17 @@ nsFaviconService::SetAndFetchFaviconForPage(nsIURI* aPageURI,
|
||||||
if (StringBeginsWith(icon.host, NS_LITERAL_CSTRING("www."))) {
|
if (StringBeginsWith(icon.host, NS_LITERAL_CSTRING("www."))) {
|
||||||
icon.host.Cut(0, 4);
|
icon.host.Cut(0, 4);
|
||||||
}
|
}
|
||||||
nsAutoCString path;
|
}
|
||||||
rv = aFaviconURI->GetPathQueryRef(path);
|
|
||||||
if (NS_SUCCEEDED(rv) && path.EqualsLiteral("/favicon.ico")) {
|
// A root icon is when the icon and page have the same host and the path
|
||||||
icon.rootIcon = 1;
|
// is just /favicon.ico. These icons are considered valid for the whole
|
||||||
}
|
// origin and expired with the origin through a trigger.
|
||||||
|
nsAutoCString path;
|
||||||
|
if (NS_SUCCEEDED(aFaviconURI->GetPathQueryRef(path)) &&
|
||||||
|
!icon.host.IsEmpty() &&
|
||||||
|
icon.host.Equals(page.host) &&
|
||||||
|
path.EqualsLiteral("/favicon.ico")) {
|
||||||
|
icon.rootIcon = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the page url points to an image, the icon's url will be the same.
|
// If the page url points to an image, the icon's url will be the same.
|
||||||
|
@ -448,17 +454,15 @@ nsFaviconService::ReplaceFaviconData(nsIURI* aFaviconURI,
|
||||||
iconData->fetchMode = FETCH_NEVER;
|
iconData->fetchMode = FETCH_NEVER;
|
||||||
nsresult rv = aFaviconURI->GetSpec(iconData->spec);
|
nsresult rv = aFaviconURI->GetSpec(iconData->spec);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
nsAutoCString path;
|
|
||||||
rv = aFaviconURI->GetPathQueryRef(path);
|
|
||||||
if (NS_SUCCEEDED(rv) && path.EqualsLiteral("/favicon.ico")) {
|
|
||||||
iconData->rootIcon = 1;
|
|
||||||
}
|
|
||||||
// URIs can arguably lack a host.
|
// URIs can arguably lack a host.
|
||||||
Unused << aFaviconURI->GetHost(iconData->host);
|
Unused << aFaviconURI->GetHost(iconData->host);
|
||||||
if (StringBeginsWith(iconData->host, NS_LITERAL_CSTRING("www."))) {
|
if (StringBeginsWith(iconData->host, NS_LITERAL_CSTRING("www."))) {
|
||||||
iconData->host.Cut(0, 4);
|
iconData->host.Cut(0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note we can't set rootIcon here, because don't know the page it will be
|
||||||
|
// associated with. We'll do that later in SetAndFetchFaviconForPage.
|
||||||
|
|
||||||
IconPayload payload;
|
IconPayload payload;
|
||||||
payload.mimeType = aMimeType;
|
payload.mimeType = aMimeType;
|
||||||
payload.data.Assign(TO_CHARBUFFER(aData), aDataLen);
|
payload.data.Assign(TO_CHARBUFFER(aData), aDataLen);
|
||||||
|
|
|
@ -9,6 +9,18 @@ interface nsIURI;
|
||||||
interface nsIVariant;
|
interface nsIVariant;
|
||||||
interface mozIAnnotatedResult;
|
interface mozIAnnotatedResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* THE ANNOTATION SERVICE API IS
|
||||||
|
*
|
||||||
|
* === D E P R E C A T E D ===
|
||||||
|
*
|
||||||
|
* See https://bugzilla.mozilla.org/show_bug.cgi?id=699844
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
[scriptable, uuid(63fe98e0-6889-4c2c-ac9f-703e4bc25027)]
|
[scriptable, uuid(63fe98e0-6889-4c2c-ac9f-703e4bc25027)]
|
||||||
interface nsIAnnotationObserver : nsISupports
|
interface nsIAnnotationObserver : nsISupports
|
||||||
{
|
{
|
||||||
|
@ -40,45 +52,15 @@ interface nsIAnnotationService : nsISupports
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Valid values for aExpiration, which sets the expiration policy for your
|
* Valid values for aExpiration, which sets the expiration policy for your
|
||||||
* annotation. The times for the days, weeks and months policies are
|
* annotation.
|
||||||
* measured since the last visit date of the page in question. These
|
|
||||||
* will not expire so long as the user keeps visiting the page from time
|
|
||||||
* to time.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// For temporary data that can be discarded when the user exits.
|
|
||||||
// Removed at application exit.
|
|
||||||
const unsigned short EXPIRE_SESSION = 0;
|
|
||||||
|
|
||||||
// NOTE: 1 is skipped due to its temporary use as EXPIRE_NEVER in bug #319455.
|
|
||||||
|
|
||||||
// For general page settings, things the user is interested in seeing
|
|
||||||
// if they come back to this page some time in the near future.
|
|
||||||
// Removed at 30 days.
|
|
||||||
const unsigned short EXPIRE_WEEKS = 2;
|
|
||||||
|
|
||||||
// Something that the user will be interested in seeing in their
|
|
||||||
// history like favicons. If they haven't visited a page in a couple
|
|
||||||
// of months, they probably aren't interested in many other annotations,
|
|
||||||
// the positions of things, or other stuff you create, so put that in
|
|
||||||
// the weeks policy.
|
|
||||||
// Removed at 180 days.
|
|
||||||
const unsigned short EXPIRE_MONTHS = 3;
|
|
||||||
|
|
||||||
// For annotations that only live as long as the URI is in the database.
|
// For annotations that only live as long as the URI is in the database.
|
||||||
// A page annotation will expire if the page has no visits
|
// A page annotation will expire if the page has no visits
|
||||||
// and is not bookmarked.
|
// and is not bookmarked.
|
||||||
// An item annotation will expire when the item is deleted.
|
// An item annotation will expire when the item is deleted.
|
||||||
const unsigned short EXPIRE_NEVER = 4;
|
const unsigned short EXPIRE_NEVER = 4;
|
||||||
|
|
||||||
// For annotations that only live as long as the URI has visits.
|
|
||||||
// Valid only for page annotations.
|
|
||||||
const unsigned short EXPIRE_WITH_HISTORY = 5;
|
|
||||||
|
|
||||||
// For short-lived temporary data that you still want to outlast a session.
|
|
||||||
// Removed at 7 days.
|
|
||||||
const unsigned short EXPIRE_DAYS = 6;
|
|
||||||
|
|
||||||
// type constants
|
// type constants
|
||||||
const unsigned short TYPE_INT32 = 1;
|
const unsigned short TYPE_INT32 = 1;
|
||||||
const unsigned short TYPE_DOUBLE = 2;
|
const unsigned short TYPE_DOUBLE = 2;
|
||||||
|
|
|
@ -107,18 +107,8 @@ const IDLE_TIMEOUT_SECONDS = 5 * 60;
|
||||||
// expiration will be more aggressive, to bring back history to a saner size.
|
// expiration will be more aggressive, to bring back history to a saner size.
|
||||||
const OVERLIMIT_PAGES_THRESHOLD = 1000;
|
const OVERLIMIT_PAGES_THRESHOLD = 1000;
|
||||||
|
|
||||||
|
// Milliseconds in a day.
|
||||||
const MSECS_PER_DAY = 86400000;
|
const MSECS_PER_DAY = 86400000;
|
||||||
const ANNOS_EXPIRE_POLICIES = [
|
|
||||||
{ bind: "expire_days",
|
|
||||||
type: Ci.nsIAnnotationService.EXPIRE_DAYS,
|
|
||||||
time: 7 * 1000 * MSECS_PER_DAY },
|
|
||||||
{ bind: "expire_weeks",
|
|
||||||
type: Ci.nsIAnnotationService.EXPIRE_WEEKS,
|
|
||||||
time: 30 * 1000 * MSECS_PER_DAY },
|
|
||||||
{ bind: "expire_months",
|
|
||||||
type: Ci.nsIAnnotationService.EXPIRE_MONTHS,
|
|
||||||
time: 180 * 1000 * MSECS_PER_DAY },
|
|
||||||
];
|
|
||||||
|
|
||||||
// When we expire we can use these limits:
|
// When we expire we can use these limits:
|
||||||
// - SMALL for usual partial expirations, will expire a small chunk.
|
// - SMALL for usual partial expirations, will expire a small chunk.
|
||||||
|
@ -269,42 +259,6 @@ const EXPIRATION_QUERIES = {
|
||||||
ACTION.IDLE_DIRTY | ACTION.IDLE_DAILY | ACTION.DEBUG
|
ACTION.IDLE_DIRTY | ACTION.IDLE_DAILY | ACTION.DEBUG
|
||||||
},
|
},
|
||||||
|
|
||||||
// Expire page annotations based on expiration policy.
|
|
||||||
QUERY_EXPIRE_ANNOS_WITH_POLICY: {
|
|
||||||
sql: `DELETE FROM moz_annos
|
|
||||||
WHERE (expiration = :expire_days
|
|
||||||
AND :expire_days_time > MAX(lastModified, dateAdded))
|
|
||||||
OR (expiration = :expire_weeks
|
|
||||||
AND :expire_weeks_time > MAX(lastModified, dateAdded))
|
|
||||||
OR (expiration = :expire_months
|
|
||||||
AND :expire_months_time > MAX(lastModified, dateAdded))`,
|
|
||||||
actions: ACTION.TIMED | ACTION.TIMED_OVERLIMIT | ACTION.SHUTDOWN_DIRTY |
|
|
||||||
ACTION.IDLE_DIRTY | ACTION.IDLE_DAILY | ACTION.DEBUG
|
|
||||||
},
|
|
||||||
|
|
||||||
// Expire items annotations based on expiration policy.
|
|
||||||
QUERY_EXPIRE_ITEMS_ANNOS_WITH_POLICY: {
|
|
||||||
sql: `DELETE FROM moz_items_annos
|
|
||||||
WHERE (expiration = :expire_days
|
|
||||||
AND :expire_days_time > MAX(lastModified, dateAdded))
|
|
||||||
OR (expiration = :expire_weeks
|
|
||||||
AND :expire_weeks_time > MAX(lastModified, dateAdded))
|
|
||||||
OR (expiration = :expire_months
|
|
||||||
AND :expire_months_time > MAX(lastModified, dateAdded))`,
|
|
||||||
actions: ACTION.TIMED | ACTION.TIMED_OVERLIMIT | ACTION.SHUTDOWN_DIRTY |
|
|
||||||
ACTION.IDLE_DIRTY | ACTION.IDLE_DAILY | ACTION.DEBUG
|
|
||||||
},
|
|
||||||
|
|
||||||
// Expire page annotations based on expiration policy.
|
|
||||||
QUERY_EXPIRE_ANNOS_WITH_HISTORY: {
|
|
||||||
sql: `DELETE FROM moz_annos
|
|
||||||
WHERE expiration = :expire_with_history
|
|
||||||
AND NOT EXISTS (SELECT id FROM moz_historyvisits
|
|
||||||
WHERE place_id = moz_annos.place_id LIMIT 1)`,
|
|
||||||
actions: ACTION.TIMED | ACTION.TIMED_OVERLIMIT | ACTION.SHUTDOWN_DIRTY |
|
|
||||||
ACTION.IDLE_DIRTY | ACTION.IDLE_DAILY | ACTION.DEBUG
|
|
||||||
},
|
|
||||||
|
|
||||||
// Expire item annos without a corresponding item id.
|
// Expire item annos without a corresponding item id.
|
||||||
QUERY_EXPIRE_ITEMS_ANNOS: {
|
QUERY_EXPIRE_ITEMS_ANNOS: {
|
||||||
sql: `DELETE FROM moz_items_annos WHERE id IN (
|
sql: `DELETE FROM moz_items_annos WHERE id IN (
|
||||||
|
@ -332,7 +286,9 @@ const EXPIRATION_QUERIES = {
|
||||||
|
|
||||||
// Expire orphan inputhistory.
|
// Expire orphan inputhistory.
|
||||||
QUERY_EXPIRE_INPUTHISTORY: {
|
QUERY_EXPIRE_INPUTHISTORY: {
|
||||||
sql: `DELETE FROM moz_inputhistory WHERE place_id IN (
|
sql: `DELETE FROM moz_inputhistory
|
||||||
|
WHERE place_id IN (SELECT p_id FROM expiration_notify)
|
||||||
|
AND place_id IN (
|
||||||
SELECT i.place_id FROM moz_inputhistory i
|
SELECT i.place_id FROM moz_inputhistory i
|
||||||
LEFT JOIN moz_places h ON h.id = i.place_id
|
LEFT JOIN moz_places h ON h.id = i.place_id
|
||||||
WHERE h.id IS NULL
|
WHERE h.id IS NULL
|
||||||
|
@ -552,8 +508,10 @@ nsPlacesExpiration.prototype = {
|
||||||
// Adapt expiration aggressivity to the number of pages over the limit.
|
// Adapt expiration aggressivity to the number of pages over the limit.
|
||||||
let limit = overLimitPages > OVERLIMIT_PAGES_THRESHOLD ? LIMIT.LARGE
|
let limit = overLimitPages > OVERLIMIT_PAGES_THRESHOLD ? LIMIT.LARGE
|
||||||
: LIMIT.SMALL;
|
: LIMIT.SMALL;
|
||||||
|
// Run at the first idle, or after a minute, whatever comes first.
|
||||||
this._expireWithActionAndLimit(action, limit);
|
Services.tm.idleDispatchToMainThread(() => {
|
||||||
|
this._expireWithActionAndLimit(action, limit);
|
||||||
|
}, 60000);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -936,17 +894,6 @@ nsPlacesExpiration.prototype = {
|
||||||
// Each page may have multiple annos.
|
// Each page may have multiple annos.
|
||||||
params.limit_annos = baseLimit * EXPIRE_AGGRESSIVITY_MULTIPLIER;
|
params.limit_annos = baseLimit * EXPIRE_AGGRESSIVITY_MULTIPLIER;
|
||||||
break;
|
break;
|
||||||
case "QUERY_EXPIRE_ANNOS_WITH_POLICY":
|
|
||||||
case "QUERY_EXPIRE_ITEMS_ANNOS_WITH_POLICY":
|
|
||||||
let microNow = Date.now() * 1000;
|
|
||||||
ANNOS_EXPIRE_POLICIES.forEach(function(policy) {
|
|
||||||
params[policy.bind] = policy.type;
|
|
||||||
params[policy.bind + "_time"] = microNow - policy.time;
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case "QUERY_EXPIRE_ANNOS_WITH_HISTORY":
|
|
||||||
params.expire_with_history = Ci.nsIAnnotationService.EXPIRE_WITH_HISTORY;
|
|
||||||
break;
|
|
||||||
case "QUERY_EXPIRE_ITEMS_ANNOS":
|
case "QUERY_EXPIRE_ITEMS_ANNOS":
|
||||||
params.limit_annos = baseLimit;
|
params.limit_annos = baseLimit;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -325,18 +325,6 @@ TaggingService.prototype = {
|
||||||
return this.__tagFolders;
|
return this.__tagFolders;
|
||||||
},
|
},
|
||||||
|
|
||||||
// nsITaggingService
|
|
||||||
get allTags() {
|
|
||||||
var allTags = [];
|
|
||||||
for (var i in this._tagFolders)
|
|
||||||
allTags.push(this._tagFolders[i]);
|
|
||||||
// sort the tag list
|
|
||||||
allTags.sort(function(a, b) {
|
|
||||||
return a.toLowerCase().localeCompare(b.toLowerCase());
|
|
||||||
});
|
|
||||||
return allTags;
|
|
||||||
},
|
|
||||||
|
|
||||||
// nsITaggingService
|
// nsITaggingService
|
||||||
get hasTags() {
|
get hasTags() {
|
||||||
return this._tagFolders.length > 0;
|
return this._tagFolders.length > 0;
|
||||||
|
@ -473,7 +461,6 @@ TagAutoCompleteSearch.prototype = {
|
||||||
* @param listener - A listener to notify when the search is complete
|
* @param listener - A listener to notify when the search is complete
|
||||||
*/
|
*/
|
||||||
startSearch(searchString, searchParam, previousResult, listener) {
|
startSearch(searchString, searchParam, previousResult, listener) {
|
||||||
let searchResults = PlacesUtils.tagging.allTags;
|
|
||||||
this._stopped = false;
|
this._stopped = false;
|
||||||
|
|
||||||
// only search on characters for the last tag
|
// only search on characters for the last tag
|
||||||
|
@ -503,29 +490,33 @@ TagAutoCompleteSearch.prototype = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Chunk the search results via a generator.
|
(async () => {
|
||||||
let gen = (function* () {
|
let tags = (await PlacesUtils.bookmarks.fetchTags())
|
||||||
for (let i = 0; i < searchResults.length; ++i) {
|
.filter(t => t.name.toLowerCase().startsWith(searchString.toLowerCase()))
|
||||||
if (this._stopped)
|
.map(t => t.name);
|
||||||
yield false;
|
|
||||||
|
// Chunk the search results via a generator.
|
||||||
|
let gen = (function* () {
|
||||||
|
for (let i = 0; i < tags.length; ++i) {
|
||||||
|
if (this._stopped)
|
||||||
|
yield false;
|
||||||
|
|
||||||
if (searchResults[i].toLowerCase().startsWith(searchString.toLowerCase())) {
|
|
||||||
// For each match, prepend what the user has typed so far.
|
// For each match, prepend what the user has typed so far.
|
||||||
count++;
|
count++;
|
||||||
result.appendMatch(before + searchResults[i], searchResults[i]);
|
result.appendMatch(before + tags[i], tags[i]);
|
||||||
}
|
|
||||||
|
|
||||||
// In case of many tags, notify once every 50 loops.
|
// In case of many tags, notify once every 10 loops.
|
||||||
if ((i % 10) == 0) {
|
if ((i % 10) == 0) {
|
||||||
this.notifyResult(result, count, listener, true);
|
this.notifyResult(result, count, listener, true);
|
||||||
yield true;
|
yield true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
yield false;
|
||||||
yield false;
|
}.bind(this))();
|
||||||
}.bind(this))();
|
|
||||||
|
|
||||||
while (gen.next().value);
|
while (gen.next().value);
|
||||||
this.notifyResult(result, count, listener, false);
|
this.notifyResult(result, count, listener, false);
|
||||||
|
})();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -34,7 +34,7 @@ add_task(async function test_eraseEverything() {
|
||||||
url: "http://mozilla.org/" });
|
url: "http://mozilla.org/" });
|
||||||
checkBookmarkObject(unfiledBookmarkInFolder);
|
checkBookmarkObject(unfiledBookmarkInFolder);
|
||||||
PlacesUtils.annotations.setItemAnnotation((await PlacesUtils.promiseItemId(unfiledBookmarkInFolder.guid)),
|
PlacesUtils.annotations.setItemAnnotation((await PlacesUtils.promiseItemId(unfiledBookmarkInFolder.guid)),
|
||||||
"testanno1", "testvalue1", 0, 0);
|
"testanno1", "testvalue1", 0, PlacesUtils.annotations.EXPIRE_NEVER);
|
||||||
|
|
||||||
let menuFolder = await PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.menuGuid,
|
let menuFolder = await PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.menuGuid,
|
||||||
type: PlacesUtils.bookmarks.TYPE_FOLDER });
|
type: PlacesUtils.bookmarks.TYPE_FOLDER });
|
||||||
|
@ -49,7 +49,7 @@ add_task(async function test_eraseEverything() {
|
||||||
url: "http://mozilla.org/" });
|
url: "http://mozilla.org/" });
|
||||||
checkBookmarkObject(menuBookmarkInFolder);
|
checkBookmarkObject(menuBookmarkInFolder);
|
||||||
PlacesUtils.annotations.setItemAnnotation((await PlacesUtils.promiseItemId(menuBookmarkInFolder.guid)),
|
PlacesUtils.annotations.setItemAnnotation((await PlacesUtils.promiseItemId(menuBookmarkInFolder.guid)),
|
||||||
"testanno1", "testvalue1", 0, 0);
|
"testanno1", "testvalue1", 0, PlacesUtils.annotations.EXPIRE_NEVER);
|
||||||
|
|
||||||
let toolbarFolder = await PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.toolbarGuid,
|
let toolbarFolder = await PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.toolbarGuid,
|
||||||
type: PlacesUtils.bookmarks.TYPE_FOLDER });
|
type: PlacesUtils.bookmarks.TYPE_FOLDER });
|
||||||
|
@ -64,7 +64,7 @@ add_task(async function test_eraseEverything() {
|
||||||
url: "http://mozilla.org/" });
|
url: "http://mozilla.org/" });
|
||||||
checkBookmarkObject(toolbarBookmarkInFolder);
|
checkBookmarkObject(toolbarBookmarkInFolder);
|
||||||
PlacesUtils.annotations.setItemAnnotation((await PlacesUtils.promiseItemId(toolbarBookmarkInFolder.guid)),
|
PlacesUtils.annotations.setItemAnnotation((await PlacesUtils.promiseItemId(toolbarBookmarkInFolder.guid)),
|
||||||
"testanno1", "testvalue1", 0, 0);
|
"testanno1", "testvalue1", 0, PlacesUtils.annotations.EXPIRE_NEVER);
|
||||||
|
|
||||||
await PlacesTestUtils.promiseAsyncUpdates();
|
await PlacesTestUtils.promiseAsyncUpdates();
|
||||||
Assert.ok(frecencyForUrl("http://example.com/") > frecencyForExample);
|
Assert.ok(frecencyForUrl("http://example.com/") > frecencyForExample);
|
||||||
|
|
|
@ -130,7 +130,7 @@ add_task(async function remove_bookmark_orphans() {
|
||||||
title: "a bookmark" });
|
title: "a bookmark" });
|
||||||
checkBookmarkObject(bm1);
|
checkBookmarkObject(bm1);
|
||||||
PlacesUtils.annotations.setItemAnnotation((await PlacesUtils.promiseItemId(bm1.guid)),
|
PlacesUtils.annotations.setItemAnnotation((await PlacesUtils.promiseItemId(bm1.guid)),
|
||||||
"testanno", "testvalue", 0, 0);
|
"testanno", "testvalue", 0, PlacesUtils.annotations.EXPIRE_NEVER);
|
||||||
|
|
||||||
await PlacesUtils.bookmarks.remove(bm1.guid);
|
await PlacesUtils.bookmarks.remove(bm1.guid);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
add_task(async function() {
|
||||||
|
let tags = await PlacesUtils.bookmarks.fetchTags();
|
||||||
|
Assert.deepEqual(tags, []);
|
||||||
|
|
||||||
|
let bm = await PlacesUtils.bookmarks.insert({
|
||||||
|
url: "http://page1.com/",
|
||||||
|
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
|
});
|
||||||
|
|
||||||
|
PlacesUtils.tagging.tagURI(Services.io.newURI(bm.url.href), ["1", "2"]);
|
||||||
|
tags = await PlacesUtils.bookmarks.fetchTags();
|
||||||
|
Assert.deepEqual(tags, [
|
||||||
|
{ name: "1", count: 1 },
|
||||||
|
{ name: "2", count: 1 },
|
||||||
|
]);
|
||||||
|
|
||||||
|
PlacesUtils.tagging.untagURI(Services.io.newURI(bm.url.href), ["1"]);
|
||||||
|
tags = await PlacesUtils.bookmarks.fetchTags();
|
||||||
|
Assert.deepEqual(tags, [
|
||||||
|
{ name: "2", count: 1 },
|
||||||
|
]);
|
||||||
|
|
||||||
|
let bm2 = await PlacesUtils.bookmarks.insert({
|
||||||
|
url: "http://page2.com/",
|
||||||
|
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
|
});
|
||||||
|
PlacesUtils.tagging.tagURI(Services.io.newURI(bm2.url.href), ["2", "3"]);
|
||||||
|
tags = await PlacesUtils.bookmarks.fetchTags();
|
||||||
|
Assert.deepEqual(tags, [
|
||||||
|
{ name: "2", count: 2 },
|
||||||
|
{ name: "3", count: 1 },
|
||||||
|
]);
|
||||||
|
});
|
|
@ -41,4 +41,5 @@ firefox-appdir = browser
|
||||||
[test_removeFolderTransaction_reinsert.js]
|
[test_removeFolderTransaction_reinsert.js]
|
||||||
[test_savedsearches.js]
|
[test_savedsearches.js]
|
||||||
[test_sync_fields.js]
|
[test_sync_fields.js]
|
||||||
|
[test_tags.js]
|
||||||
[test_untitled.js]
|
[test_untitled.js]
|
||||||
|
|
|
@ -1,89 +0,0 @@
|
||||||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
|
|
||||||
* vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* What this is aimed to test:
|
|
||||||
*
|
|
||||||
* EXPIRE_WITH_HISTORY annotations should be expired when a page has no more
|
|
||||||
* visits, even if the page still exists in the database.
|
|
||||||
* This expiration policy is only valid for page annotations.
|
|
||||||
*/
|
|
||||||
|
|
||||||
var as = Cc["@mozilla.org/browser/annotation-service;1"].
|
|
||||||
getService(Ci.nsIAnnotationService);
|
|
||||||
|
|
||||||
add_task(async function test_annos_expire_history() {
|
|
||||||
// Set interval to a large value so we don't expire on it.
|
|
||||||
setInterval(3600); // 1h
|
|
||||||
|
|
||||||
// Expire all expirable pages.
|
|
||||||
setMaxPages(0);
|
|
||||||
|
|
||||||
// Add some visited page and a couple expire with history annotations for each.
|
|
||||||
let now = getExpirablePRTime();
|
|
||||||
for (let i = 0; i < 5; i++) {
|
|
||||||
let pageURI = uri("http://page_anno." + i + ".mozilla.org/");
|
|
||||||
await PlacesTestUtils.addVisits({ uri: pageURI, visitDate: now++ });
|
|
||||||
as.setPageAnnotation(pageURI, "page_expire1", "test", 0, as.EXPIRE_WITH_HISTORY);
|
|
||||||
as.setPageAnnotation(pageURI, "page_expire2", "test", 0, as.EXPIRE_WITH_HISTORY);
|
|
||||||
}
|
|
||||||
|
|
||||||
let pages = await getPagesWithAnnotation("page_expire1");
|
|
||||||
Assert.equal(pages.length, 5);
|
|
||||||
pages = await getPagesWithAnnotation("page_expire2");
|
|
||||||
Assert.equal(pages.length, 5);
|
|
||||||
|
|
||||||
// Add some bookmarked page and a couple session annotations for each.
|
|
||||||
for (let i = 0; i < 5; i++) {
|
|
||||||
let pageURI = uri("http://item_anno." + i + ".mozilla.org/");
|
|
||||||
// We also add a visit before bookmarking.
|
|
||||||
await PlacesTestUtils.addVisits({ uri: pageURI, visitDate: now++ });
|
|
||||||
await PlacesUtils.bookmarks.insert({
|
|
||||||
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
|
||||||
url: pageURI,
|
|
||||||
title: null
|
|
||||||
});
|
|
||||||
// Notice we use page annotations here, items annotations can't use this
|
|
||||||
// kind of expiration policy.
|
|
||||||
as.setPageAnnotation(pageURI, "item_persist1", "test", 0, as.EXPIRE_WITH_HISTORY);
|
|
||||||
as.setPageAnnotation(pageURI, "item_persist2", "test", 0, as.EXPIRE_WITH_HISTORY);
|
|
||||||
}
|
|
||||||
|
|
||||||
let items = await getPagesWithAnnotation("item_persist1");
|
|
||||||
Assert.equal(items.length, 5);
|
|
||||||
items = await getPagesWithAnnotation("item_persist2");
|
|
||||||
Assert.equal(items.length, 5);
|
|
||||||
|
|
||||||
// Add other visited page and a couple expire with history annotations for each.
|
|
||||||
// We won't expire these visits, so the annotations should survive.
|
|
||||||
for (let i = 0; i < 5; i++) {
|
|
||||||
let pageURI = uri("http://persist_page_anno." + i + ".mozilla.org/");
|
|
||||||
await PlacesTestUtils.addVisits({ uri: pageURI, visitDate: now++ });
|
|
||||||
as.setPageAnnotation(pageURI, "page_persist1", "test", 0, as.EXPIRE_WITH_HISTORY);
|
|
||||||
as.setPageAnnotation(pageURI, "page_persist2", "test", 0, as.EXPIRE_WITH_HISTORY);
|
|
||||||
}
|
|
||||||
|
|
||||||
pages = await getPagesWithAnnotation("page_persist1");
|
|
||||||
Assert.equal(pages.length, 5);
|
|
||||||
pages = await getPagesWithAnnotation("page_persist2");
|
|
||||||
Assert.equal(pages.length, 5);
|
|
||||||
|
|
||||||
// Expire all visits for the first 5 pages and the bookmarks.
|
|
||||||
await promiseForceExpirationStep(10);
|
|
||||||
|
|
||||||
pages = await getPagesWithAnnotation("page_expire1");
|
|
||||||
Assert.equal(pages.length, 0);
|
|
||||||
pages = await getPagesWithAnnotation("page_expire2");
|
|
||||||
Assert.equal(pages.length, 0);
|
|
||||||
items = await getItemsWithAnnotation("item_persist1");
|
|
||||||
Assert.equal(items.length, 0);
|
|
||||||
items = await getItemsWithAnnotation("item_persist2");
|
|
||||||
Assert.equal(items.length, 0);
|
|
||||||
pages = await getPagesWithAnnotation("page_persist1");
|
|
||||||
Assert.equal(pages.length, 5);
|
|
||||||
pages = await getPagesWithAnnotation("page_persist2");
|
|
||||||
Assert.equal(pages.length, 5);
|
|
||||||
});
|
|
|
@ -1,182 +0,0 @@
|
||||||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
|
|
||||||
* vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* What this is aimed to test:
|
|
||||||
*
|
|
||||||
* Annotations can be set with a timed expiration policy.
|
|
||||||
* Supported policies are:
|
|
||||||
* - EXPIRE_DAYS: annotation would be expired after 7 days
|
|
||||||
* - EXPIRE_WEEKS: annotation would be expired after 30 days
|
|
||||||
* - EXPIRE_MONTHS: annotation would be expired after 180 days
|
|
||||||
*/
|
|
||||||
|
|
||||||
var as = Cc["@mozilla.org/browser/annotation-service;1"].
|
|
||||||
getService(Ci.nsIAnnotationService);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an aged annotation.
|
|
||||||
*
|
|
||||||
* @param aIdentifier Either a page url or an item id.
|
|
||||||
* @param aIdentifier Name of the annotation.
|
|
||||||
* @param aValue Value for the annotation.
|
|
||||||
* @param aExpirePolicy Expiration policy of the annotation.
|
|
||||||
* @param aAgeInDays Age in days of the annotation.
|
|
||||||
* @param [optional] aLastModifiedAgeInDays Age in days of the annotation, for lastModified.
|
|
||||||
*/
|
|
||||||
var now = Date.now();
|
|
||||||
function add_old_anno(aIdentifier, aName, aValue, aExpirePolicy,
|
|
||||||
aAgeInDays, aLastModifiedAgeInDays) {
|
|
||||||
let expireDate = (now - (aAgeInDays * 86400 * 1000)) * 1000;
|
|
||||||
let lastModifiedDate = 0;
|
|
||||||
if (aLastModifiedAgeInDays)
|
|
||||||
lastModifiedDate = (now - (aLastModifiedAgeInDays * 86400 * 1000)) * 1000;
|
|
||||||
|
|
||||||
let sql;
|
|
||||||
if (typeof(aIdentifier) == "number") {
|
|
||||||
// Item annotation.
|
|
||||||
as.setItemAnnotation(aIdentifier, aName, aValue, 0, aExpirePolicy);
|
|
||||||
// Update dateAdded for the last added annotation.
|
|
||||||
sql = "UPDATE moz_items_annos SET dateAdded = :expire_date, lastModified = :last_modified " +
|
|
||||||
"WHERE id = (SELECT id FROM moz_items_annos " +
|
|
||||||
"WHERE item_id = :id " +
|
|
||||||
"ORDER BY dateAdded DESC LIMIT 1)";
|
|
||||||
} else if (aIdentifier instanceof Ci.nsIURI) {
|
|
||||||
// Page annotation.
|
|
||||||
as.setPageAnnotation(aIdentifier, aName, aValue, 0, aExpirePolicy);
|
|
||||||
// Update dateAdded for the last added annotation.
|
|
||||||
sql = "UPDATE moz_annos SET dateAdded = :expire_date, lastModified = :last_modified " +
|
|
||||||
"WHERE id = (SELECT a.id FROM moz_annos a " +
|
|
||||||
"LEFT JOIN moz_places h on h.id = a.place_id " +
|
|
||||||
"WHERE h.url_hash = hash(:id) AND h.url = :id " +
|
|
||||||
"ORDER BY a.dateAdded DESC LIMIT 1)";
|
|
||||||
} else
|
|
||||||
do_throw("Wrong identifier type");
|
|
||||||
|
|
||||||
let stmt = DBConn().createStatement(sql);
|
|
||||||
stmt.params.id = (typeof(aIdentifier) == "number") ? aIdentifier
|
|
||||||
: aIdentifier.spec;
|
|
||||||
stmt.params.expire_date = expireDate;
|
|
||||||
stmt.params.last_modified = lastModifiedDate;
|
|
||||||
try {
|
|
||||||
stmt.executeStep();
|
|
||||||
} finally {
|
|
||||||
stmt.finalize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
add_task(async function test_annos_expire_policy() {
|
|
||||||
// Set interval to a large value so we don't expire on it.
|
|
||||||
setInterval(3600); // 1h
|
|
||||||
|
|
||||||
// Expire all expirable pages.
|
|
||||||
setMaxPages(0);
|
|
||||||
|
|
||||||
let now_specific_to_test = getExpirablePRTime();
|
|
||||||
// Add some bookmarked page and timed annotations for each.
|
|
||||||
for (let i = 0; i < 5; i++) {
|
|
||||||
let pageURI = uri("http://item_anno." + i + ".mozilla.org/");
|
|
||||||
await PlacesTestUtils.addVisits({ uri: pageURI, visitDate: now_specific_to_test++ });
|
|
||||||
let bm = await PlacesUtils.bookmarks.insert({
|
|
||||||
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
|
||||||
url: pageURI,
|
|
||||||
title: null
|
|
||||||
});
|
|
||||||
let id = await PlacesUtils.promiseItemId(bm.guid);
|
|
||||||
// Add a 6 days old anno.
|
|
||||||
add_old_anno(id, "persist_days", "test", as.EXPIRE_DAYS, 6);
|
|
||||||
// Add a 8 days old anno, modified 5 days ago.
|
|
||||||
add_old_anno(id, "persist_lm_days", "test", as.EXPIRE_DAYS, 8, 6);
|
|
||||||
// Add a 8 days old anno.
|
|
||||||
add_old_anno(id, "expire_days", "test", as.EXPIRE_DAYS, 8);
|
|
||||||
|
|
||||||
// Add a 29 days old anno.
|
|
||||||
add_old_anno(id, "persist_weeks", "test", as.EXPIRE_WEEKS, 29);
|
|
||||||
// Add a 31 days old anno, modified 29 days ago.
|
|
||||||
add_old_anno(id, "persist_lm_weeks", "test", as.EXPIRE_WEEKS, 31, 29);
|
|
||||||
// Add a 31 days old anno.
|
|
||||||
add_old_anno(id, "expire_weeks", "test", as.EXPIRE_WEEKS, 31);
|
|
||||||
|
|
||||||
// Add a 179 days old anno.
|
|
||||||
add_old_anno(id, "persist_months", "test", as.EXPIRE_MONTHS, 179);
|
|
||||||
// Add a 181 days old anno, modified 179 days ago.
|
|
||||||
add_old_anno(id, "persist_lm_months", "test", as.EXPIRE_MONTHS, 181, 179);
|
|
||||||
// Add a 181 days old anno.
|
|
||||||
add_old_anno(id, "expire_months", "test", as.EXPIRE_MONTHS, 181);
|
|
||||||
|
|
||||||
// Add a 6 days old anno.
|
|
||||||
add_old_anno(pageURI, "persist_days", "test", as.EXPIRE_DAYS, 6);
|
|
||||||
// Add a 8 days old anno, modified 5 days ago.
|
|
||||||
add_old_anno(pageURI, "persist_lm_days", "test", as.EXPIRE_DAYS, 8, 6);
|
|
||||||
// Add a 8 days old anno.
|
|
||||||
add_old_anno(pageURI, "expire_days", "test", as.EXPIRE_DAYS, 8);
|
|
||||||
|
|
||||||
// Add a 29 days old anno.
|
|
||||||
add_old_anno(pageURI, "persist_weeks", "test", as.EXPIRE_WEEKS, 29);
|
|
||||||
// Add a 31 days old anno, modified 29 days ago.
|
|
||||||
add_old_anno(pageURI, "persist_lm_weeks", "test", as.EXPIRE_WEEKS, 31, 29);
|
|
||||||
// Add a 31 days old anno.
|
|
||||||
add_old_anno(pageURI, "expire_weeks", "test", as.EXPIRE_WEEKS, 31);
|
|
||||||
|
|
||||||
// Add a 179 days old anno.
|
|
||||||
add_old_anno(pageURI, "persist_months", "test", as.EXPIRE_MONTHS, 179);
|
|
||||||
// Add a 181 days old anno, modified 179 days ago.
|
|
||||||
add_old_anno(pageURI, "persist_lm_months", "test", as.EXPIRE_MONTHS, 181, 179);
|
|
||||||
// Add a 181 days old anno.
|
|
||||||
add_old_anno(pageURI, "expire_months", "test", as.EXPIRE_MONTHS, 181);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add some visited page and timed annotations for each.
|
|
||||||
for (let i = 0; i < 5; i++) {
|
|
||||||
let pageURI = uri("http://page_anno." + i + ".mozilla.org/");
|
|
||||||
await PlacesTestUtils.addVisits({ uri: pageURI, visitDate: now_specific_to_test++ });
|
|
||||||
// Add a 6 days old anno.
|
|
||||||
add_old_anno(pageURI, "persist_days", "test", as.EXPIRE_DAYS, 6);
|
|
||||||
// Add a 8 days old anno, modified 5 days ago.
|
|
||||||
add_old_anno(pageURI, "persist_lm_days", "test", as.EXPIRE_DAYS, 8, 6);
|
|
||||||
// Add a 8 days old anno.
|
|
||||||
add_old_anno(pageURI, "expire_days", "test", as.EXPIRE_DAYS, 8);
|
|
||||||
|
|
||||||
// Add a 29 days old anno.
|
|
||||||
add_old_anno(pageURI, "persist_weeks", "test", as.EXPIRE_WEEKS, 29);
|
|
||||||
// Add a 31 days old anno, modified 29 days ago.
|
|
||||||
add_old_anno(pageURI, "persist_lm_weeks", "test", as.EXPIRE_WEEKS, 31, 29);
|
|
||||||
// Add a 31 days old anno.
|
|
||||||
add_old_anno(pageURI, "expire_weeks", "test", as.EXPIRE_WEEKS, 31);
|
|
||||||
|
|
||||||
// Add a 179 days old anno.
|
|
||||||
add_old_anno(pageURI, "persist_months", "test", as.EXPIRE_MONTHS, 179);
|
|
||||||
// Add a 181 days old anno, modified 179 days ago.
|
|
||||||
add_old_anno(pageURI, "persist_lm_months", "test", as.EXPIRE_MONTHS, 181, 179);
|
|
||||||
// Add a 181 days old anno.
|
|
||||||
add_old_anno(pageURI, "expire_months", "test", as.EXPIRE_MONTHS, 181);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Expire all visits for the bookmarks.
|
|
||||||
await promiseForceExpirationStep(5);
|
|
||||||
|
|
||||||
for (let anno of ["expire_days", "expire_weeks", "expire_months"]) {
|
|
||||||
let pages = await getPagesWithAnnotation(anno);
|
|
||||||
Assert.equal(pages.length, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let anno of ["expire_days", "expire_weeks", "expire_months"]) {
|
|
||||||
let items = await getItemsWithAnnotation(anno);
|
|
||||||
Assert.equal(items.length, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let anno of ["persist_days", "persist_lm_days", "persist_weeks", "persist_lm_weeks",
|
|
||||||
"persist_months", "persist_lm_months"]) {
|
|
||||||
let pages = await getPagesWithAnnotation(anno);
|
|
||||||
Assert.equal(pages.length, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let anno of ["persist_days", "persist_lm_days", "persist_weeks", "persist_lm_weeks",
|
|
||||||
"persist_months", "persist_lm_months"]) {
|
|
||||||
let items = await getItemsWithAnnotation(anno);
|
|
||||||
Assert.equal(items.length, 5);
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,79 +0,0 @@
|
||||||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
|
|
||||||
* vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* What this is aimed to test:
|
|
||||||
*
|
|
||||||
* Session annotations should be expired when browsing session ends.
|
|
||||||
*/
|
|
||||||
|
|
||||||
var as = Cc["@mozilla.org/browser/annotation-service;1"].
|
|
||||||
getService(Ci.nsIAnnotationService);
|
|
||||||
|
|
||||||
add_task(async function test_annos_expire_session() {
|
|
||||||
// Set interval to a large value so we don't expire on it.
|
|
||||||
setInterval(3600); // 1h
|
|
||||||
|
|
||||||
// Add some visited page and a couple session annotations for each.
|
|
||||||
let now = Date.now() * 1000;
|
|
||||||
for (let i = 0; i < 10; i++) {
|
|
||||||
let pageURI = uri("http://session_page_anno." + i + ".mozilla.org/");
|
|
||||||
await PlacesTestUtils.addVisits({ uri: pageURI, visitDate: now++ });
|
|
||||||
as.setPageAnnotation(pageURI, "test1", "test", 0, as.EXPIRE_SESSION);
|
|
||||||
as.setPageAnnotation(pageURI, "test2", "test", 0, as.EXPIRE_SESSION);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add some bookmarked page and a couple session annotations for each.
|
|
||||||
for (let i = 0; i < 10; i++) {
|
|
||||||
let pageURI = uri("http://session_item_anno." + i + ".mozilla.org/");
|
|
||||||
let bm = await PlacesUtils.bookmarks.insert({
|
|
||||||
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
|
||||||
url: pageURI,
|
|
||||||
title: null
|
|
||||||
});
|
|
||||||
let id = await PlacesUtils.promiseItemId(bm.guid);
|
|
||||||
as.setItemAnnotation(id, "test1", "test", 0, as.EXPIRE_SESSION);
|
|
||||||
as.setItemAnnotation(id, "test2", "test", 0, as.EXPIRE_SESSION);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let pages = await getPagesWithAnnotation("test1");
|
|
||||||
Assert.equal(pages.length, 10);
|
|
||||||
pages = await getPagesWithAnnotation("test2");
|
|
||||||
Assert.equal(pages.length, 10);
|
|
||||||
let items = await getItemsWithAnnotation("test1");
|
|
||||||
Assert.equal(items.length, 10);
|
|
||||||
items = await getItemsWithAnnotation("test2");
|
|
||||||
Assert.equal(items.length, 10);
|
|
||||||
|
|
||||||
await new Promise(resolve => {
|
|
||||||
waitForConnectionClosed(function() {
|
|
||||||
let stmt = DBConn(true).createAsyncStatement(
|
|
||||||
`SELECT id FROM moz_annos
|
|
||||||
UNION ALL
|
|
||||||
SELECT id FROM moz_items_annos
|
|
||||||
WHERE expiration = :expiration`
|
|
||||||
);
|
|
||||||
stmt.params.expiration = as.EXPIRE_SESSION;
|
|
||||||
stmt.executeAsync({
|
|
||||||
handleResult(aResultSet) {
|
|
||||||
dump_table("moz_annos");
|
|
||||||
dump_table("moz_items_annos");
|
|
||||||
do_throw("Should not find any leftover session annotations");
|
|
||||||
},
|
|
||||||
handleError(aError) {
|
|
||||||
do_throw("Error code " + aError.result + " with message '" +
|
|
||||||
aError.message + "' returned.");
|
|
||||||
},
|
|
||||||
handleCompletion(aReason) {
|
|
||||||
Assert.equal(aReason, Ci.mozIStorageStatementCallback.REASON_FINISHED);
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
stmt.finalize();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -34,10 +34,6 @@ add_task(async function test_historyClear() {
|
||||||
as.setItemAnnotation(id, "persist", "test", 0, as.EXPIRE_NEVER);
|
as.setItemAnnotation(id, "persist", "test", 0, as.EXPIRE_NEVER);
|
||||||
// Will persist because the page is bookmarked.
|
// Will persist because the page is bookmarked.
|
||||||
as.setPageAnnotation(pageURI, "persist", "test", 0, as.EXPIRE_NEVER);
|
as.setPageAnnotation(pageURI, "persist", "test", 0, as.EXPIRE_NEVER);
|
||||||
// All EXPIRE_SESSION annotations are expected to expire on clear history.
|
|
||||||
as.setItemAnnotation(id, "expire_session", "test", 0, as.EXPIRE_SESSION);
|
|
||||||
as.setPageAnnotation(pageURI, "expire_session", "test", 0, as.EXPIRE_SESSION);
|
|
||||||
// Annotations with timed policy will expire regardless bookmarked status.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add some visited page and annotations for each.
|
// Add some visited page and annotations for each.
|
||||||
|
@ -47,21 +43,12 @@ add_task(async function test_historyClear() {
|
||||||
let pageURI = uri("http://page_anno." + i + ".mozilla.org/");
|
let pageURI = uri("http://page_anno." + i + ".mozilla.org/");
|
||||||
await PlacesTestUtils.addVisits({ uri: pageURI });
|
await PlacesTestUtils.addVisits({ uri: pageURI });
|
||||||
as.setPageAnnotation(pageURI, "expire", "test", 0, as.EXPIRE_NEVER);
|
as.setPageAnnotation(pageURI, "expire", "test", 0, as.EXPIRE_NEVER);
|
||||||
as.setPageAnnotation(pageURI, "expire_session", "test", 0, as.EXPIRE_SESSION);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expire all visits for the bookmarks
|
// Expire all visits for the bookmarks
|
||||||
await PlacesUtils.history.clear();
|
await PlacesUtils.history.clear();
|
||||||
|
|
||||||
for (let anno of ["expire_session", "expire"]) {
|
Assert.equal((await getPagesWithAnnotation("expire")).length, 0);
|
||||||
let pages = await getPagesWithAnnotation(anno);
|
|
||||||
Assert.equal(pages.length, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let anno of ["expire_session", "expire"]) {
|
|
||||||
let items = await getItemsWithAnnotation(anno);
|
|
||||||
Assert.equal(items.length, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
let pages = await getPagesWithAnnotation("persist");
|
let pages = await getPagesWithAnnotation("persist");
|
||||||
Assert.equal(pages.length, 5);
|
Assert.equal(pages.length, 5);
|
||||||
|
|
|
@ -2,10 +2,7 @@
|
||||||
head = head_expiration.js
|
head = head_expiration.js
|
||||||
skip-if = toolkit == 'android'
|
skip-if = toolkit == 'android'
|
||||||
|
|
||||||
[test_annos_expire_history.js]
|
|
||||||
[test_annos_expire_never.js]
|
[test_annos_expire_never.js]
|
||||||
[test_annos_expire_policy.js]
|
|
||||||
[test_annos_expire_session.js]
|
|
||||||
[test_clearHistory.js]
|
[test_clearHistory.js]
|
||||||
[test_debug_expiration.js]
|
[test_debug_expiration.js]
|
||||||
[test_idle_daily.js]
|
[test_idle_daily.js]
|
||||||
|
|
|
@ -104,6 +104,11 @@ add_task(async function test_different_host() {
|
||||||
|
|
||||||
Assert.equal(await getFaviconUrlForPage(pageURI),
|
Assert.equal(await getFaviconUrlForPage(pageURI),
|
||||||
faviconURI.spec, "Should get the png icon");
|
faviconURI.spec, "Should get the png icon");
|
||||||
|
// Check the icon is not marked as a root icon in the database.
|
||||||
|
let db = await PlacesUtils.promiseDBConnection();
|
||||||
|
let rows = await db.execute("SELECT root FROM moz_icons WHERE icon_url = :url",
|
||||||
|
{url: faviconURI.spec});
|
||||||
|
Assert.strictEqual(rows[0].getResultByName("root"), 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
add_task(async function test_same_size() {
|
add_task(async function test_same_size() {
|
||||||
|
|
|
@ -209,6 +209,15 @@ add_task(async function test_orphans() {
|
||||||
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||||
uri, SMALLPNG_DATA_URI, true, PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
uri, SMALLPNG_DATA_URI, true, PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||||
null, Services.scriptSecurityManager.getSystemPrincipal());
|
null, Services.scriptSecurityManager.getSystemPrincipal());
|
||||||
|
// Also create a root icon.
|
||||||
|
let faviconURI = Services.io.newURI(uri.spec + "favicon.ico");
|
||||||
|
PlacesUtils.favicons.replaceFaviconDataFromDataURL(
|
||||||
|
faviconURI, SMALLPNG_DATA_URI.spec, 0,
|
||||||
|
Services.scriptSecurityManager.getSystemPrincipal());
|
||||||
|
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||||
|
uri, faviconURI, true, PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
|
||||||
|
null, Services.scriptSecurityManager.getSystemPrincipal());
|
||||||
|
|
||||||
PlacesUtils.annotations.setPageAnnotation(uri, "test", "restval", 0,
|
PlacesUtils.annotations.setPageAnnotation(uri, "test", "restval", 0,
|
||||||
PlacesUtils.annotations.EXPIRE_NEVER);
|
PlacesUtils.annotations.EXPIRE_NEVER);
|
||||||
|
|
||||||
|
|
|
@ -328,7 +328,7 @@ add_task(async function test_bookmarks() {
|
||||||
|
|
||||||
// check if setting an item annotation triggers onItemChanged
|
// check if setting an item annotation triggers onItemChanged
|
||||||
bookmarksObserver._itemChangedId = -1;
|
bookmarksObserver._itemChangedId = -1;
|
||||||
anno.setItemAnnotation(newId3, "test-annotation", "foo", 0, 0);
|
anno.setItemAnnotation(newId3, "test-annotation", "foo", 0, anno.EXPIRE_NEVER);
|
||||||
Assert.equal(bookmarksObserver._itemChangedId, newId3);
|
Assert.equal(bookmarksObserver._itemChangedId, newId3);
|
||||||
Assert.equal(bookmarksObserver._itemChangedProperty, "test-annotation");
|
Assert.equal(bookmarksObserver._itemChangedProperty, "test-annotation");
|
||||||
Assert.ok(bookmarksObserver._itemChanged_isAnnotationProperty);
|
Assert.ok(bookmarksObserver._itemChanged_isAnnotationProperty);
|
||||||
|
|
|
@ -894,13 +894,20 @@ tests.push({
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
// Insert favicon entries
|
// Insert favicon entries
|
||||||
let stmt = mDBConn.createStatement("INSERT INTO moz_icons (id, icon_url, fixed_icon_url_hash) VALUES(:favicon_id, :url, hash(fixup_url(:url)))");
|
let stmt = mDBConn.createStatement("INSERT INTO moz_icons (id, icon_url, fixed_icon_url_hash, root) VALUES(:favicon_id, :url, hash(fixup_url(:url)), :root)");
|
||||||
stmt.params.favicon_id = 1;
|
stmt.params.favicon_id = 1;
|
||||||
stmt.params.url = "http://www1.mozilla.org/favicon.ico";
|
stmt.params.url = "http://www1.mozilla.org/favicon.ico";
|
||||||
|
stmt.params.root = 0;
|
||||||
stmt.execute();
|
stmt.execute();
|
||||||
stmt.reset();
|
stmt.reset();
|
||||||
stmt.params.favicon_id = 2;
|
stmt.params.favicon_id = 2;
|
||||||
stmt.params.url = "http://www2.mozilla.org/favicon.ico";
|
stmt.params.url = "http://www2.mozilla.org/favicon.ico";
|
||||||
|
stmt.params.root = 0;
|
||||||
|
stmt.execute();
|
||||||
|
stmt.reset();
|
||||||
|
stmt.params.favicon_id = 3;
|
||||||
|
stmt.params.url = "http://www3.mozilla.org/favicon.ico";
|
||||||
|
stmt.params.root = 1;
|
||||||
stmt.execute();
|
stmt.execute();
|
||||||
stmt.finalize();
|
stmt.finalize();
|
||||||
// Insert orphan page.
|
// Insert orphan page.
|
||||||
|
@ -923,6 +930,10 @@ tests.push({
|
||||||
// Check that unused icon has been removed
|
// Check that unused icon has been removed
|
||||||
stmt.params.favicon_id = 2;
|
stmt.params.favicon_id = 2;
|
||||||
Assert.ok(!stmt.executeStep());
|
Assert.ok(!stmt.executeStep());
|
||||||
|
stmt.reset();
|
||||||
|
// Check that unused icon has been removed
|
||||||
|
stmt.params.favicon_id = 3;
|
||||||
|
Assert.ok(!stmt.executeStep());
|
||||||
stmt.finalize();
|
stmt.finalize();
|
||||||
// Check that the orphan page is gone.
|
// Check that the orphan page is gone.
|
||||||
stmt = mDBConn.createStatement("SELECT id FROM moz_pages_w_icons WHERE id = :page_id");
|
stmt = mDBConn.createStatement("SELECT id FROM moz_pages_w_icons WHERE id = :page_id");
|
||||||
|
|
|
@ -104,7 +104,7 @@ async function task_populateDB(aArray) {
|
||||||
qdata.annoName,
|
qdata.annoName,
|
||||||
qdata.annoVal,
|
qdata.annoVal,
|
||||||
qdata.annoFlags,
|
qdata.annoFlags,
|
||||||
qdata.annoExpiration);
|
PlacesUtils.annotations.EXPIRE_NEVER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ async function task_populateDB(aArray) {
|
||||||
qdata.annoName,
|
qdata.annoName,
|
||||||
qdata.annoVal,
|
qdata.annoVal,
|
||||||
qdata.annoFlags,
|
qdata.annoFlags,
|
||||||
qdata.annoExpiration);
|
PlacesUtils.annotations.EXPIRE_NEVER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ add_task(async function test_buildTestDatabase() {
|
||||||
await PlacesTestUtils.addVisits(places);
|
await PlacesTestUtils.addVisits(places);
|
||||||
|
|
||||||
PlacesUtils.annotations.setPageAnnotation(testURI, testAnnoName,
|
PlacesUtils.annotations.setPageAnnotation(testURI, testAnnoName,
|
||||||
testAnnoVal, 0, 0);
|
testAnnoVal, 0, PlacesUtils.annotations.EXPIRE_NEVER);
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -50,7 +50,7 @@ add_task(async function test_downloadhistory_query_notifications() {
|
||||||
parentGuid: PlacesUtils.bookmarks.unfiledGuid
|
parentGuid: PlacesUtils.bookmarks.unfiledGuid
|
||||||
});
|
});
|
||||||
PlacesUtils.annotations.setPageAnnotation(uri, "test/anno", "testValue", 0,
|
PlacesUtils.annotations.setPageAnnotation(uri, "test/anno", "testValue", 0,
|
||||||
PlacesUtils.annotations.EXPIRE_WITH_HISTORY);
|
PlacesUtils.annotations.EXPIRE_NEVER);
|
||||||
await PlacesTestUtils.addFavicons(new Map([[uri.spec, SMALLPNG_DATA_URI.spec]]));
|
await PlacesTestUtils.addFavicons(new Map([[uri.spec, SMALLPNG_DATA_URI.spec]]));
|
||||||
}
|
}
|
||||||
// Remove all the visits one by one.
|
// Remove all the visits one by one.
|
||||||
|
|
|
@ -679,7 +679,7 @@ add_task(async function test_pullChanges_tags() {
|
||||||
info("Rename tag folder using Bookmarks.setItemTitle");
|
info("Rename tag folder using Bookmarks.setItemTitle");
|
||||||
{
|
{
|
||||||
PlacesUtils.bookmarks.setItemTitle(tagFolderId, "sneaky");
|
PlacesUtils.bookmarks.setItemTitle(tagFolderId, "sneaky");
|
||||||
deepEqual(PlacesUtils.tagging.allTags, ["sneaky"],
|
deepEqual((await PlacesUtils.bookmarks.fetchTags()).map(t => t.name), ["sneaky"],
|
||||||
"Tagging service should update cache with new title");
|
"Tagging service should update cache with new title");
|
||||||
let changes = await PlacesSyncUtils.bookmarks.pullChanges();
|
let changes = await PlacesSyncUtils.bookmarks.pullChanges();
|
||||||
deepEqual(Object.keys(changes).sort(),
|
deepEqual(Object.keys(changes).sort(),
|
||||||
|
@ -694,7 +694,7 @@ add_task(async function test_pullChanges_tags() {
|
||||||
guid: tagFolderGuid,
|
guid: tagFolderGuid,
|
||||||
title: "tricky",
|
title: "tricky",
|
||||||
});
|
});
|
||||||
deepEqual(PlacesUtils.tagging.allTags, ["tricky"],
|
deepEqual((await PlacesUtils.bookmarks.fetchTags()).map(t => t.name), ["tricky"],
|
||||||
"Tagging service should update cache after updating tag folder");
|
"Tagging service should update cache after updating tag folder");
|
||||||
let changes = await PlacesSyncUtils.bookmarks.pullChanges();
|
let changes = await PlacesSyncUtils.bookmarks.pullChanges();
|
||||||
deepEqual(Object.keys(changes).sort(),
|
deepEqual(Object.keys(changes).sort(),
|
||||||
|
@ -1358,7 +1358,7 @@ add_task(async function test_insert_tags_whitespace() {
|
||||||
|
|
||||||
PlacesUtils.tagging.untagURI(uri("https://example.org"), ["untrimmed", "taggy"]);
|
PlacesUtils.tagging.untagURI(uri("https://example.org"), ["untrimmed", "taggy"]);
|
||||||
PlacesUtils.tagging.untagURI(uri("https://example.net"), ["taggy"]);
|
PlacesUtils.tagging.untagURI(uri("https://example.net"), ["taggy"]);
|
||||||
deepEqual(PlacesUtils.tagging.allTags, [], "Should clean up all tags");
|
deepEqual((await PlacesUtils.bookmarks.fetchTags()).map(t => t.name), [], "Should clean up all tags");
|
||||||
|
|
||||||
await PlacesUtils.bookmarks.eraseEverything();
|
await PlacesUtils.bookmarks.eraseEverything();
|
||||||
await PlacesSyncUtils.bookmarks.reset();
|
await PlacesSyncUtils.bookmarks.reset();
|
||||||
|
@ -1423,7 +1423,7 @@ add_task(async function test_insert_tag_query() {
|
||||||
ok(!params.has("type"), "Should not preserve query type");
|
ok(!params.has("type"), "Should not preserve query type");
|
||||||
ok(!params.has("folder"), "Should not preserve folder");
|
ok(!params.has("folder"), "Should not preserve folder");
|
||||||
equal(params.get("tag"), "nonexisting", "Should add tag");
|
equal(params.get("tag"), "nonexisting", "Should add tag");
|
||||||
deepEqual(PlacesUtils.tagging.allTags, ["taggy"],
|
deepEqual((await PlacesUtils.bookmarks.fetchTags()).map(t => t.name), ["taggy"],
|
||||||
"The nonexisting tag should not be added");
|
"The nonexisting tag should not be added");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1443,7 +1443,7 @@ add_task(async function test_insert_tag_query() {
|
||||||
ok(!params.has("folder"), "Should not preserve folder");
|
ok(!params.has("folder"), "Should not preserve folder");
|
||||||
equal(params.get("maxResults"), "15", "Should preserve additional params");
|
equal(params.get("maxResults"), "15", "Should preserve additional params");
|
||||||
equal(params.get("tag"), "taggy", "Should add tag");
|
equal(params.get("tag"), "taggy", "Should add tag");
|
||||||
deepEqual(PlacesUtils.tagging.allTags, ["taggy"],
|
deepEqual((await PlacesUtils.bookmarks.fetchTags()).map(t => t.name), ["taggy"],
|
||||||
"Should not duplicate existing tags");
|
"Should not duplicate existing tags");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1451,7 +1451,7 @@ add_task(async function test_insert_tag_query() {
|
||||||
|
|
||||||
info("Removing the tag should clean up the tag folder");
|
info("Removing the tag should clean up the tag folder");
|
||||||
PlacesUtils.tagging.untagURI(uri("https://mozilla.org"), null);
|
PlacesUtils.tagging.untagURI(uri("https://mozilla.org"), null);
|
||||||
deepEqual(PlacesUtils.tagging.allTags, [],
|
deepEqual((await PlacesUtils.bookmarks.fetchTags()).map(t => t.name), [],
|
||||||
"Should remove tag folder once last item is untagged");
|
"Should remove tag folder once last item is untagged");
|
||||||
|
|
||||||
await PlacesUtils.bookmarks.eraseEverything();
|
await PlacesUtils.bookmarks.eraseEverything();
|
||||||
|
|
|
@ -341,6 +341,38 @@ function addAutofillTasks(origins) {
|
||||||
await cleanup();
|
await cleanup();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// "https://ex" should *not* match http://example.com/, even if the latter is
|
||||||
|
// more frecent and both could be autofilled.
|
||||||
|
add_task(async function httpsPrefixShouldNotMatchMoreFrecentHTTP() {
|
||||||
|
await PlacesTestUtils.addVisits([{
|
||||||
|
uri: "http://" + url,
|
||||||
|
transition: PlacesUtils.history.TRANSITIONS.TYPED,
|
||||||
|
}, {
|
||||||
|
uri: "http://" + url,
|
||||||
|
}, {
|
||||||
|
uri: "https://" + url,
|
||||||
|
transition: PlacesUtils.history.TRANSITIONS.TYPED,
|
||||||
|
}, {
|
||||||
|
uri: "http://otherpage",
|
||||||
|
}]);
|
||||||
|
await check_autocomplete({
|
||||||
|
search: "https://" + search,
|
||||||
|
autofilled: "https://" + url,
|
||||||
|
completed: "https://" + url,
|
||||||
|
matches: [{
|
||||||
|
value: "https://" + url,
|
||||||
|
comment: "https://" + comment,
|
||||||
|
style: ["autofill", "heuristic"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "http://" + url,
|
||||||
|
comment: "test visit for http://" + url,
|
||||||
|
style: ["favicon"],
|
||||||
|
}],
|
||||||
|
});
|
||||||
|
await cleanup();
|
||||||
|
});
|
||||||
|
|
||||||
// Autofill should respond to frecency changes.
|
// Autofill should respond to frecency changes.
|
||||||
add_task(async function frecency() {
|
add_task(async function frecency() {
|
||||||
// Start with an http visit. It should be completed.
|
// Start with an http visit. It should be completed.
|
||||||
|
|
|
@ -50,7 +50,7 @@ add_task(async function test_execute() {
|
||||||
PlacesUtils.annotations.setPageAnnotation(testAnnoDeletedURI,
|
PlacesUtils.annotations.setPageAnnotation(testAnnoDeletedURI,
|
||||||
testAnnoDeletedName,
|
testAnnoDeletedName,
|
||||||
testAnnoDeletedValue, 0,
|
testAnnoDeletedValue, 0,
|
||||||
PlacesUtils.annotations.EXPIRE_WITH_HISTORY);
|
PlacesUtils.annotations.EXPIRE_NEVER);
|
||||||
|
|
||||||
// set a page annotation on one of the urls that will NOT be removed
|
// set a page annotation on one of the urls that will NOT be removed
|
||||||
var testAnnoRetainedURI = uri("http://www.test-1.com/");
|
var testAnnoRetainedURI = uri("http://www.test-1.com/");
|
||||||
|
@ -59,7 +59,7 @@ add_task(async function test_execute() {
|
||||||
PlacesUtils.annotations.setPageAnnotation(testAnnoRetainedURI,
|
PlacesUtils.annotations.setPageAnnotation(testAnnoRetainedURI,
|
||||||
testAnnoRetainedName,
|
testAnnoRetainedName,
|
||||||
testAnnoRetainedValue, 0,
|
testAnnoRetainedValue, 0,
|
||||||
PlacesUtils.annotations.EXPIRE_WITH_HISTORY);
|
PlacesUtils.annotations.EXPIRE_NEVER);
|
||||||
|
|
||||||
// remove pages from www.test.com
|
// remove pages from www.test.com
|
||||||
await PlacesUtils.history.removeByFilter({ host: "www.test.com" });
|
await PlacesUtils.history.removeByFilter({ host: "www.test.com" });
|
||||||
|
|
|
@ -7,12 +7,12 @@ const TEST_ANNOTATIONS = [{
|
||||||
name: PlacesUtils.LMANNO_FEEDURI,
|
name: PlacesUtils.LMANNO_FEEDURI,
|
||||||
value: "test",
|
value: "test",
|
||||||
flags: 0,
|
flags: 0,
|
||||||
expires: Ci.nsIAnnotationService.EXPIRE_MONTHS,
|
expires: Ci.nsIAnnotationService.EXPIRE_NEVER,
|
||||||
}, {
|
}, {
|
||||||
name: PlacesUtils.LMANNO_SITEURI,
|
name: PlacesUtils.LMANNO_SITEURI,
|
||||||
value: "test2",
|
value: "test2",
|
||||||
flags: 0,
|
flags: 0,
|
||||||
expires: Ci.nsIAnnotationService.EXPIRE_DAYS,
|
expires: Ci.nsIAnnotationService.EXPIRE_NEVER,
|
||||||
}];
|
}];
|
||||||
|
|
||||||
function checkAnnotations(annotations, expectedAnnotations) {
|
function checkAnnotations(annotations, expectedAnnotations) {
|
||||||
|
|
|
@ -57,7 +57,7 @@ add_task(async function test_execute() {
|
||||||
annosvc.addObserver(annoObserver);
|
annosvc.addObserver(annoObserver);
|
||||||
// create new string annotation
|
// create new string annotation
|
||||||
try {
|
try {
|
||||||
annosvc.setPageAnnotation(testURI, testAnnoName, testAnnoVal, 0, 0);
|
annosvc.setPageAnnotation(testURI, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_NEVER);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
do_throw("unable to add page-annotation");
|
do_throw("unable to add page-annotation");
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ add_task(async function test_execute() {
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
annosvc.setItemAnnotation(testItemId, testAnnoName, testAnnoVal, 0, 0);
|
annosvc.setItemAnnotation(testItemId, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_NEVER);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
do_throw("unable to add item annotation " + ex);
|
do_throw("unable to add item annotation " + ex);
|
||||||
}
|
}
|
||||||
|
@ -113,13 +113,9 @@ add_task(async function test_execute() {
|
||||||
// get annotation info
|
// get annotation info
|
||||||
var value = {}, flags = {}, exp = {}, storageType = {};
|
var value = {}, flags = {}, exp = {}, storageType = {};
|
||||||
annosvc.getPageAnnotationInfo(testURI, testAnnoName, flags, exp, storageType);
|
annosvc.getPageAnnotationInfo(testURI, testAnnoName, flags, exp, storageType);
|
||||||
Assert.equal(flags.value, 0);
|
|
||||||
Assert.equal(exp.value, 0);
|
|
||||||
Assert.equal(storageType.value, Ci.nsIAnnotationService.TYPE_STRING);
|
Assert.equal(storageType.value, Ci.nsIAnnotationService.TYPE_STRING);
|
||||||
annosvc.getItemAnnotationInfo(testItemId, testAnnoName, value, flags, exp, storageType);
|
annosvc.getItemAnnotationInfo(testItemId, testAnnoName, value, flags, exp, storageType);
|
||||||
Assert.equal(value.value, testAnnoVal);
|
Assert.equal(value.value, testAnnoVal);
|
||||||
Assert.equal(flags.value, 0);
|
|
||||||
Assert.equal(exp.value, 0);
|
|
||||||
Assert.equal(storageType.value, Ci.nsIAnnotationService.TYPE_STRING);
|
Assert.equal(storageType.value, Ci.nsIAnnotationService.TYPE_STRING);
|
||||||
|
|
||||||
// get annotation names for an item
|
// get annotation names for an item
|
||||||
|
@ -130,56 +126,44 @@ add_task(async function test_execute() {
|
||||||
// test int32 anno type
|
// test int32 anno type
|
||||||
var int32Key = testAnnoName + "/types/Int32";
|
var int32Key = testAnnoName + "/types/Int32";
|
||||||
var int32Val = 23;
|
var int32Val = 23;
|
||||||
annosvc.setPageAnnotation(testURI, int32Key, int32Val, 0, 0);
|
annosvc.setPageAnnotation(testURI, int32Key, int32Val, 0, annosvc.EXPIRE_NEVER);
|
||||||
value = {}, flags = {}, exp = {}, storageType = {};
|
value = {}, flags = {}, exp = {}, storageType = {};
|
||||||
annosvc.getPageAnnotationInfo(testURI, int32Key, flags, exp, storageType);
|
annosvc.getPageAnnotationInfo(testURI, int32Key, flags, exp, storageType);
|
||||||
Assert.equal(flags.value, 0);
|
|
||||||
Assert.equal(exp.value, 0);
|
|
||||||
Assert.equal(storageType.value, Ci.nsIAnnotationService.TYPE_INT32);
|
Assert.equal(storageType.value, Ci.nsIAnnotationService.TYPE_INT32);
|
||||||
var storedVal = annosvc.getPageAnnotation(testURI, int32Key);
|
var storedVal = annosvc.getPageAnnotation(testURI, int32Key);
|
||||||
Assert.ok(int32Val === storedVal);
|
Assert.ok(int32Val === storedVal);
|
||||||
annosvc.setItemAnnotation(testItemId, int32Key, int32Val, 0, 0);
|
annosvc.setItemAnnotation(testItemId, int32Key, int32Val, 0, annosvc.EXPIRE_NEVER);
|
||||||
Assert.ok(annosvc.itemHasAnnotation(testItemId, int32Key));
|
Assert.ok(annosvc.itemHasAnnotation(testItemId, int32Key));
|
||||||
annosvc.getItemAnnotationInfo(testItemId, int32Key, value, flags, exp, storageType);
|
annosvc.getItemAnnotationInfo(testItemId, int32Key, value, flags, exp, storageType);
|
||||||
Assert.equal(value.value, int32Val);
|
Assert.equal(value.value, int32Val);
|
||||||
Assert.equal(flags.value, 0);
|
|
||||||
Assert.equal(exp.value, 0);
|
|
||||||
storedVal = annosvc.getItemAnnotation(testItemId, int32Key);
|
storedVal = annosvc.getItemAnnotation(testItemId, int32Key);
|
||||||
Assert.ok(int32Val === storedVal);
|
Assert.ok(int32Val === storedVal);
|
||||||
|
|
||||||
// test int64 anno type
|
// test int64 anno type
|
||||||
var int64Key = testAnnoName + "/types/Int64";
|
var int64Key = testAnnoName + "/types/Int64";
|
||||||
var int64Val = 4294967296;
|
var int64Val = 4294967296;
|
||||||
annosvc.setPageAnnotation(testURI, int64Key, int64Val, 0, 0);
|
annosvc.setPageAnnotation(testURI, int64Key, int64Val, 0, annosvc.EXPIRE_NEVER);
|
||||||
annosvc.getPageAnnotationInfo(testURI, int64Key, flags, exp, storageType);
|
annosvc.getPageAnnotationInfo(testURI, int64Key, flags, exp, storageType);
|
||||||
Assert.equal(flags.value, 0);
|
|
||||||
Assert.equal(exp.value, 0);
|
|
||||||
storedVal = annosvc.getPageAnnotation(testURI, int64Key);
|
storedVal = annosvc.getPageAnnotation(testURI, int64Key);
|
||||||
Assert.ok(int64Val === storedVal);
|
Assert.ok(int64Val === storedVal);
|
||||||
annosvc.setItemAnnotation(testItemId, int64Key, int64Val, 0, 0);
|
annosvc.setItemAnnotation(testItemId, int64Key, int64Val, 0, annosvc.EXPIRE_NEVER);
|
||||||
Assert.ok(annosvc.itemHasAnnotation(testItemId, int64Key));
|
Assert.ok(annosvc.itemHasAnnotation(testItemId, int64Key));
|
||||||
annosvc.getItemAnnotationInfo(testItemId, int64Key, value, flags, exp, storageType);
|
annosvc.getItemAnnotationInfo(testItemId, int64Key, value, flags, exp, storageType);
|
||||||
Assert.equal(value.value, int64Val);
|
Assert.equal(value.value, int64Val);
|
||||||
Assert.equal(flags.value, 0);
|
|
||||||
Assert.equal(exp.value, 0);
|
|
||||||
storedVal = annosvc.getItemAnnotation(testItemId, int64Key);
|
storedVal = annosvc.getItemAnnotation(testItemId, int64Key);
|
||||||
Assert.ok(int64Val === storedVal);
|
Assert.ok(int64Val === storedVal);
|
||||||
|
|
||||||
// test double anno type
|
// test double anno type
|
||||||
var doubleKey = testAnnoName + "/types/Double";
|
var doubleKey = testAnnoName + "/types/Double";
|
||||||
var doubleVal = 0.000002342;
|
var doubleVal = 0.000002342;
|
||||||
annosvc.setPageAnnotation(testURI, doubleKey, doubleVal, 0, 0);
|
annosvc.setPageAnnotation(testURI, doubleKey, doubleVal, 0, annosvc.EXPIRE_NEVER);
|
||||||
annosvc.getPageAnnotationInfo(testURI, doubleKey, flags, exp, storageType);
|
annosvc.getPageAnnotationInfo(testURI, doubleKey, flags, exp, storageType);
|
||||||
Assert.equal(flags.value, 0);
|
|
||||||
Assert.equal(exp.value, 0);
|
|
||||||
storedVal = annosvc.getPageAnnotation(testURI, doubleKey);
|
storedVal = annosvc.getPageAnnotation(testURI, doubleKey);
|
||||||
Assert.ok(doubleVal === storedVal);
|
Assert.ok(doubleVal === storedVal);
|
||||||
annosvc.setItemAnnotation(testItemId, doubleKey, doubleVal, 0, 0);
|
annosvc.setItemAnnotation(testItemId, doubleKey, doubleVal, 0, annosvc.EXPIRE_NEVER);
|
||||||
Assert.ok(annosvc.itemHasAnnotation(testItemId, doubleKey));
|
Assert.ok(annosvc.itemHasAnnotation(testItemId, doubleKey));
|
||||||
annosvc.getItemAnnotationInfo(testItemId, doubleKey, value, flags, exp, storageType);
|
annosvc.getItemAnnotationInfo(testItemId, doubleKey, value, flags, exp, storageType);
|
||||||
Assert.equal(value.value, doubleVal);
|
Assert.equal(value.value, doubleVal);
|
||||||
Assert.equal(flags.value, 0);
|
|
||||||
Assert.equal(exp.value, 0);
|
|
||||||
Assert.equal(storageType.value, Ci.nsIAnnotationService.TYPE_DOUBLE);
|
Assert.equal(storageType.value, Ci.nsIAnnotationService.TYPE_DOUBLE);
|
||||||
storedVal = annosvc.getItemAnnotation(testItemId, doubleKey);
|
storedVal = annosvc.getItemAnnotation(testItemId, doubleKey);
|
||||||
Assert.ok(doubleVal === storedVal);
|
Assert.ok(doubleVal === storedVal);
|
||||||
|
@ -187,7 +171,7 @@ add_task(async function test_execute() {
|
||||||
// test annotation removal
|
// test annotation removal
|
||||||
annosvc.removePageAnnotation(testURI, int32Key);
|
annosvc.removePageAnnotation(testURI, int32Key);
|
||||||
|
|
||||||
annosvc.setItemAnnotation(testItemId, testAnnoName, testAnnoVal, 0, 0);
|
annosvc.setItemAnnotation(testItemId, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_NEVER);
|
||||||
// verify that removing an annotation updates the last modified date
|
// verify that removing an annotation updates the last modified date
|
||||||
testItem = await PlacesUtils.bookmarks.fetch(testItem.guid);
|
testItem = await PlacesUtils.bookmarks.fetch(testItem.guid);
|
||||||
|
|
||||||
|
@ -221,7 +205,7 @@ add_task(async function test_execute() {
|
||||||
var invalidIds = [-1, 0, 37643];
|
var invalidIds = [-1, 0, 37643];
|
||||||
for (var id of invalidIds) {
|
for (var id of invalidIds) {
|
||||||
try {
|
try {
|
||||||
annosvc.setItemAnnotation(id, "foo", "bar", 0, 0);
|
annosvc.setItemAnnotation(id, "foo", "bar", 0, annosvc.EXPIRE_NEVER);
|
||||||
do_throw("setItemAnnotation* should throw for invalid item id: " + id);
|
do_throw("setItemAnnotation* should throw for invalid item id: " + id);
|
||||||
} catch (ex) { }
|
} catch (ex) { }
|
||||||
}
|
}
|
||||||
|
@ -232,12 +216,6 @@ add_task(async function test_execute() {
|
||||||
title: "",
|
title: "",
|
||||||
url: testURI,
|
url: testURI,
|
||||||
});
|
});
|
||||||
let itemId = await PlacesUtils.promiseItemId(item.guid);
|
|
||||||
try {
|
|
||||||
annosvc.setItemAnnotation(itemId, "foo", "bar", 0, annosvc.EXPIRE_WITH_HISTORY);
|
|
||||||
do_throw("setting an item annotation with EXPIRE_HISTORY should throw");
|
|
||||||
} catch (ex) {
|
|
||||||
}
|
|
||||||
|
|
||||||
annosvc.removeObserver(annoObserver);
|
annosvc.removeObserver(annoObserver);
|
||||||
});
|
});
|
||||||
|
@ -266,13 +244,13 @@ add_task(async function test_getAnnotationsHavingName() {
|
||||||
for (let name in ANNOS) {
|
for (let name in ANNOS) {
|
||||||
PlacesUtils.annotations.setPageAnnotation(
|
PlacesUtils.annotations.setPageAnnotation(
|
||||||
url, name, ANNOS[name], 0,
|
url, name, ANNOS[name], 0,
|
||||||
PlacesUtils.annotations.EXPIRE_SESSION);
|
PlacesUtils.annotations.EXPIRE_NEVER);
|
||||||
PlacesUtils.annotations.setItemAnnotation(
|
PlacesUtils.annotations.setItemAnnotation(
|
||||||
id, name, ANNOS[name], 0,
|
id, name, ANNOS[name], 0,
|
||||||
PlacesUtils.annotations.EXPIRE_SESSION);
|
PlacesUtils.annotations.EXPIRE_NEVER);
|
||||||
PlacesUtils.annotations.setItemAnnotation(
|
PlacesUtils.annotations.setItemAnnotation(
|
||||||
fid, name, ANNOS[name], 0,
|
fid, name, ANNOS[name], 0,
|
||||||
PlacesUtils.annotations.EXPIRE_SESSION);
|
PlacesUtils.annotations.EXPIRE_NEVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let name in ANNOS) {
|
for (let name in ANNOS) {
|
||||||
|
|
|
@ -64,12 +64,6 @@ function run_test() {
|
||||||
Assert.ok(tag1uris[0].equals(uri1));
|
Assert.ok(tag1uris[0].equals(uri1));
|
||||||
Assert.ok(tag1uris[1].equals(uri2));
|
Assert.ok(tag1uris[1].equals(uri2));
|
||||||
|
|
||||||
// test allTags attribute
|
|
||||||
var allTags = tagssvc.allTags;
|
|
||||||
Assert.equal(allTags.length, 2);
|
|
||||||
Assert.equal(allTags[0], "Tag 1");
|
|
||||||
Assert.equal(allTags[1], "Tag 2");
|
|
||||||
|
|
||||||
// test untagging
|
// test untagging
|
||||||
tagssvc.untagURI(uri1, ["tag 1"]);
|
tagssvc.untagURI(uri1, ["tag 1"]);
|
||||||
Assert.equal(tag1node.childCount, 1);
|
Assert.equal(tag1node.childCount, 1);
|
||||||
|
|
|
@ -50,6 +50,7 @@ support-files =
|
||||||
support-files =
|
support-files =
|
||||||
gizmo.mp4
|
gizmo.mp4
|
||||||
file_video.html
|
file_video.html
|
||||||
|
[browser_autoplay_videoDocument.js]
|
||||||
[browser_autoscroll_disabled.js]
|
[browser_autoscroll_disabled.js]
|
||||||
[browser_block_autoplay_media.js]
|
[browser_block_autoplay_media.js]
|
||||||
tags = audiochannel
|
tags = audiochannel
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const PAGE = "https://example.com/browser/toolkit/content/tests/browser/audio.ogg";
|
||||||
|
|
||||||
|
function setup_test_preference() {
|
||||||
|
return SpecialPowers.pushPrefEnv({"set": [
|
||||||
|
["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.PROMPT],
|
||||||
|
["media.autoplay.enabled.user-gestures-needed", true],
|
||||||
|
["media.autoplay.ask-permission", true],
|
||||||
|
]});
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkIsVideoDocumentAutoplay(browser) {
|
||||||
|
return ContentTask.spawn(browser, null, async () => {
|
||||||
|
let video = content.document.getElementsByTagName("video")[0];
|
||||||
|
let played = video && await video.play().then(() => true, () => false);
|
||||||
|
ok(played, "Should be able to play in video document.");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
add_task(async () => {
|
||||||
|
await BrowserTestUtils.withNewTab({
|
||||||
|
gBrowser,
|
||||||
|
url: PAGE,
|
||||||
|
}, async (browser) => {
|
||||||
|
info("- setup test preference -");
|
||||||
|
await setup_test_preference();
|
||||||
|
|
||||||
|
info(`- check whether video document is autoplay -`);
|
||||||
|
await checkIsVideoDocumentAutoplay(browser);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
@ -66,7 +66,6 @@ mobile/android/thirdparty/
|
||||||
modules/brotli/
|
modules/brotli/
|
||||||
modules/fdlibm/
|
modules/fdlibm/
|
||||||
modules/freetype2/
|
modules/freetype2/
|
||||||
modules/libmar/
|
|
||||||
modules/pdfium/
|
modules/pdfium/
|
||||||
modules/woff2/
|
modules/woff2/
|
||||||
modules/xz-embedded/
|
modules/xz-embedded/
|
||||||
|
|
Загрузка…
Ссылка в новой задаче