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

Side by Side Diff: src/GlobalJsObject.cpp

Issue 10420020: Made sure FilterEngine instances are always initialized (Closed)
Patch Set: Created May 16, 2013, 2:27 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/FilterEngine.cpp ('k') | src/JsEngine.cpp » ('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 <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 { 77 {
78 return v8::ThrowException(v8::String::New(e.what())); 78 return v8::ThrowException(v8::String::New(e.what()));
79 } 79 }
80 timeoutThread->Start(); 80 timeoutThread->Start();
81 81
82 // We should actually return the timer ID here, which could be 82 // We should actually return the timer ID here, which could be
83 // used via clearTimeout(). But since we don't seem to need 83 // used via clearTimeout(). But since we don't seem to need
84 // clearTimeout(), we can save that for later. 84 // clearTimeout(), we can save that for later.
85 return v8::Undefined(); 85 return v8::Undefined();
86 } 86 }
87
88 v8::Handle<v8::Value> InitDoneCallback(const v8::Arguments& arguments)
89 {
90 AdblockPlus::JsEngine::FromArguments(arguments)->InitDone();
91 return v8::Undefined();
92 }
87 } 93 }
88 94
89 JsValuePtr GlobalJsObject::Setup(JsEnginePtr jsEngine, const AppInfo& appInfo, 95 JsValuePtr GlobalJsObject::Setup(JsEnginePtr jsEngine, const AppInfo& appInfo,
90 JsValuePtr obj) 96 JsValuePtr obj)
91 { 97 {
92 obj->SetProperty("setTimeout", jsEngine->NewCallback(::SetTimeoutCallback)); 98 obj->SetProperty("setTimeout", jsEngine->NewCallback(::SetTimeoutCallback));
99 obj->SetProperty("_initDone", jsEngine->NewCallback(::InitDoneCallback));
93 obj->SetProperty("_fileSystem", 100 obj->SetProperty("_fileSystem",
94 FileSystemJsObject::Setup(jsEngine, jsEngine->NewObject())); 101 FileSystemJsObject::Setup(jsEngine, jsEngine->NewObject()));
95 obj->SetProperty("_webRequest", 102 obj->SetProperty("_webRequest",
96 WebRequestJsObject::Setup(jsEngine, jsEngine->NewObject())); 103 WebRequestJsObject::Setup(jsEngine, jsEngine->NewObject()));
97 obj->SetProperty("console", 104 obj->SetProperty("console",
98 ConsoleJsObject::Setup(jsEngine, jsEngine->NewObject())); 105 ConsoleJsObject::Setup(jsEngine, jsEngine->NewObject()));
99 obj->SetProperty("_appInfo", 106 obj->SetProperty("_appInfo",
100 AppInfoJsObject::Setup(jsEngine, appInfo, jsEngine->NewObject())); 107 AppInfoJsObject::Setup(jsEngine, appInfo, jsEngine->NewObject()));
101 return obj; 108 return obj;
102 } 109 }
OLDNEW
« no previous file with comments | « src/FilterEngine.cpp ('k') | src/JsEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld