Throw 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).
Review URL: https://codereview.chromium.org/783333002
Cr-Commit-Position: refs/heads/master@{#307385}
1 file changed