OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #define STRSAFE_NO_DEPRECATE | 5 #define STRSAFE_NO_DEPRECATE |
6 #include "base/string_number_conversions.h" | 6 #include "base/string_number_conversions.h" |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "webkit/plugins/npapi/test/plugin_windowless_test.h" | 8 #include "webkit/plugins/npapi/test/plugin_windowless_test.h" |
9 #include "webkit/plugins/npapi/test/plugin_client.h" | 9 #include "webkit/plugins/npapi/test/plugin_client.h" |
10 | 10 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 } | 127 } |
128 // If this test failed, then we'd have crashed by now. | 128 // If this test failed, then we'd have crashed by now. |
129 return PluginTest::HandleEvent(event); | 129 return PluginTest::HandleEvent(event); |
130 } | 130 } |
131 | 131 |
132 NPError WindowlessPluginTest::ExecuteScript(NPNetscapeFuncs* browser, NPP id, | 132 NPError WindowlessPluginTest::ExecuteScript(NPNetscapeFuncs* browser, NPP id, |
133 const std::string& script, NPVariant* result) { | 133 const std::string& script, NPVariant* result) { |
134 std::string script_url = "javascript:"; | 134 std::string script_url = "javascript:"; |
135 script_url += script; | 135 script_url += script; |
136 | 136 |
137 NPString script_string = { script_url.c_str(), script_url.length() }; | 137 size_t script_length = script_url.length(); |
| 138 if (script_length != static_cast<uint32_t>(script_length)) { |
| 139 return NPERR_GENERIC_ERROR; |
| 140 } |
| 141 |
| 142 NPString script_string = { script_url.c_str(), |
| 143 static_cast<uint32_t>(script_length) }; |
138 NPObject *window_obj = NULL; | 144 NPObject *window_obj = NULL; |
139 browser->getvalue(id, NPNVWindowNPObject, &window_obj); | 145 browser->getvalue(id, NPNVWindowNPObject, &window_obj); |
140 | 146 |
141 NPVariant unused_result; | 147 NPVariant unused_result; |
142 if (!result) | 148 if (!result) |
143 result = &unused_result; | 149 result = &unused_result; |
144 | 150 |
145 return browser->evaluate(id, window_obj, &script_string, result); | 151 return browser->evaluate(id, window_obj, &script_string, result); |
146 } | 152 } |
147 | 153 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 error_string.append(StringForPoint(flipped_window_x, flipped_window_y)); | 271 error_string.append(StringForPoint(flipped_window_x, flipped_window_y)); |
266 SetError(error_string); | 272 SetError(error_string); |
267 } | 273 } |
268 #else | 274 #else |
269 SetError("Unimplemented"); | 275 SetError("Unimplemented"); |
270 #endif | 276 #endif |
271 SignalTestCompleted(); | 277 SignalTestCompleted(); |
272 } | 278 } |
273 | 279 |
274 } // namespace NPAPIClient | 280 } // namespace NPAPIClient |
OLD | NEW |