Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(711)

Unified Diff: src/js/messages.js

Issue 1831053003: Check for proper types from error handling code (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase golden again Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/messages.js
diff --git a/src/js/messages.js b/src/js/messages.js
index b80ef86c5c9b2ad4429fc3d42bfb557f39ef0fc6..f8cb967cdd064238ebbe75bf50edc2be168271f6 100644
--- a/src/js/messages.js
+++ b/src/js/messages.js
@@ -570,69 +570,90 @@ function CallSite(receiver, fun, pos, strict_mode) {
SET_PRIVATE(this, callSiteStrictSymbol, TO_BOOLEAN(strict_mode));
}
+function CheckCallSite(obj, name) {
+ if (!IS_RECEIVER(obj) || !HAS_PRIVATE(obj, callSiteFunctionSymbol)) {
+ throw MakeTypeError(kCallSiteMethod, name);
+ }
+}
+
function CallSiteGetThis() {
+ CheckCallSite(this, "getThis");
return GET_PRIVATE(this, callSiteStrictSymbol)
? UNDEFINED : GET_PRIVATE(this, callSiteReceiverSymbol);
}
function CallSiteGetFunction() {
+ CheckCallSite(this, "getFunction");
return GET_PRIVATE(this, callSiteStrictSymbol)
? UNDEFINED : GET_PRIVATE(this, callSiteFunctionSymbol);
}
function CallSiteGetPosition() {
+ CheckCallSite(this, "getPosition");
return GET_PRIVATE(this, callSitePositionSymbol);
}
function CallSiteGetTypeName() {
+ CheckCallSite(this, "getTypeName");
return GetTypeName(GET_PRIVATE(this, callSiteReceiverSymbol), false);
}
function CallSiteIsToplevel() {
+ CheckCallSite(this, "isTopLevel");
return %CallSiteIsToplevelRT(this);
}
function CallSiteIsEval() {
+ CheckCallSite(this, "isEval");
return %CallSiteIsEvalRT(this);
}
function CallSiteGetEvalOrigin() {
+ CheckCallSite(this, "getEvalOrigin");
var script = %FunctionGetScript(GET_PRIVATE(this, callSiteFunctionSymbol));
return FormatEvalOrigin(script);
}
function CallSiteGetScriptNameOrSourceURL() {
+ CheckCallSite(this, "getScriptNameOrSourceURL");
return %CallSiteGetScriptNameOrSourceUrlRT(this);
}
function CallSiteGetFunctionName() {
// See if the function knows its own name
+ CheckCallSite(this, "getFunctionName");
return %CallSiteGetFunctionNameRT(this);
}
function CallSiteGetMethodName() {
// See if we can find a unique property on the receiver that holds
// this function.
+ CheckCallSite(this, "getMethodName");
return %CallSiteGetMethodNameRT(this);
}
function CallSiteGetFileName() {
+ CheckCallSite(this, "getFileName");
return %CallSiteGetFileNameRT(this);
}
function CallSiteGetLineNumber() {
+ CheckCallSite(this, "getLineNumber");
return %CallSiteGetLineNumberRT(this);
}
function CallSiteGetColumnNumber() {
+ CheckCallSite(this, "getColumnNumber");
return %CallSiteGetColumnNumberRT(this);
}
function CallSiteIsNative() {
+ CheckCallSite(this, "isNative");
return %CallSiteIsNativeRT(this);
}
function CallSiteIsConstructor() {
+ CheckCallSite(this, "isConstructor");
return %CallSiteIsConstructorRT(this);
}
« no previous file with comments | « no previous file | src/messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698