Bug 1272676 - Remove HistoryTime and use Date type instead, r?aswan
MozReview-Commit-ID: IqH2eLJwn5d
--- a/browser/components/extensions/schemas/history.json
+++ b/browser/components/extensions/schemas/history.json
@@ -86,29 +86,16 @@
"type": "string",
"description": "The visit ID of the referrer."
},
"transition": {
"$ref": "TransitionType",
"description": "The $(topic:transition-types)[transition type] for this visit from its referrer."
}
}
- },
- {
- "id": "HistoryTime",
- "description": "A time specified as a Date object, a number or string representing milliseconds since the epoch, or an ISO 8601 string",
- "choices": [
- {
- "type": "string",
- "pattern": "^[1-9]\\d*$"
- },
- {
- "$ref": "extensionTypes.Date"
- }
- ]
}
],
"functions": [
{
"name": "search",
"type": "function",
"description": "Searches the history for the last visit time of each page matching the query.",
"async": "callback",
@@ -117,22 +104,22 @@
"name": "query",
"type": "object",
"properties": {
"text": {
"type": "string",
"description": "A free-text query to the history service. Leave empty to retrieve all pages."
},
"startTime": {
- "$ref": "HistoryTime",
+ "$ref": "extensionTypes.Date",
"optional": true,
"description": "Limit results to those visited after this date. If not specified, this defaults to 24 hours in the past."
},
"endTime": {
- "$ref": "HistoryTime",
+ "$ref": "extensionTypes.Date",
"optional": true,
"description": "Limit results to those visited before this date."
},
"maxResults": {
"type": "integer",
"optional": true,
"minimum": 1,
"description": "The maximum number of results to retrieve. Defaults to 100."
@@ -205,17 +192,17 @@
"description": "The title of the page."
},
"transition": {
"$ref": "TransitionType",
"optional": true,
"description": "The $(topic:transition-types)[transition type] for this visit from its referrer."
},
"visitTime": {
- "$ref": "HistoryTime",
+ "$ref": "extensionTypes.Date",
"optional": true,
"description": "The date when this visit occurred."
}
}
},
{
"name": "callback",
"type": "function",
@@ -254,21 +241,21 @@
"description": "Removes all items within the specified date range from the history. Pages will not be removed from the history unless all visits fall within the range.",
"async": "callback",
"parameters": [
{
"name": "range",
"type": "object",
"properties": {
"startTime": {
- "$ref": "HistoryTime",
+ "$ref": "extensionTypes.Date",
"description": "Items added to history after this date."
},
"endTime": {
- "$ref": "HistoryTime",
+ "$ref": "extensionTypes.Date",
"description": "Items added to history before this date."
}
}
},
{
"name": "callback",
"type": "function",
"parameters": []
--- a/browser/components/extensions/test/xpcshell/test_ext_history.js
+++ b/browser/components/extensions/test/xpcshell/test_ext_history.js
@@ -284,17 +284,16 @@ add_task(function* test_add_url() {
browser.test.sendMessage("ready");
}
let addTestData = [
[{}, "default"],
[{visitTime: new Date()}, "with_date"],
[{visitTime: Date.now()}, "with_ms_number"],
- [{visitTime: Date.now().toString()}, "with_ms_string"],
[{visitTime: new Date().toISOString()}, "with_iso_string"],
[{transition: "typed"}, "valid_transition"],
];
let failTestData = [
[{transition: "generated"}, "an invalid transition", "|generated| is not a supported transition for history"],
[{visitTime: Date.now() + 1000000}, "a future date", "cannot be a future date"],
[{url: "about.config"}, "an invalid url", "about.config is not a valid URL"],