mirror of https://github.com/gorhill/uBlock.git
Clear return value of vapi.js content script (#3721)
Upon start-up, uBlock runs all content scripts in manifest.json using `chrome.tabs.executeScript`. When this API is used, the value of the last expression is automatically cloned and transferred to the callback of `chrome.tabs.executeScript`. This is convenient if needed, and a performance burden otherwise (the latter is the case for uBlock). There are three content scripts that need to be checked: - vapi.js The last expression is often the vAPI object, and it is relatively expensive to clone this object. This commit sets the value of the last expression to `void 0` to solve this inefficiency. - vapi-client.js No action needed yet; The last expression is `vAPI.shutdown.add(...)`, which has a void return value. - contentscript.js No action needed yet; The last expression is an immediately-invoked function expression without return value.
This commit is contained in:
parent
820ec69916
commit
b27f23d520
|
@ -53,4 +53,8 @@ if (
|
|||
: { uBO: true };
|
||||
}
|
||||
|
||||
// Set the value of the last expression to undefined to avoid serializing the
|
||||
// vAPI object when the content script is run using chrome.tabs.executeScript.
|
||||
void 0;
|
||||
|
||||
/******************************************************************************/
|
||||
|
|
Loading…
Reference in New Issue