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

Side by Side Diff: src/GlobalJsObject.cpp

Issue 29661564: Template out V8 and prepare for other JS engine implementations
Patch Set: Created Jan. 10, 2018, 1:29 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/GlobalJsObject.h ('k') | src/JsContext.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 { 58 {
59 v8::Isolate* isolate = arguments.GetIsolate(); 59 v8::Isolate* isolate = arguments.GetIsolate();
60 return Utils::ThrowExceptionInJS(isolate, "_triggerEvent expects at least one parameter"); 60 return Utils::ThrowExceptionInJS(isolate, "_triggerEvent expects at least one parameter");
61 } 61 }
62 std::string eventName = converted.front().AsString(); 62 std::string eventName = converted.front().AsString();
63 converted.erase(converted.cbegin()); 63 converted.erase(converted.cbegin());
64 jsEngine->TriggerEvent(eventName, move(converted)); 64 jsEngine->TriggerEvent(eventName, move(converted));
65 } 65 }
66 } 66 }
67 67
68 JsValue& GlobalJsObject::Setup(JsEngine& jsEngine, const AppInfo& appInfo, 68 AdblockPlus::JsValue& AdblockPlus::GlobalJsObject::Setup(AdblockPlus::JsEngine& jsEngine, const AppInfo& appInfo,
69 JsValue& obj) 69 AdblockPlus::JsValue& obj)
70 { 70 {
71 obj.SetProperty("setTimeout", jsEngine.NewCallback(::SetTimeoutCallback)); 71 obj.SetProperty("setTimeout", jsEngine.NewCallback(::SetTimeoutCallback));
72 obj.SetProperty("_triggerEvent", jsEngine.NewCallback(::TriggerEventCallback)) ; 72 obj.SetProperty("_triggerEvent", jsEngine.NewCallback(::TriggerEventCallback)) ;
73 auto value = jsEngine.NewObject(); 73 auto value = jsEngine.NewObject();
74 obj.SetProperty("_fileSystem", FileSystemJsObject::Setup(jsEngine, value)); 74 obj.SetProperty("_fileSystem", FileSystemJsObject::Setup(jsEngine, value));
75 value = jsEngine.NewObject(); 75 value = jsEngine.NewObject();
76 obj.SetProperty("_webRequest", WebRequestJsObject::Setup(jsEngine, value)); 76 obj.SetProperty("_webRequest", WebRequestJsObject::Setup(jsEngine, value));
77 value = jsEngine.NewObject(); 77 value = jsEngine.NewObject();
78 obj.SetProperty("console", ConsoleJsObject::Setup(jsEngine, value)); 78 obj.SetProperty("console", ConsoleJsObject::Setup(jsEngine, value));
79 value = jsEngine.NewObject(); 79 value = jsEngine.NewObject();
80 obj.SetProperty("_appInfo", AppInfoJsObject::Setup(appInfo, value)); 80 obj.SetProperty("_appInfo", AppInfoJsObject::Setup(appInfo, value));
81 return obj; 81 return obj;
82 } 82 }
OLDNEW
« no previous file with comments | « src/GlobalJsObject.h ('k') | src/JsContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld