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'
|
||||
// )
|
||||
|
||||
// chrome.debugger.sendCommand(
|
||||
// { tabId: tabId },
|
||||
// 'Emulation.clearIdleOverride'
|
||||
// )
|
||||
|
||||
if (result.timezone) {
|
||||
chrome.debugger.sendCommand(
|
||||
{ tabId: tabId },
|
||||
|
|
@ -88,7 +83,12 @@ const attachTab = (tabId, ipData) => {
|
|||
}
|
||||
|
||||
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) => {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import React, { useState, useEffect } from 'react'
|
||||
import detachDebugger from '../../utils/detachDebugger'
|
||||
|
||||
const DebugSettings = ({ type, title, ip }) => {
|
||||
const [value, setValue] = useState('')
|
||||
|
|
@ -27,6 +28,7 @@ const DebugSettings = ({ type, title, ip }) => {
|
|||
chrome.storage.sync.set({ [matchIPStorage]: !matchIP })
|
||||
setMatchIP(!matchIP)
|
||||
}
|
||||
// detachDebugger()
|
||||
}
|
||||
|
||||
const toggleMatchIP = (e) => {
|
||||
|
|
|
|||
|
|
@ -1,14 +1,5 @@
|
|||
import React from 'react'
|
||||
|
||||
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 })
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
import detachDebugger from '../../utils/detachDebugger'
|
||||
|
||||
const getFlagEmoji = (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