移除locale的注入及navigator.language的重写; native对象改为只读
parent
f9c4007e3f
commit
5da22eed8e
|
@ -18,13 +18,11 @@ class Inject:
|
|||
code = open(self.abspath('./inject.js'), 'r').read()
|
||||
frame = WebKit2.UserContentInjectedFrames.ALL_FRAMES
|
||||
time = WebKit2.UserScriptInjectionTime.END
|
||||
lang, charset = env['LANG'].split('.')
|
||||
|
||||
code = code.replace("'{{env}}'", json.dumps(env))
|
||||
code = code.replace("{{uuid}}", webview.uuid)
|
||||
code = code.replace("{{app_name}}", webview.app_name)
|
||||
code = code.replace("{{app_version}}", webview.app_version)
|
||||
code = code.replace("{{lang}}", lang)
|
||||
|
||||
script = WebKit2.UserScript(code, frame, time, None, None)
|
||||
|
||||
|
|
|
@ -212,10 +212,7 @@ class EventEmitter {
|
|||
}
|
||||
}
|
||||
|
||||
readonly(navigator, 'language', '{{lang}}')
|
||||
readonly(navigator, 'languages', ['{{lang}}'])
|
||||
|
||||
window.native = new EventEmitter()
|
||||
readonly(window, 'native', new EventEmitter())
|
||||
|
||||
native.$on('opener_message', (data, uuid) => _postMessage(data, uuid))
|
||||
|
||||
|
|
Loading…
Reference in New Issue