Bug 1325814 - Remove unnecessary schemas/menus_internal.json
This schema was inherited from Chromium (where it was an internal
implementation detail. This schema only defined the OnClickData
type, but was never actively used by our WebExtensions framework,
because menus.json already defines the OnClickData type.
Note: menus_internal.json specified the "menusInternal" namespace
which we do indeed implement in parent/ext-menus.js (and use in
child/ext-menus.js). However, none of the methods that we add to
menusInternal are actually defined in the schema.
This use of menusInternal was introduced in part 2 of
bug 1333403 and
works without problems because the API schemas are not being used to
validate APIs as of part 2 of
bug 1315575.
The only significance of "menusInternal" is that the namespace is
defined in browser/components/extensions/ext-browser.json,
implemented in browser/components/extensions/parent/ext-menus.js
and used by browser/components/extensions/child/ext-menus.js
MozReview-Commit-ID: 2ACpn595QZQ
--- a/browser/components/extensions/extensions-browser.manifest
+++ b/browser/components/extensions/extensions-browser.manifest
@@ -1,7 +1,5 @@
category webextension-modules browser chrome://browser/content/ext-browser.json
category webextension-scripts c-browser chrome://browser/content/parent/ext-browser.js
category webextension-scripts-devtools browser chrome://browser/content/child/ext-browser.js
category webextension-scripts-addon browser chrome://browser/content/child/ext-browser.js
-
-category webextension-schemas menus_internal chrome://browser/content/schemas/menus_internal.json
--- a/browser/components/extensions/schemas/jar.mn
+++ b/browser/components/extensions/schemas/jar.mn
@@ -11,17 +11,16 @@ browser.jar:
content/browser/schemas/devtools.json
content/browser/schemas/devtools_inspected_window.json
content/browser/schemas/devtools_network.json
content/browser/schemas/devtools_panels.json
content/browser/schemas/find.json
content/browser/schemas/geckoProfiler.json
content/browser/schemas/history.json
content/browser/schemas/menus.json
- content/browser/schemas/menus_internal.json
content/browser/schemas/omnibox.json
content/browser/schemas/page_action.json
content/browser/schemas/pkcs11.json
content/browser/schemas/search.json
content/browser/schemas/sessions.json
content/browser/schemas/sidebar_action.json
content/browser/schemas/tabs.json
content/browser/schemas/url_overrides.json
--- a/browser/components/extensions/schemas/menus.json
+++ b/browser/components/extensions/schemas/menus.json
@@ -194,17 +194,17 @@
},
"onclick": {
"type": "function",
"optional": true,
"description": "A function that will be called back when the menu item is clicked. Event pages cannot use this; instead, they should register a listener for $(ref:contextMenus.onClicked).",
"parameters": [
{
"name": "info",
- "$ref": "contextMenusInternal.OnClickData",
+ "$ref": "OnClickData",
"description": "Information about the item clicked and the context where the click happened."
},
{
"name": "tab",
"$ref": "tabs.Tab",
"description": "The details of the tab where the click took place. Note: this parameter only present for extensions."
}
]
@@ -290,17 +290,17 @@
"optional": true
},
"onclick": {
"type": "function",
"optional": "omit-key-if-missing",
"parameters": [
{
"name": "info",
- "$ref": "menusInternal.OnClickData"
+ "$ref": "OnClickData"
},
{
"name": "tab",
"$ref": "tabs.Tab",
"description": "The details of the tab where the click took place. Note: this parameter only present for extensions."
}
]
},
@@ -405,17 +405,17 @@
{
"name": "onShown",
"type": "function",
"description": "Fired when a menu is shown. The extension can add, modify or remove menu items and call menus.refresh() to update the menu.",
"parameters": [
{
"name": "info",
"type": "object",
- "description": "Information about the context of the menu action and the created menu items. For more information about each property, see contextMenusInternal.OnClickData. The following properties are only set if the extension has host permissions for the given context: linkUrl, linkText, srcUrl, pageUrl, frameUrl, selectionText.",
+ "description": "Information about the context of the menu action and the created menu items. For more information about each property, see OnClickData. The following properties are only set if the extension has host permissions for the given context: linkUrl, linkText, srcUrl, pageUrl, frameUrl, selectionText.",
"properties": {
"menuIds": {
"description": "A list of IDs of the menu items that were shown.",
"type": "array",
"items": {
"choices": [
{ "type": "integer" },
{ "type": "string" }
deleted file mode 100644
--- a/browser/components/extensions/schemas/menus_internal.json
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-[
- {
- "namespace": "menusInternal",
- "allowedContexts": ["addon_parent_only"],
- "description": "Use the <code>browser.contextMenus</code> API to add items to the browser's context menu. You can choose what types of objects your context menu additions apply to, such as images, hyperlinks, and pages.",
- "types": [
- {
- "id": "OnClickData",
- "type": "object",
- "description": "Information sent when a context menu item is clicked.",
- "properties": {
- "menuItemId": {
- "choices": [
- { "type": "integer" },
- { "type": "string" }
- ],
- "description": "The ID of the menu item that was clicked."
- },
- "parentMenuItemId": {
- "choices": [
- { "type": "integer" },
- { "type": "string" }
- ],
- "optional": true,
- "description": "The parent ID, if any, for the item clicked."
- },
- "mediaType": {
- "type": "string",
- "optional": true,
- "description": "One of 'image', 'video', or 'audio' if the context menu was activated on one of these types of elements."
- },
- "linkUrl": {
- "type": "string",
- "optional": true,
- "description": "If the element is a link, the URL it points to."
- },
- "srcUrl": {
- "type": "string",
- "optional": true,
- "description": "Will be present for elements with a 'src' URL."
- },
- "pageUrl": {
- "type": "string",
- "optional": true,
- "description": "The URL of the page where the menu item was clicked. This property is not set if the click occured in a context where there is no current page, such as in a launcher context menu."
- },
- "frameUrl": {
- "type": "string",
- "optional": true,
- "description": " The URL of the frame of the element where the context menu was clicked, if it was in a frame."
- },
- "selectionText": {
- "type": "string",
- "optional": true,
- "description": "The text for the context selection, if any."
- },
- "editable": {
- "type": "boolean",
- "description": "A flag indicating whether the element is editable (text input, textarea, etc.)."
- },
- "wasChecked": {
- "type": "boolean",
- "optional": true,
- "description": "A flag indicating the state of a checkbox or radio item before it was clicked."
- },
- "checked": {
- "type": "boolean",
- "optional": true,
- "description": "A flag indicating the state of a checkbox or radio item after it is clicked."
- }
- }
- }
- ]
- }
-]
--- a/toolkit/components/extensions/ExtensionChild.jsm
+++ b/toolkit/components/extensions/ExtensionChild.jsm
@@ -1046,19 +1046,16 @@ class ChildAPIManager {
}
shouldInject(namespace, name, allowedContexts) {
// Do not generate content script APIs, unless explicitly allowed.
if (this.context.envType === "content_child" &&
!allowedContexts.includes("content")) {
return false;
}
- if (allowedContexts.includes("addon_parent_only")) {
- return false;
- }
// Do not generate devtools APIs, unless explicitly allowed.
if (this.context.envType === "devtools_child" &&
!allowedContexts.includes("devtools")) {
return false;
}
// Do not generate devtools APIs, unless explicitly allowed.