-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from paullewis/extension-backport
Extension backport and refactor.
- Loading branch information
Showing
38 changed files
with
1,420 additions
and
903 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* Copyright 2016 Google Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const manifestParser = require('../../helpers/manifest-parser'); | ||
|
||
class ManifestBackgroundColor { | ||
|
||
static get tags() { | ||
return ['Manifest']; | ||
} | ||
|
||
static get description() { | ||
return 'Contains background_color'; | ||
} | ||
|
||
static audit(inputs) { | ||
let hasBackgroundColor = false; | ||
const manifest = manifestParser(inputs.manifest).value; | ||
|
||
if (manifest) { | ||
hasBackgroundColor = (!!manifest.background_color); | ||
} | ||
|
||
return { | ||
value: hasBackgroundColor, | ||
tags: ManifestBackgroundColor.tags, | ||
description: ManifestBackgroundColor.description | ||
}; | ||
} | ||
} | ||
|
||
module.exports = ManifestBackgroundColor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* Copyright 2016 Google Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const manifestParser = require('../../helpers/manifest-parser'); | ||
|
||
class ManifestIcons192 { | ||
|
||
static get tags() { | ||
return ['Manifest']; | ||
} | ||
|
||
static get description() { | ||
return 'Contains 192px icons'; | ||
} | ||
|
||
static audit(inputs) { | ||
let hasIcons = false; | ||
const manifest = manifestParser(inputs.manifest).value; | ||
|
||
if (manifest && manifest.icons) { | ||
const icons192 = manifest.icons.raw.find(i => i.sizes === '192x192'); | ||
hasIcons = (!!icons192); | ||
} | ||
|
||
return { | ||
value: hasIcons, | ||
tags: ManifestIcons192.tags, | ||
description: ManifestIcons192.description | ||
}; | ||
} | ||
} | ||
|
||
module.exports = ManifestIcons192; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* Copyright 2016 Google Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const manifestParser = require('../../helpers/manifest-parser'); | ||
|
||
class ManifestIcons { | ||
|
||
static get tags() { | ||
return ['Manifest']; | ||
} | ||
|
||
static get description() { | ||
return 'Contains icons'; | ||
} | ||
|
||
static audit(inputs) { | ||
let hasIcons = false; | ||
const manifest = manifestParser(inputs.manifest).value; | ||
|
||
if (manifest) { | ||
hasIcons = (!!manifest.icons); | ||
} | ||
|
||
return { | ||
value: hasIcons, | ||
tags: ManifestIcons.tags, | ||
description: ManifestIcons.description | ||
}; | ||
} | ||
} | ||
|
||
module.exports = ManifestIcons; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* Copyright 2016 Google Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const manifestParser = require('../../helpers/manifest-parser'); | ||
|
||
class ManifestShortName { | ||
|
||
static get tags() { | ||
return ['Manifest']; | ||
} | ||
|
||
static get description() { | ||
return 'Contains short_name'; | ||
} | ||
|
||
static audit(inputs) { | ||
let hasShortName = false; | ||
const manifest = manifestParser(inputs.manifest).value; | ||
|
||
if (manifest) { | ||
hasShortName = (!!manifest.short_name); | ||
} | ||
|
||
return { | ||
value: hasShortName, | ||
tags: ManifestShortName.tags, | ||
description: ManifestShortName.description | ||
}; | ||
} | ||
} | ||
|
||
module.exports = ManifestShortName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* Copyright 2016 Google Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const manifestParser = require('../../helpers/manifest-parser'); | ||
|
||
class ManifestStartUrl { | ||
|
||
static get tags() { | ||
return ['Manifest']; | ||
} | ||
|
||
static get description() { | ||
return 'Contains start_url'; | ||
} | ||
|
||
static audit(inputs) { | ||
let hasStartUrl = false; | ||
const manifest = manifestParser(inputs.manifest).value; | ||
|
||
if (manifest) { | ||
hasStartUrl = (!!manifest.start_url); | ||
} | ||
|
||
return { | ||
value: hasStartUrl, | ||
tags: ManifestStartUrl.tags, | ||
description: ManifestStartUrl.description | ||
}; | ||
} | ||
} | ||
|
||
module.exports = ManifestStartUrl; |
Oops, something went wrong.