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.

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:] Check failed: args[0]->IsObject()
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:

Cr-Commit-Position: refs/heads/master@{#307385}
1 file changed