Fixed overriding timezone bug
This commit is contained in:
parent
ba176ea762
commit
cf406dac30
4 changed files with 21 additions and 16 deletions
|
|
@ -27,11 +27,6 @@ const attachTab = (tabId, ipData) => {
|
||||||
// 'Emulation.clearGeolocationOverride'
|
// 'Emulation.clearGeolocationOverride'
|
||||||
// )
|
// )
|
||||||
|
|
||||||
// chrome.debugger.sendCommand(
|
|
||||||
// { tabId: tabId },
|
|
||||||
// 'Emulation.clearIdleOverride'
|
|
||||||
// )
|
|
||||||
|
|
||||||
if (result.timezone) {
|
if (result.timezone) {
|
||||||
chrome.debugger.sendCommand(
|
chrome.debugger.sendCommand(
|
||||||
{ tabId: tabId },
|
{ tabId: tabId },
|
||||||
|
|
@ -88,7 +83,12 @@ const attachTab = (tabId, ipData) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
chrome.tabs.onUpdated.addListener((tabId, change, tab) => {
|
chrome.tabs.onUpdated.addListener((tabId, change, tab) => {
|
||||||
attachTab(tabId)
|
chrome.debugger.getTargets((tabs) => {
|
||||||
|
const currentTab = tabs.find((obj) => obj.tabId === tabId)
|
||||||
|
if (!currentTab.attached) {
|
||||||
|
attachTab(tabId)
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// const attachTabs = (ipData) => {
|
// const attachTabs = (ipData) => {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import React, { useState, useEffect } from 'react'
|
import React, { useState, useEffect } from 'react'
|
||||||
|
import detachDebugger from '../../utils/detachDebugger'
|
||||||
|
|
||||||
const DebugSettings = ({ type, title, ip }) => {
|
const DebugSettings = ({ type, title, ip }) => {
|
||||||
const [value, setValue] = useState('')
|
const [value, setValue] = useState('')
|
||||||
|
|
@ -27,6 +28,7 @@ const DebugSettings = ({ type, title, ip }) => {
|
||||||
chrome.storage.sync.set({ [matchIPStorage]: !matchIP })
|
chrome.storage.sync.set({ [matchIPStorage]: !matchIP })
|
||||||
setMatchIP(!matchIP)
|
setMatchIP(!matchIP)
|
||||||
}
|
}
|
||||||
|
// detachDebugger()
|
||||||
}
|
}
|
||||||
|
|
||||||
const toggleMatchIP = (e) => {
|
const toggleMatchIP = (e) => {
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,5 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import detachDebugger from '../../utils/detachDebugger'
|
||||||
const detachDebugger = () => {
|
|
||||||
chrome.debugger.getTargets((tabs) => {
|
|
||||||
for (const tab in tabs) {
|
|
||||||
if (tabs[tab].attached && tabs[tab].tabId) {
|
|
||||||
chrome.debugger.detach({ tabId: tabs[tab].tabId })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const getFlagEmoji = (countryCode) => {
|
const getFlagEmoji = (countryCode) => {
|
||||||
const codePoints = countryCode
|
const codePoints = countryCode
|
||||||
|
|
|
||||||
12
src/utils/detachDebugger.js
Normal file
12
src/utils/detachDebugger.js
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
const detachDebugger = () => {
|
||||||
|
chrome.debugger.getTargets((tabs) => {
|
||||||
|
console.log(tabs)
|
||||||
|
for (const tab in tabs) {
|
||||||
|
if (tabs[tab].attached && tabs[tab].tabId) {
|
||||||
|
chrome.debugger.detach({ tabId: tabs[tab].tabId })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default detachDebugger
|
||||||
Loading…
Add table
Reference in a new issue