Merge pull request #6804 from nurbek91/drupal1

Update Drupal / cms
main
Elbert Alias 2 years ago committed by GitHub
commit a19696c9b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -10,7 +10,7 @@ const {
resolve,
getTechnology,
} = Wappalyzer
const { agent, promisify, getOption, setOption, open, globEscape } = Utils
const { agent, getOption, setOption, open, globEscape } = Utils
const expiry = 1000 * 60 * 60 * 24
@ -93,7 +93,7 @@ const Driver = {
chrome.tabs.onUpdated.addListener(async (id, { status, url }) => {
if (status === 'complete') {
;({ url } = await promisify(chrome.tabs, 'get', id))
;({ url } = await chrome.tabs.get(id))
}
if (url) {
@ -335,7 +335,7 @@ const Driver = {
},
async content(url, func, args) {
const [tab] = await promisify(chrome.tabs, 'query', {
const [tab] = await chrome.tabs.query({
url: globEscape(url),
})
@ -347,29 +347,23 @@ const Driver = {
throw new Error(`Tab ${tab.id} not ready for sendMessage: ${tab.status}`)
}
return new Promise((resolve, reject) => {
chrome.tabs.sendMessage(
tab.id,
{
const response = await chrome.tabs.sendMessage(tab.id, {
source: 'driver.js',
func,
args: args ? (Array.isArray(args) ? args : [args]) : [],
},
(response) => {
chrome.runtime.lastError
? func === 'error'
? resolve()
: Driver.error(
})
if (chrome.runtime.lastError && func !== 'error') {
Driver.error(
new Error(
`${
chrome.runtime.lastError.message
}: Driver.${func}(${JSON.stringify(args)})`
`${chrome.runtime.lastError.message}: Driver.${func}(${JSON.stringify(
args
)})`
)
)
: resolve(response)
} else {
return response
}
)
})
},
/**
@ -387,7 +381,7 @@ const Driver = {
try {
await new Promise((resolve) => setTimeout(resolve, 500))
const [tab] = await promisify(chrome.tabs, 'query', {
const [tab] = await chrome.tabs.query({
url: globEscape(request.url),
})
@ -502,7 +496,7 @@ const Driver = {
//
;(
await promisify(chrome.cookies, 'getAll', {
await chrome.cookies.getAll({
url,
})
).forEach(
@ -673,7 +667,7 @@ const Driver = {
let tabs = []
try {
tabs = await promisify(chrome.tabs, 'query', {
tabs = await chrome.tabs.query({
url: globEscape(url),
})
} catch (error) {
@ -734,7 +728,7 @@ const Driver = {
let tabs = []
try {
tabs = await promisify(chrome.tabs, 'query', {
tabs = await chrome.tabs.query({
url: globEscape(url),
})
} catch (error) {
@ -773,7 +767,7 @@ const Driver = {
* Get the detected technologies for the current tab
*/
async getDetections() {
const tab = await promisify(chrome.tabs, 'query', {
const tab = await chrome.tabs.query({
active: true,
currentWindow: true,
})

@ -2,8 +2,7 @@
/* eslint-env browser */
/* globals chrome, Utils */
const { agent, open, i18n, getOption, setOption, promisify, sendMessage } =
Utils
const { agent, open, i18n, getOption, setOption, sendMessage } = Utils
const baseUrl = 'https://www.wappalyzer.com'
const utm = '?utm_source=popup&utm_medium=extension&utm_campaign=wappalyzer'
@ -345,7 +344,7 @@ const Popup = {
let url
const tabs = await promisify(chrome.tabs, 'query', {
const tabs = await chrome.tabs.query({
active: true,
currentWindow: true,
})
@ -962,7 +961,7 @@ const Popup = {
new Blob([csv.join('\n')], { type: 'text/csv;charset=utf-8' })
)
const granted = await promisify(chrome.permissions, 'request', {
const granted = await chrome.permissions.request({
permissions: ['downloads'],
})

@ -5,13 +5,6 @@
// Manifest v2 polyfill
if (chrome.runtime.getManifest().manifest_version === 2) {
chrome.action = chrome.browserAction
chrome.storage.sync = {
get: (...args) =>
new Promise((resolve) => chrome.storage.local.get(...args, resolve)),
set: (...args) =>
new Promise((resolve) => chrome.storage.local.set(...args, resolve)),
}
}
// eslint-disable-next-line no-unused-vars
@ -22,24 +15,6 @@ const Utils = {
? 'safari'
: 'chrome',
/**
* Use promises instead of callbacks
* @param {Object} context
* @param {String} method
* @param {...any} args
*/
promisify(context, method, ...args) {
return new Promise((resolve, reject) => {
context[method](...args, (...args) => {
if (chrome.runtime.lastError) {
return reject(chrome.runtime.lastError)
}
resolve(...args)
})
})
},
/**
* Open a browser tab
* @param {String} url
@ -56,7 +31,7 @@ const Utils = {
*/
async getOption(name, defaultValue = null) {
try {
const option = await chrome.storage.sync.get(name)
const option = await chrome.storage.local.get(name)
if (option[name] !== undefined) {
return option[name]
@ -76,7 +51,7 @@ const Utils = {
*/
async setOption(name, value) {
try {
await chrome.storage.sync.set({
await chrome.storage.local.set({
[name]: value,
})
} catch (error) {

@ -74,11 +74,11 @@
"options_page": "html/options.html",
"permissions": [
"cookies",
"storage",
"scripting",
"storage",
"tabs",
"webRequest",
"webNavigation"
"webNavigation",
"webRequest"
],
"host_permissions": [
"http://*/*",

@ -1497,6 +1497,7 @@
},
"oss": true,
"scriptSrc": "drupal\\.js",
"scripts": "drupal_internal__nid",
"website": "https://drupal.org"
},
"Drupal Commerce": {