forked from mirrors/gecko-dev
The `mdn_url` property in the compatibility data is not always defined, as some properties are not documented on MDN. Luckily, there's a `spec_url` property that we can default to in such case, so we return that from the server, and fall back to this in the compatibility panel and the compatibility tooltip. We might still have cases where we don't have any link at all, so in such case, we don't render a link in the compatibility panel, and we don't show the "Learn more" link in the compatibility tooltip. In order to properly check the page the user might be taken to, we move the `simulateLinkClick` helper to `shared-head.js` and use it in both compatibility panel and compatibility tooltip assertion helpers. Some tests are then updated to provide the now missing information that those helpers expect. Differential Revision: https://phabricator.services.mozilla.com/D179030
69 lines
1.7 KiB
JavaScript
69 lines
1.7 KiB
JavaScript
/* 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";
|
|
|
|
const {
|
|
Arg,
|
|
RetVal,
|
|
generateActorSpec,
|
|
types,
|
|
} = require("resource://devtools/shared/protocol.js");
|
|
|
|
types.addDictType("browsertype", {
|
|
id: "string",
|
|
name: "string",
|
|
version: "string",
|
|
status: "string",
|
|
});
|
|
|
|
types.addDictType("compatibilityissues", {
|
|
type: "string",
|
|
property: "string",
|
|
aliases: "nullable:array:string",
|
|
url: "nullable:string",
|
|
specUrl: "nullable:string",
|
|
deprecated: "boolean",
|
|
experimental: "boolean",
|
|
unsupportedBrowsers: "array:browsertype",
|
|
});
|
|
|
|
types.addDictType("declaration", {
|
|
name: "string",
|
|
value: "string",
|
|
});
|
|
|
|
const compatibilitySpec = generateActorSpec({
|
|
typeName: "compatibility",
|
|
|
|
methods: {
|
|
// While not being used on the client at the moment, keep this method in case
|
|
// we need traits again to support backwards compatibility for the Compatibility
|
|
// actor.
|
|
getTraits: {
|
|
request: {},
|
|
response: { traits: RetVal("json") },
|
|
},
|
|
getCSSDeclarationBlockIssues: {
|
|
request: {
|
|
domRulesDeclarations: Arg(0, "array:array:declaration"),
|
|
targetBrowsers: Arg(1, "array:browsertype"),
|
|
},
|
|
response: {
|
|
compatibilityIssues: RetVal("array:array:compatibilityissues"),
|
|
},
|
|
},
|
|
getNodeCssIssues: {
|
|
request: {
|
|
node: Arg(0, "domnode"),
|
|
targetBrowsers: Arg(1, "array:browsertype"),
|
|
},
|
|
response: {
|
|
compatibilityIssues: RetVal("array:compatibilityissues"),
|
|
},
|
|
},
|
|
},
|
|
});
|
|
|
|
exports.compatibilitySpec = compatibilitySpec;
|