Bug 1280404 - Implement chrome.webNavigation.onTabReplaced, r?aswan
MozReview-Commit-ID: 6K167oHyqz2
--- a/toolkit/components/extensions/ext-webNavigation.js
+++ b/toolkit/components/extensions/ext-webNavigation.js
@@ -156,16 +156,17 @@ function convertGetFrameResult(tabId, da
frameId: ExtensionManagement.getFrameId(data.windowId),
parentFrameId: ExtensionManagement.getParentFrameId(data.parentWindowId, data.windowId),
};
}
extensions.registerSchemaAPI("webNavigation", "addon_parent", context => {
return {
webNavigation: {
+ onTabReplaced: ignoreEvent(context, "webNavigation.onTabReplaced"),
onBeforeNavigate: new WebNavigationEventManager(context, "onBeforeNavigate").api(),
onCommitted: new WebNavigationEventManager(context, "onCommitted").api(),
onDOMContentLoaded: new WebNavigationEventManager(context, "onDOMContentLoaded").api(),
onCompleted: new WebNavigationEventManager(context, "onCompleted").api(),
onErrorOccurred: new WebNavigationEventManager(context, "onErrorOccurred").api(),
onReferenceFragmentUpdated: new WebNavigationEventManager(context, "onReferenceFragmentUpdated").api(),
onHistoryStateUpdated: new WebNavigationEventManager(context, "onHistoryStateUpdated").api(),
onCreatedNavigationTarget: ignoreEvent(context, "webNavigation.onCreatedNavigationTarget"),
--- a/toolkit/components/extensions/schemas/web_navigation.json
+++ b/toolkit/components/extensions/schemas/web_navigation.json
@@ -335,17 +335,16 @@
"optional": true,
"$ref": "EventUrlFilters",
"description": "Conditions that the URL being navigated to must satisfy. The 'schemes' and 'ports' fields of UrlFilter are ignored for this event."
}
]
},
{
"name": "onTabReplaced",
- "unsupported": true,
"type": "function",
"description": "Fired when the contents of the tab is replaced by a different (usually previously pre-rendered) tab.",
"parameters": [
{
"type": "object",
"name": "details",
"properties": {
"replacedTabId": {"type": "integer", "description": "The ID of the tab that was replaced."},
--- a/toolkit/components/extensions/test/mochitest/test_ext_webnavigation.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_webnavigation.html
@@ -16,16 +16,17 @@
/* globals sendMouseEvent */
function backgroundScript() {
const BASE = "http://mochi.test:8888/tests/toolkit/components/extensions/test/mochitest";
const URL = BASE + "/file_WebNavigation_page1.html";
const EVENTS = [
+ "onTabReplaced",
"onBeforeNavigate",
"onCommitted",
"onDOMContentLoaded",
"onCompleted",
"onErrorOccurred",
"onReferenceFragmentUpdated",
"onHistoryStateUpdated",
];