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

Side by Side Diff: ppapi/tests/blink_deprecated_test_plugin.cc

Issue 1813823002: Handle the case where the v8 scriptable object has a property defined with value undefined. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // A simple C++ Pepper plugin for exercising deprecated PPAPI interfaces in 5 // A simple C++ Pepper plugin for exercising deprecated PPAPI interfaces in
6 // Blink layout tests. 6 // Blink layout tests.
7 // 7 //
8 // Most layout tests should prefer to use the normal Blink test plugin, with the 8 // Most layout tests should prefer to use the normal Blink test plugin, with the
9 // MIME type application/x-blink-test-plugin. For layout tests that absolutely 9 // MIME type application/x-blink-test-plugin. For layout tests that absolutely
10 // need to test deprecated synchronous scripting interfaces, this plugin can be 10 // need to test deprecated synchronous scripting interfaces, this plugin can be
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 const std::vector<pp::Var>& args, 47 const std::vector<pp::Var>& args,
48 pp::Var* exception) override { 48 pp::Var* exception) override {
49 auto method = FindMethod(method_name); 49 auto method = FindMethod(method_name);
50 if (method != methods_.end()) { 50 if (method != methods_.end()) {
51 return method->second.Run(args, exception); 51 return method->second.Run(args, exception);
52 } 52 }
53 53
54 return ScriptableObject::Call(method_name, args, exception); 54 return ScriptableObject::Call(method_name, args, exception);
55 } 55 }
56 56
57 bool HasProperty(const pp::Var& name, pp::Var* exception) {
58 if (name.AsString() == "testprop")
59 return true;
60 return false;
61 }
62
63 pp::Var GetProperty(const pp::Var& name, pp::Var* exception) {
64 if (!(name.AsString() == "testprop"))
65 *exception = pp::Var("Property does not exist on ScriptableObject");
66 return pp::Var();
67 }
68
57 private: 69 private:
58 using MethodMap = 70 using MethodMap =
59 std::map<std::string, 71 std::map<std::string,
60 base::Callback<pp::Var(const std::vector<pp::Var>&, pp::Var*)>>; 72 base::Callback<pp::Var(const std::vector<pp::Var>&, pp::Var*)>>;
61 73
62 MethodMap::iterator FindMethod(const pp::Var& name) { 74 MethodMap::iterator FindMethod(const pp::Var& name) {
63 if (!name.is_string()) 75 if (!name.is_string())
64 return methods_.end(); 76 return methods_.end();
65 return methods_.find(name.AsString()); 77 return methods_.find(name.AsString());
66 } 78 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 147
136 } // namespace 148 } // namespace
137 149
138 namespace pp { 150 namespace pp {
139 151
140 Module* CreateModule() { 152 Module* CreateModule() {
141 return new BlinkDeprecatedTestModule(); 153 return new BlinkDeprecatedTestModule();
142 } 154 }
143 155
144 } // namespace pp 156 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698