In order to move away from the far superior method of overriding source code on the fly with the webRequest api, the extension employed an old method that was used in the past when it was a userscript.
However, very likely as a result of this, the extension is now causing YT to falsely detect an adblocker as detailed in #928
From an initial appreciation, this seems to result from modifying parts of the code that should not be modified, specifically the Polymer stamp renderer templates, denoted as json-to-object representations, that are used as a skeleton to build on when receiving and parsing data payloads.
This structure contains a map with default values and pattern matching for certain values, and it should not be touched.
The current methods need to be tuned to distinguish when they should intercept or not the reads and writes, which they are currently not.
Another caution that must be made is to not override values when it is not needed. The script is currently overriding the JSON.parse method universally and relaying any processing to active listeners. This can cause problems when the listener cannot distinguish between new data vs template structure.
It is possible that many of these methods might not even need to be assigned to that interception to begin with, which would avoid the issue altogether thanks to the great help provided by @axxes8 in the mentioned issue.
Others will need extra checks to make sure to only override when needed.
Implemented changes had positive results on a preliminary appreciation, if the original issue still occurs then the logic will need to be revised again.
In order to move away from the far superior method of overriding source code on the fly with the
webRequest
api, the extension employed an old method that was used in the past when it was a userscript.However, very likely as a result of this, the extension is now causing YT to falsely detect an adblocker as detailed in #928
From an initial appreciation, this seems to result from modifying parts of the code that should not be modified, specifically the Polymer stamp renderer templates, denoted as json-to-object representations, that are used as a skeleton to build on when receiving and parsing data payloads.
This structure contains a map with default values and pattern matching for certain values, and it should not be touched.
The current methods need to be tuned to distinguish when they should intercept or not the reads and writes, which they are currently not.
Another caution that must be made is to not override values when it is not needed. The script is currently overriding the
JSON.parse
method universally and relaying any processing to active listeners. This can cause problems when the listener cannot distinguish between new data vs template structure.It is possible that many of these methods might not even need to be assigned to that interception to begin with, which would avoid the issue altogether thanks to the great help provided by @axxes8 in the mentioned issue.
Others will need extra checks to make sure to only override when needed.