зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1657537
- Part 2 - Move MDNCompatibility library and related files to devtools/server/actors/compatibility r=daisuke,mtigley
This moves the MDNCompatibility library and the related datasets and tests to the server side. It also moves the compatibility actor file intot he compatibility directory. The links to these files have been updated and the library tests have been moved to the new location. Differential Revision: https://phabricator.services.mozilla.com/D86521
This commit is contained in:
Родитель
4825b53af6
Коммит
da1f86f883
|
@ -7,56 +7,18 @@ The compatibility panel consists of the following files:
|
|||
* Style: `devtools/client/themes/compatibility.css`
|
||||
* Shared:
|
||||
* MDN compatibility dataset: `devtools/shared/compatibility/dataset/`
|
||||
* MDN compatibility library: `devtools/shared/compatibility/MDNCompatibility.js`
|
||||
* MDN compatibility library: `devtools/server/actors/compatibility/lib/MDNCompatibility.js`
|
||||
* Server:
|
||||
* Actor: `devtools/server/actors/compatibility.js`
|
||||
* Front: `devtools/client/fronts/compatibility.js`
|
||||
* Spec: `devtools/shared/specs/compatibility.js`
|
||||
|
||||
## How to update the MDN compatibility data
|
||||
## MDN Compatibility Data
|
||||
The Compatibility panel detects issues by comparing against official [MDN compatibility data](https://github.com/mdn/browser-compat-data). It uses a local snapshot of the dataset. This dataset needs to be manually synchronized periodically to `devtools/shared/compatibility/dataset` (ideally with every Firefox release).
|
||||
|
||||
The subsets from the dataset required by the Compatibility panel are:
|
||||
* browsers: [https://github.com/mdn/browser-compat-data/tree/master/browsers](https://github.com/mdn/browser-compat-data/tree/master/browsers)
|
||||
* css.properties: [https://github.com/mdn/browser-compat-data/tree/master/css](https://github.com/mdn/browser-compat-data/tree/master/css).
|
||||
|
||||
The MDN compatibility data is available as a node package ([mdn-browser-compat-data](https://www.npmjs.com/package/mdn-browser-compat-data)).
|
||||
The following node program is a sample of how to download `browsers.json` and `css-properties.json` using the node package.
|
||||
|
||||
```javascript
|
||||
'use strict';
|
||||
|
||||
const compatData = require("mdn-browser-compat-data");
|
||||
const fs = require("fs")
|
||||
const path = require("path")
|
||||
|
||||
function exportData(data, fileName) {
|
||||
const content = `${ JSON.stringify(data) }`
|
||||
|
||||
fs.writeFile(
|
||||
path.resolve(
|
||||
__dirname,
|
||||
fileName
|
||||
),
|
||||
content,
|
||||
err => {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
exportData(compatData.css.properties, "css-properties.json");
|
||||
exportData(compatData.browsers, "browsers.json");
|
||||
|
||||
```
|
||||
|
||||
Save the JSON files created by the script to `devtools/shared/compatibility/dataset/`.
|
||||
|
||||
Check that all tests still pass. It is possible that changes in the structure or contents of the latest dataset will cause tests to fail. If that is the case, fix the tests. **Do not manually change the contents or structure of the local dataset** because any changes will be overwritten by the next update from the official dataset.
|
||||
To update this dataset, please refer to the guidelines in `devtools/shared/compatibility/README.md`
|
||||
|
||||
## Tests
|
||||
* Client: `devtools/client/inspector/compatibility/test`
|
||||
* MDN compatibility library: `devtools/shared/compatibility/test`
|
||||
* MDN compatibility library: `devtools/server/actors/compatibility/lib/test`
|
||||
* Server: `devtools/server/tests/browser/browser_compatibility_cssIssues.js`
|
||||
|
|
|
@ -11,11 +11,11 @@ const { compatibilitySpec } = require("devtools/shared/specs/compatibility");
|
|||
loader.lazyRequireGetter(
|
||||
this,
|
||||
"browsersDataset",
|
||||
"devtools/shared/compatibility/dataset/browsers.json"
|
||||
"devtools/shared/browsers.json"
|
||||
);
|
||||
|
||||
loader.lazyGetter(this, "mdnCompatibility", () => {
|
||||
const MDNCompatibility = require("devtools/shared/compatibility/MDNCompatibility");
|
||||
const MDNCompatibility = require("devtools/server/actors/compatibility/lib/MDNCompatibility");
|
||||
const cssPropertiesCompatData = require("devtools/shared/compatibility/dataset/css-properties.json");
|
||||
return new MDNCompatibility(cssPropertiesCompatData);
|
||||
});
|
||||
|
@ -160,7 +160,7 @@ const CompatibilityActor = protocol.ActorClassWithSpec(compatibilitySpec, {
|
|||
* @param targetBrowsers Array
|
||||
* An Array of JSON object of target browser to check compatibility against in following form:
|
||||
* {
|
||||
* // Browser id as specified in `devtools/shared/compatibility/datasets/browser.json`
|
||||
* // Browser id as specified in `devtools/server/actors/compatibility/lib/datasets/browser.json`
|
||||
* id: <string>,
|
||||
* name: <string>,
|
||||
* version: <string>,
|
|
@ -0,0 +1,11 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell/xpcshell.ini']
|
||||
|
||||
DevToolsModules(
|
||||
'MDNCompatibility.js',
|
||||
)
|
|
@ -2,5 +2,5 @@
|
|||
|
||||
module.exports = {
|
||||
// Extend from the common devtools xpcshell eslintrc config.
|
||||
extends: "../../../../.eslintrc.xpcshell.js",
|
||||
extends: "../../../../../../.eslintrc.xpcshell.js",
|
||||
};
|
|
@ -5,7 +5,7 @@
|
|||
// Test for the MDN compatibility diagnosis module.
|
||||
|
||||
const { COMPATIBILITY_ISSUE_TYPE } = require("devtools/shared/constants");
|
||||
const MDNCompatibility = require("devtools/shared/compatibility/MDNCompatibility");
|
||||
const MDNCompatibility = require("devtools/server/actors/compatibility/lib/MDNCompatibility");
|
||||
const cssPropertiesCompatData = require("devtools/shared/compatibility/dataset/css-properties.json");
|
||||
|
||||
const mdnCompatibility = new MDNCompatibility(cssPropertiesCompatData);
|
|
@ -0,0 +1,16 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
DIRS += [
|
||||
'lib',
|
||||
]
|
||||
|
||||
DevToolsModules(
|
||||
'compatibility.js',
|
||||
)
|
||||
|
||||
with Files('**'):
|
||||
BUG_COMPONENT = ('DevTools', 'Inspector: Compatibility')
|
|
@ -94,7 +94,7 @@ loader.lazyRequireGetter(
|
|||
loader.lazyRequireGetter(
|
||||
this,
|
||||
"CompatibilityActor",
|
||||
"devtools/server/actors/compatibility",
|
||||
"devtools/server/actors/compatibility/compatibility",
|
||||
true
|
||||
);
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
DIRS += [
|
||||
'accessibility',
|
||||
'addon',
|
||||
'compatibility',
|
||||
'descriptors',
|
||||
'emulation',
|
||||
'highlighters',
|
||||
|
@ -28,7 +29,6 @@ DevToolsModules(
|
|||
'breakpoint.js',
|
||||
'changes.js',
|
||||
'common.js',
|
||||
'compatibility.js',
|
||||
'css-properties.js',
|
||||
'device.js',
|
||||
'environment.js',
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
# Compatibility Dataset
|
||||
|
||||
## How to update the MDN compatibility data
|
||||
The Compatibility panel detects issues by comparing against official [MDN compatibility data](https://github.com/mdn/browser-compat-data). It uses a local snapshot of the dataset. This dataset needs to be manually synchronized periodically to `devtools/shared/compatibility/dataset` (ideally with every Firefox release).
|
||||
|
||||
The subsets from the dataset required by the Compatibility panel are:
|
||||
* browsers: [https://github.com/mdn/browser-compat-data/tree/master/browsers](https://github.com/mdn/browser-compat-data/tree/master/browsers)
|
||||
* css.properties: [https://github.com/mdn/browser-compat-data/tree/master/css](https://github.com/mdn/browser-compat-data/tree/master/css).
|
||||
|
||||
The MDN compatibility data is available as a node package ([mdn-browser-compat-data](https://www.npmjs.com/package/mdn-browser-compat-data)).
|
||||
The following node program is a sample of how to download `browsers.json` and `css-properties.json` using the node package.
|
||||
|
||||
```javascript
|
||||
'use strict';
|
||||
|
||||
const compatData = require("mdn-browser-compat-data");
|
||||
const fs = require("fs")
|
||||
const path = require("path")
|
||||
|
||||
function exportData(data, fileName) {
|
||||
const content = `${ JSON.stringify(data) }`
|
||||
|
||||
fs.writeFile(
|
||||
path.resolve(
|
||||
__dirname,
|
||||
fileName
|
||||
),
|
||||
content,
|
||||
err => {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
exportData(compatData.css.properties, "css-properties.json");
|
||||
exportData(compatData.browsers, "browsers.json");
|
||||
|
||||
```
|
||||
|
||||
Save the JSON files created by the script to `devtools/shared/compatibility/dataset/`.
|
||||
|
||||
Check that all tests still pass. It is possible that changes in the structure or contents of the latest dataset will cause tests to fail. If that is the case, fix the tests. **Do not manually change the contents or structure of the local dataset** because any changes will be overwritten by the next update from the official dataset.
|
|
@ -8,8 +8,5 @@ DIRS += [
|
|||
'dataset',
|
||||
]
|
||||
|
||||
XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell/xpcshell.ini']
|
||||
|
||||
DevToolsModules(
|
||||
'MDNCompatibility.js',
|
||||
)
|
||||
with Files('**'):
|
||||
BUG_COMPONENT = ('DevTools', 'Inspector: Compatibility')
|
||||
|
|
|
@ -8,8 +8,8 @@ include('../templates.mozbuild')
|
|||
|
||||
DIRS += [
|
||||
'acorn',
|
||||
'compatibility',
|
||||
'css',
|
||||
'compatibility',
|
||||
'discovery',
|
||||
'heapsnapshot',
|
||||
'inspector',
|
||||
|
|
Загрузка…
Ссылка в новой задаче