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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp

Issue 2301993002: binding: Introduces ExceptionToPromiseScope. (Closed)
Patch Set: . Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 #include "wtf/text/AtomicString.h" 69 #include "wtf/text/AtomicString.h"
70 #include "wtf/text/CString.h" 70 #include "wtf/text/CString.h"
71 #include "wtf/text/CharacterNames.h" 71 #include "wtf/text/CharacterNames.h"
72 #include "wtf/text/StringBuffer.h" 72 #include "wtf/text/StringBuffer.h"
73 #include "wtf/text/StringHash.h" 73 #include "wtf/text/StringHash.h"
74 #include "wtf/text/Unicode.h" 74 #include "wtf/text/Unicode.h"
75 #include "wtf/text/WTFString.h" 75 #include "wtf/text/WTFString.h"
76 76
77 namespace blink { 77 namespace blink {
78 78
79 void setArityTypeError(ExceptionState& exceptionState, const char* valid, unsign ed provided)
80 {
81 exceptionState.throwTypeError(ExceptionMessages::invalidArity(valid, provide d));
82 }
83
84 v8::Local<v8::Value> createMinimumArityTypeErrorForMethod(v8::Isolate* isolate, const char* method, const char* type, unsigned expected, unsigned provided)
85 {
86 return V8ThrowException::createTypeError(isolate, ExceptionMessages::failedT oExecute(method, type, ExceptionMessages::notEnoughArguments(expected, provided) ));
87 }
88
89 v8::Local<v8::Value> createMinimumArityTypeErrorForConstructor(v8::Isolate* isol ate, const char* type, unsigned expected, unsigned provided)
90 {
91 return V8ThrowException::createTypeError(isolate, ExceptionMessages::failedT oConstruct(type, ExceptionMessages::notEnoughArguments(expected, provided)));
92 }
93
94 void setMinimumArityTypeError(ExceptionState& exceptionState, unsigned expected, unsigned provided)
95 {
96 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(expected , provided));
97 }
98
99 NodeFilter* toNodeFilter(v8::Local<v8::Value> callback, v8::Local<v8::Object> cr eationContext, ScriptState* scriptState) 79 NodeFilter* toNodeFilter(v8::Local<v8::Value> callback, v8::Local<v8::Object> cr eationContext, ScriptState* scriptState)
100 { 80 {
101 if (callback->IsNull()) 81 if (callback->IsNull())
102 return nullptr; 82 return nullptr;
103 NodeFilter* filter = NodeFilter::create(); 83 NodeFilter* filter = NodeFilter::create();
104 84
105 v8::Local<v8::Value> filterWrapper = toV8(filter, creationContext, scriptSta te->isolate()); 85 v8::Local<v8::Value> filterWrapper = toV8(filter, creationContext, scriptSta te->isolate());
106 if (filterWrapper.IsEmpty()) 86 if (filterWrapper.IsEmpty())
107 return nullptr; 87 return nullptr;
108 88
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 return frame->script().isolate(); 943 return frame->script().isolate();
964 } 944 }
965 945
966 v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value> value, v8::Isolate* iso late) 946 v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value> value, v8::Isolate* iso late)
967 { 947 {
968 value.As<v8::Object>()->SetIntegrityLevel(isolate->GetCurrentContext(), v8:: IntegrityLevel::kFrozen).ToChecked(); 948 value.As<v8::Object>()->SetIntegrityLevel(isolate->GetCurrentContext(), v8:: IntegrityLevel::kFrozen).ToChecked();
969 return value; 949 return value;
970 } 950 }
971 951
972 } // namespace blink 952 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698