Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: src/JsEngine.cpp

Issue 29812649: Issue 6526 - *ToV8String() return MaybeLocal<> and check Call() return value (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Left Patch Set: Introduce CHECKED_TO_LOCAL_NOTHROW and use it. Created June 22, 2018, 3:49 p.m.
Right Patch Set: Wrap macro arguments in brackets. Created Aug. 6, 2018, 1:25 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/FileSystemJsObject.cpp ('k') | src/JsValue.cpp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 JsContext context(*this); 184 JsContext context(*this);
185 return JsValue(shared_from_this(), context.GetV8Context()->Global()); 185 return JsValue(shared_from_this(), context.GetV8Context()->Global());
186 } 186 }
187 187
188 AdblockPlus::JsValue AdblockPlus::JsEngine::Evaluate(const std::string& source, 188 AdblockPlus::JsValue AdblockPlus::JsEngine::Evaluate(const std::string& source,
189 const std::string& filename) 189 const std::string& filename)
190 { 190 {
191 const JsContext context(*this); 191 const JsContext context(*this);
192 auto isolate = GetIsolate(); 192 auto isolate = GetIsolate();
193 const v8::TryCatch tryCatch(isolate); 193 const v8::TryCatch tryCatch(isolate);
194 auto script = CHECKED_TO_LOCAL( 194 auto script = CHECKED_TO_LOCAL_WITH_TRY_CATCH(
195 isolate, CompileScript(isolate, source, filename), tryCatch); 195 isolate, CompileScript(isolate, source, filename), tryCatch);
196 auto result = CHECKED_TO_LOCAL( 196 auto result = CHECKED_TO_LOCAL_WITH_TRY_CATCH(
197 isolate, script->Run(isolate->GetCurrentContext()), tryCatch); 197 isolate, script->Run(isolate->GetCurrentContext()), tryCatch);
198 return JsValue(shared_from_this(), result); 198 return JsValue(shared_from_this(), result);
199 } 199 }
200 200
201 void AdblockPlus::JsEngine::SetEventCallback(const std::string& eventName, 201 void AdblockPlus::JsEngine::SetEventCallback(const std::string& eventName,
202 const AdblockPlus::JsEngine::EventCallback& callback) 202 const AdblockPlus::JsEngine::EventCallback& callback)
203 { 203 {
204 if (!callback) 204 if (!callback)
205 { 205 {
206 RemoveEventCallback(eventName); 206 RemoveEventCallback(eventName);
(...skipping 25 matching lines...) Expand all
232 void AdblockPlus::JsEngine::Gc() 232 void AdblockPlus::JsEngine::Gc()
233 { 233 {
234 while (!GetIsolate()->IdleNotificationDeadline(1000)); 234 while (!GetIsolate()->IdleNotificationDeadline(1000));
235 } 235 }
236 236
237 AdblockPlus::JsValue AdblockPlus::JsEngine::NewValue(const std::string& val) 237 AdblockPlus::JsValue AdblockPlus::JsEngine::NewValue(const std::string& val)
238 { 238 {
239 const JsContext context(*this); 239 const JsContext context(*this);
240 auto isolate = GetIsolate(); 240 auto isolate = GetIsolate();
241 return JsValue(shared_from_this(), 241 return JsValue(shared_from_this(),
242 CHECKED_TO_LOCAL_NOTHROW(isolate, Utils::ToV8String(isolate, val))); 242 CHECKED_TO_LOCAL(isolate, Utils::ToV8String(isolate, val)));
243 } 243 }
244 244
245 AdblockPlus::JsValue AdblockPlus::JsEngine::NewValue(int64_t val) 245 AdblockPlus::JsValue AdblockPlus::JsEngine::NewValue(int64_t val)
246 { 246 {
247 const JsContext context(*this); 247 const JsContext context(*this);
248 return JsValue(shared_from_this(), v8::Number::New(GetIsolate(), val)); 248 return JsValue(shared_from_this(), v8::Number::New(GetIsolate(), val));
249 } 249 }
250 250
251 AdblockPlus::JsValue AdblockPlus::JsEngine::NewValue(bool val) 251 AdblockPlus::JsValue AdblockPlus::JsEngine::NewValue(bool val)
252 { 252 {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 list.push_back(JsValue(shared_from_this(), arguments[i])); 341 list.push_back(JsValue(shared_from_this(), arguments[i]));
342 return list; 342 return list;
343 } 343 }
344 344
345 void AdblockPlus::JsEngine::SetGlobalProperty(const std::string& name, 345 void AdblockPlus::JsEngine::SetGlobalProperty(const std::string& name,
346 const AdblockPlus::JsValue& value) 346 const AdblockPlus::JsValue& value)
347 { 347 {
348 auto global = GetGlobalObject(); 348 auto global = GetGlobalObject();
349 global.SetProperty(name, value); 349 global.SetProperty(name, value);
350 } 350 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld