DescriptionThrow JavaScript error instead of CHECK when this is invalid.
The extension system frequently uses privates(this).
this can easily be set to a non-object or a null value by accident,
so throw an exception instead of terminating the renderer.
Example:
var addListener = chrome.runtime.onMessage.addListener;
addListener(function() { });
// In strict mode, the "this" of addListener is undefined, which
// causes the CHECK to be triggered and the renderer to be killed:
module_system.cc(563)] Check failed: args[0]->IsObject()
R=kalman@chromium.org
TEST=manually; ran Chrome, installed any extension and pasted the
previous code snippet in the console of the extension, and
observed that a JavaScript error was thrown (in the console).
Committed: https://crrev.com/5c641eddb3b30f6fe62c972ae4bfcb88e8985714
Cr-Commit-Position: refs/heads/master@{#307385}
Patch Set 1 #
Total comments: 2
Patch Set 2 : Add elaborate error message for undefined #
Total comments: 3
Patch Set 3 : Improve code formatting + fix v8 API invocation #
Total comments: 1
Patch Set 4 : s/this/receiver/ #Messages
Total messages: 13 (1 generated)
|