cannot get ParentNode.prototype.querySelector at initial parser sees <html> tag
Reported by
ctengc...@gmail.com,
Nov 23 2016
|
|||
Issue descriptionSteps to reproduce the problem: Background: we are building a AdBlocker module on android using a custom embedder, and use WebView.evaluateJavaScript to inject js code to remove ad popup elements. Due to DOM prototype may be overridden by site js code, we imported Opera's `sitepatcher` module for the purpose of injecting js. The basic idea is: keep the original DOM prototype method refs when html parser first sees <html> tag, when site js code is still not yet imported. However, it turns out we cannot get querySelector ref by Document.prototype.querySelector or ParentNode.prototype.querySelector, but we can get removeChild by Node.prototype.removeChild. querySelector's internal binding wrapper mechanism seems to be no different than querySelector, i cannot figure out why? What is the expected behavior? What went wrong? Should be able to get DOM method querySelector ref by ParentNode.prototype.querySelector or Document..prototype.querySelector at early initialization stage(when html parser sees the <html> tag) But can't. But removeChild is no problem. Did this work before? No Chrome version: 43.0.2357.134 Channel: stable OS Version: 5.1 Flash Version:
,
Nov 23 2016
Sorry typo: querySelector's internal binding wrapper mechanism seems to be no different than querySelector, should be querySelector's internal binding wrapper mechanism seems to be no different than removeChild,
,
Nov 23 2016
,
Apr 13 2017
ParentNode doesn't have any public exposure, so that isn't intended to work.
Can't reproduce the rest at ToT; I wrote a content script that injects at document start that prints Document.prototype.querySelector and Node.prototype.removeChild, and they both exist:
function querySelector() { [native code] }
function removeChild() { [native code] }
|
|||
►
Sign in to add a comment |
|||
Comment 1 by ctengc...@gmail.com
, Nov 23 2016