OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 | 5 |
6 #include "bindings/core/v8/ScriptStreamer.h" | 6 #include "bindings/core/v8/ScriptStreamer.h" |
7 | 7 |
8 #include "bindings/core/v8/ScriptSourceCode.h" | 8 #include "bindings/core/v8/ScriptSourceCode.h" |
9 #include "bindings/core/v8/ScriptStreamerThread.h" | 9 #include "bindings/core/v8/ScriptStreamerThread.h" |
10 #include "bindings/core/v8/V8Binding.h" | 10 #include "bindings/core/v8/V8Binding.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 , m_settings(Settings::create()) | 32 , m_settings(Settings::create()) |
33 , m_resourceRequest("http://www.streaming-test.com/") | 33 , m_resourceRequest("http://www.streaming-test.com/") |
34 , m_resource(ScriptResource::create(m_resourceRequest, "UTF-8")) | 34 , m_resource(ScriptResource::create(m_resourceRequest, "UTF-8")) |
35 , m_pendingScript(PendingScript::create(0, m_resource.get())) | 35 , m_pendingScript(PendingScript::create(0, m_resource.get())) |
36 { | 36 { |
37 m_resource->setLoading(true); | 37 m_resource->setLoading(true); |
38 m_pendingScript = PendingScript::create(0, m_resource.get()); | 38 m_pendingScript = PendingScript::create(0, m_resource.get()); |
39 ScriptStreamer::setSmallScriptThresholdForTesting(0); | 39 ScriptStreamer::setSmallScriptThresholdForTesting(0); |
40 } | 40 } |
41 | 41 |
42 ScriptState* scriptState() const { return m_scope.scriptState(); } | 42 ScriptState* getScriptState() const { return m_scope.getScriptState(); } |
43 v8::Isolate* isolate() const { return m_scope.isolate(); } | 43 v8::Isolate* isolate() const { return m_scope.isolate(); } |
44 | 44 |
45 PendingScript* pendingScript() const { return m_pendingScript.get(); } | 45 PendingScript* pendingScript() const { return m_pendingScript.get(); } |
46 | 46 |
47 protected: | 47 protected: |
48 void appendData(const char* data) | 48 void appendData(const char* data) |
49 { | 49 { |
50 m_resource->appendData(data, strlen(data)); | 50 m_resource->appendData(data, strlen(data)); |
51 // Yield control to the background thread, so that V8 gets a chance to | 51 // Yield control to the background thread, so that V8 gets a chance to |
52 // process the data before the main thread adds more. Note that we | 52 // process the data before the main thread adds more. Note that we |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 #if OS(MACOSX) && defined(ADDRESS_SANITIZER) | 109 #if OS(MACOSX) && defined(ADDRESS_SANITIZER) |
110 // TODO(marja): Fix this test, http://crbug.com/572987 | 110 // TODO(marja): Fix this test, http://crbug.com/572987 |
111 #define MAYBE_CompilingStreamedScript DISABLED_CompilingStreamedScript | 111 #define MAYBE_CompilingStreamedScript DISABLED_CompilingStreamedScript |
112 #else | 112 #else |
113 #define MAYBE_CompilingStreamedScript CompilingStreamedScript | 113 #define MAYBE_CompilingStreamedScript CompilingStreamedScript |
114 #endif | 114 #endif |
115 TEST_F(ScriptStreamingTest, MAYBE_CompilingStreamedScript) | 115 TEST_F(ScriptStreamingTest, MAYBE_CompilingStreamedScript) |
116 { | 116 { |
117 // Test that we can successfully compile a streamed script. | 117 // Test that we can successfully compile a streamed script. |
118 ScriptStreamer::startStreaming(pendingScript(), ScriptStreamer::ParsingBlock
ing, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner); | 118 ScriptStreamer::startStreaming(pendingScript(), ScriptStreamer::ParsingBlock
ing, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner); |
119 TestScriptResourceClient client; | 119 TestScriptResourceClient client; |
120 pendingScript()->watchForLoad(&client); | 120 pendingScript()->watchForLoad(&client); |
121 | 121 |
122 appendData("function foo() {"); | 122 appendData("function foo() {"); |
123 appendPadding(); | 123 appendPadding(); |
124 appendData("return 5; }"); | 124 appendData("return 5; }"); |
125 appendPadding(); | 125 appendPadding(); |
126 appendData("foo();"); | 126 appendData("foo();"); |
127 EXPECT_FALSE(client.finished()); | 127 EXPECT_FALSE(client.finished()); |
128 finish(); | 128 finish(); |
(...skipping 10 matching lines...) Expand all Loading... |
139 v8::Local<v8::Script> script; | 139 v8::Local<v8::Script> script; |
140 EXPECT_TRUE(V8ScriptRunner::compileScript(sourceCode, isolate()).ToLocal(&sc
ript)); | 140 EXPECT_TRUE(V8ScriptRunner::compileScript(sourceCode, isolate()).ToLocal(&sc
ript)); |
141 EXPECT_FALSE(tryCatch.HasCaught()); | 141 EXPECT_FALSE(tryCatch.HasCaught()); |
142 } | 142 } |
143 | 143 |
144 TEST_F(ScriptStreamingTest, CompilingStreamedScriptWithParseError) | 144 TEST_F(ScriptStreamingTest, CompilingStreamedScriptWithParseError) |
145 { | 145 { |
146 // Test that scripts with parse errors are handled properly. In those cases, | 146 // Test that scripts with parse errors are handled properly. In those cases, |
147 // the V8 side typically finished before loading finishes: make sure we | 147 // the V8 side typically finished before loading finishes: make sure we |
148 // handle it gracefully. | 148 // handle it gracefully. |
149 ScriptStreamer::startStreaming(pendingScript(), ScriptStreamer::ParsingBlock
ing, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner); | 149 ScriptStreamer::startStreaming(pendingScript(), ScriptStreamer::ParsingBlock
ing, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner); |
150 TestScriptResourceClient client; | 150 TestScriptResourceClient client; |
151 pendingScript()->watchForLoad(&client); | 151 pendingScript()->watchForLoad(&client); |
152 appendData("function foo() {"); | 152 appendData("function foo() {"); |
153 appendData("this is the part which will be a parse error"); | 153 appendData("this is the part which will be a parse error"); |
154 // V8 won't realize the parse error until it actually starts parsing the | 154 // V8 won't realize the parse error until it actually starts parsing the |
155 // script, and this happens only when its buffer is filled. | 155 // script, and this happens only when its buffer is filled. |
156 appendPadding(); | 156 appendPadding(); |
157 | 157 |
158 EXPECT_FALSE(client.finished()); | 158 EXPECT_FALSE(client.finished()); |
159 | 159 |
(...skipping 11 matching lines...) Expand all Loading... |
171 v8::TryCatch tryCatch(isolate()); | 171 v8::TryCatch tryCatch(isolate()); |
172 v8::Local<v8::Script> script; | 172 v8::Local<v8::Script> script; |
173 EXPECT_FALSE(V8ScriptRunner::compileScript(sourceCode, isolate()).ToLocal(&s
cript)); | 173 EXPECT_FALSE(V8ScriptRunner::compileScript(sourceCode, isolate()).ToLocal(&s
cript)); |
174 EXPECT_TRUE(tryCatch.HasCaught()); | 174 EXPECT_TRUE(tryCatch.HasCaught()); |
175 } | 175 } |
176 | 176 |
177 TEST_F(ScriptStreamingTest, CancellingStreaming) | 177 TEST_F(ScriptStreamingTest, CancellingStreaming) |
178 { | 178 { |
179 // Test that the upper layers (PendingScript and up) can be ramped down | 179 // Test that the upper layers (PendingScript and up) can be ramped down |
180 // while streaming is ongoing, and ScriptStreamer handles it gracefully. | 180 // while streaming is ongoing, and ScriptStreamer handles it gracefully. |
181 ScriptStreamer::startStreaming(pendingScript(), ScriptStreamer::ParsingBlock
ing, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner); | 181 ScriptStreamer::startStreaming(pendingScript(), ScriptStreamer::ParsingBlock
ing, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner); |
182 TestScriptResourceClient client; | 182 TestScriptResourceClient client; |
183 pendingScript()->watchForLoad(&client); | 183 pendingScript()->watchForLoad(&client); |
184 appendData("function foo() {"); | 184 appendData("function foo() {"); |
185 | 185 |
186 // In general, we cannot control what the background thread is doing | 186 // In general, we cannot control what the background thread is doing |
187 // (whether it's parsing or waiting for more data). In this test, we have | 187 // (whether it's parsing or waiting for more data). In this test, we have |
188 // given it so little data that it's surely waiting for more. | 188 // given it so little data that it's surely waiting for more. |
189 | 189 |
190 // Simulate cancelling the network load (e.g., because the user navigated | 190 // Simulate cancelling the network load (e.g., because the user navigated |
191 // away). | 191 // away). |
192 EXPECT_FALSE(client.finished()); | 192 EXPECT_FALSE(client.finished()); |
193 pendingScript()->stopWatchingForLoad(); | 193 pendingScript()->stopWatchingForLoad(); |
194 pendingScript()->releaseElementAndClear(); | 194 pendingScript()->releaseElementAndClear(); |
195 m_pendingScript = nullptr; // This will destroy m_resource. | 195 m_pendingScript = nullptr; // This will destroy m_resource. |
196 m_resource = nullptr; | 196 m_resource = nullptr; |
197 | 197 |
198 // The V8 side will complete too. This should not crash. We don't receive | 198 // The V8 side will complete too. This should not crash. We don't receive |
199 // any results from the streaming and the client doesn't get notified. | 199 // any results from the streaming and the client doesn't get notified. |
200 processTasksUntilStreamingComplete(); | 200 processTasksUntilStreamingComplete(); |
201 EXPECT_FALSE(client.finished()); | 201 EXPECT_FALSE(client.finished()); |
202 } | 202 } |
203 | 203 |
204 TEST_F(ScriptStreamingTest, SuppressingStreaming) | 204 TEST_F(ScriptStreamingTest, SuppressingStreaming) |
205 { | 205 { |
206 // If we notice during streaming that there is a code cache, streaming | 206 // If we notice during streaming that there is a code cache, streaming |
207 // is suppressed (V8 doesn't parse while the script is loading), and the | 207 // is suppressed (V8 doesn't parse while the script is loading), and the |
208 // upper layer (ScriptResourceClient) should get a notification when the | 208 // upper layer (ScriptResourceClient) should get a notification when the |
209 // script is loaded. | 209 // script is loaded. |
210 ScriptStreamer::startStreaming(pendingScript(), ScriptStreamer::ParsingBlock
ing, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner); | 210 ScriptStreamer::startStreaming(pendingScript(), ScriptStreamer::ParsingBlock
ing, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner); |
211 TestScriptResourceClient client; | 211 TestScriptResourceClient client; |
212 pendingScript()->watchForLoad(&client); | 212 pendingScript()->watchForLoad(&client); |
213 appendData("function foo() {"); | 213 appendData("function foo() {"); |
214 appendPadding(); | 214 appendPadding(); |
215 | 215 |
216 CachedMetadataHandler* cacheHandler = m_resource->cacheHandler(); | 216 CachedMetadataHandler* cacheHandler = m_resource->cacheHandler(); |
217 EXPECT_TRUE(cacheHandler); | 217 EXPECT_TRUE(cacheHandler); |
218 cacheHandler->setCachedMetadata(V8ScriptRunner::tagForCodeCache(cacheHandler
), "X", 1, CachedMetadataHandler::CacheLocally); | 218 cacheHandler->setCachedMetadata(V8ScriptRunner::tagForCodeCache(cacheHandler
), "X", 1, CachedMetadataHandler::CacheLocally); |
219 | 219 |
220 appendPadding(); | 220 appendPadding(); |
221 finish(); | 221 finish(); |
222 processTasksUntilStreamingComplete(); | 222 processTasksUntilStreamingComplete(); |
223 EXPECT_TRUE(client.finished()); | 223 EXPECT_TRUE(client.finished()); |
224 | 224 |
225 bool errorOccurred = false; | 225 bool errorOccurred = false; |
226 ScriptSourceCode sourceCode = pendingScript()->getSource(KURL(), errorOccurr
ed); | 226 ScriptSourceCode sourceCode = pendingScript()->getSource(KURL(), errorOccurr
ed); |
227 EXPECT_FALSE(errorOccurred); | 227 EXPECT_FALSE(errorOccurred); |
228 // ScriptSourceCode doesn't refer to the streamer, since we have suppressed | 228 // ScriptSourceCode doesn't refer to the streamer, since we have suppressed |
229 // the streaming and resumed the non-streaming code path for script | 229 // the streaming and resumed the non-streaming code path for script |
230 // compilation. | 230 // compilation. |
231 EXPECT_FALSE(sourceCode.streamer()); | 231 EXPECT_FALSE(sourceCode.streamer()); |
232 } | 232 } |
233 | 233 |
234 TEST_F(ScriptStreamingTest, EmptyScripts) | 234 TEST_F(ScriptStreamingTest, EmptyScripts) |
235 { | 235 { |
236 // Empty scripts should also be streamed properly, that is, the upper layer | 236 // Empty scripts should also be streamed properly, that is, the upper layer |
237 // (ScriptResourceClient) should be notified when an empty script has been | 237 // (ScriptResourceClient) should be notified when an empty script has been |
238 // loaded. | 238 // loaded. |
239 ScriptStreamer::startStreaming(pendingScript(), ScriptStreamer::ParsingBlock
ing, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner); | 239 ScriptStreamer::startStreaming(pendingScript(), ScriptStreamer::ParsingBlock
ing, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner); |
240 TestScriptResourceClient client; | 240 TestScriptResourceClient client; |
241 pendingScript()->watchForLoad(&client); | 241 pendingScript()->watchForLoad(&client); |
242 | 242 |
243 // Finish the script without sending any data. | 243 // Finish the script without sending any data. |
244 finish(); | 244 finish(); |
245 // The finished notification should arrive immediately and not be cycled | 245 // The finished notification should arrive immediately and not be cycled |
246 // through a background thread. | 246 // through a background thread. |
247 EXPECT_TRUE(client.finished()); | 247 EXPECT_TRUE(client.finished()); |
248 | 248 |
249 bool errorOccurred = false; | 249 bool errorOccurred = false; |
250 ScriptSourceCode sourceCode = pendingScript()->getSource(KURL(), errorOccurr
ed); | 250 ScriptSourceCode sourceCode = pendingScript()->getSource(KURL(), errorOccurr
ed); |
251 EXPECT_FALSE(errorOccurred); | 251 EXPECT_FALSE(errorOccurred); |
252 EXPECT_FALSE(sourceCode.streamer()); | 252 EXPECT_FALSE(sourceCode.streamer()); |
253 } | 253 } |
254 | 254 |
255 TEST_F(ScriptStreamingTest, SmallScripts) | 255 TEST_F(ScriptStreamingTest, SmallScripts) |
256 { | 256 { |
257 // Small scripts shouldn't be streamed. | 257 // Small scripts shouldn't be streamed. |
258 ScriptStreamer::setSmallScriptThresholdForTesting(100); | 258 ScriptStreamer::setSmallScriptThresholdForTesting(100); |
259 | 259 |
260 ScriptStreamer::startStreaming(pendingScript(), ScriptStreamer::ParsingBlock
ing, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner); | 260 ScriptStreamer::startStreaming(pendingScript(), ScriptStreamer::ParsingBlock
ing, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner); |
261 TestScriptResourceClient client; | 261 TestScriptResourceClient client; |
262 pendingScript()->watchForLoad(&client); | 262 pendingScript()->watchForLoad(&client); |
263 | 263 |
264 appendData("function foo() { }"); | 264 appendData("function foo() { }"); |
265 | 265 |
266 finish(); | 266 finish(); |
267 | 267 |
268 // The finished notification should arrive immediately and not be cycled | 268 // The finished notification should arrive immediately and not be cycled |
269 // through a background thread. | 269 // through a background thread. |
270 EXPECT_TRUE(client.finished()); | 270 EXPECT_TRUE(client.finished()); |
271 | 271 |
272 bool errorOccurred = false; | 272 bool errorOccurred = false; |
273 ScriptSourceCode sourceCode = pendingScript()->getSource(KURL(), errorOccurr
ed); | 273 ScriptSourceCode sourceCode = pendingScript()->getSource(KURL(), errorOccurr
ed); |
274 EXPECT_FALSE(errorOccurred); | 274 EXPECT_FALSE(errorOccurred); |
275 EXPECT_FALSE(sourceCode.streamer()); | 275 EXPECT_FALSE(sourceCode.streamer()); |
276 } | 276 } |
277 | 277 |
278 #if OS(MACOSX) && defined(ADDRESS_SANITIZER) | 278 #if OS(MACOSX) && defined(ADDRESS_SANITIZER) |
279 // TODO(marja): Fix this test, http://crbug.com/572987 | 279 // TODO(marja): Fix this test, http://crbug.com/572987 |
280 #define MAYBE_ScriptsWithSmallFirstChunk DISABLED_ScriptsWithSmallFirstChunk | 280 #define MAYBE_ScriptsWithSmallFirstChunk DISABLED_ScriptsWithSmallFirstChunk |
281 #else | 281 #else |
282 #define MAYBE_ScriptsWithSmallFirstChunk ScriptsWithSmallFirstChunk | 282 #define MAYBE_ScriptsWithSmallFirstChunk ScriptsWithSmallFirstChunk |
283 #endif | 283 #endif |
284 TEST_F(ScriptStreamingTest, MAYBE_ScriptsWithSmallFirstChunk) | 284 TEST_F(ScriptStreamingTest, MAYBE_ScriptsWithSmallFirstChunk) |
285 { | 285 { |
286 // If a script is long enough, if should be streamed, even if the first data | 286 // If a script is long enough, if should be streamed, even if the first data |
287 // chunk is small. | 287 // chunk is small. |
288 ScriptStreamer::setSmallScriptThresholdForTesting(100); | 288 ScriptStreamer::setSmallScriptThresholdForTesting(100); |
289 | 289 |
290 ScriptStreamer::startStreaming(pendingScript(), ScriptStreamer::ParsingBlock
ing, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner); | 290 ScriptStreamer::startStreaming(pendingScript(), ScriptStreamer::ParsingBlock
ing, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner); |
291 TestScriptResourceClient client; | 291 TestScriptResourceClient client; |
292 pendingScript()->watchForLoad(&client); | 292 pendingScript()->watchForLoad(&client); |
293 | 293 |
294 // This is the first data chunk which is small. | 294 // This is the first data chunk which is small. |
295 appendData("function foo() { }"); | 295 appendData("function foo() { }"); |
296 appendPadding(); | 296 appendPadding(); |
297 appendPadding(); | 297 appendPadding(); |
298 appendPadding(); | 298 appendPadding(); |
299 | 299 |
300 finish(); | 300 finish(); |
(...skipping 15 matching lines...) Expand all Loading... |
316 #define MAYBE_EncodingChanges DISABLED_EncodingChanges | 316 #define MAYBE_EncodingChanges DISABLED_EncodingChanges |
317 #else | 317 #else |
318 #define MAYBE_EncodingChanges EncodingChanges | 318 #define MAYBE_EncodingChanges EncodingChanges |
319 #endif | 319 #endif |
320 TEST_F(ScriptStreamingTest, MAYBE_EncodingChanges) | 320 TEST_F(ScriptStreamingTest, MAYBE_EncodingChanges) |
321 { | 321 { |
322 // It's possible that the encoding of the Resource changes after we start | 322 // It's possible that the encoding of the Resource changes after we start |
323 // loading it. | 323 // loading it. |
324 m_resource->setEncoding("windows-1252"); | 324 m_resource->setEncoding("windows-1252"); |
325 | 325 |
326 ScriptStreamer::startStreaming(pendingScript(), ScriptStreamer::ParsingBlock
ing, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner); | 326 ScriptStreamer::startStreaming(pendingScript(), ScriptStreamer::ParsingBlock
ing, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner); |
327 TestScriptResourceClient client; | 327 TestScriptResourceClient client; |
328 pendingScript()->watchForLoad(&client); | 328 pendingScript()->watchForLoad(&client); |
329 | 329 |
330 m_resource->setEncoding("UTF-8"); | 330 m_resource->setEncoding("UTF-8"); |
331 // \xec\x92\x81 are the raw bytes for \uc481. | 331 // \xec\x92\x81 are the raw bytes for \uc481. |
332 appendData("function foo() { var foob\xec\x92\x81r = 13; return foob\xec\x92
\x81r; } foo();"); | 332 appendData("function foo() { var foob\xec\x92\x81r = 13; return foob\xec\x92
\x81r; } foo();"); |
333 | 333 |
334 finish(); | 334 finish(); |
335 | 335 |
336 processTasksUntilStreamingComplete(); | 336 processTasksUntilStreamingComplete(); |
(...skipping 14 matching lines...) Expand all Loading... |
351 #define MAYBE_EncodingFromBOM DISABLED_EncodingFromBOM | 351 #define MAYBE_EncodingFromBOM DISABLED_EncodingFromBOM |
352 #else | 352 #else |
353 #define MAYBE_EncodingFromBOM EncodingFromBOM | 353 #define MAYBE_EncodingFromBOM EncodingFromBOM |
354 #endif | 354 #endif |
355 TEST_F(ScriptStreamingTest, MAYBE_EncodingFromBOM) | 355 TEST_F(ScriptStreamingTest, MAYBE_EncodingFromBOM) |
356 { | 356 { |
357 // Byte order marks should be removed before giving the data to V8. They | 357 // Byte order marks should be removed before giving the data to V8. They |
358 // will also affect encoding detection. | 358 // will also affect encoding detection. |
359 m_resource->setEncoding("windows-1252"); // This encoding is wrong on purpos
e. | 359 m_resource->setEncoding("windows-1252"); // This encoding is wrong on purpos
e. |
360 | 360 |
361 ScriptStreamer::startStreaming(pendingScript(), ScriptStreamer::ParsingBlock
ing, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner); | 361 ScriptStreamer::startStreaming(pendingScript(), ScriptStreamer::ParsingBlock
ing, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner); |
362 TestScriptResourceClient client; | 362 TestScriptResourceClient client; |
363 pendingScript()->watchForLoad(&client); | 363 pendingScript()->watchForLoad(&client); |
364 | 364 |
365 // \xef\xbb\xbf is the UTF-8 byte order mark. \xec\x92\x81 are the raw bytes | 365 // \xef\xbb\xbf is the UTF-8 byte order mark. \xec\x92\x81 are the raw bytes |
366 // for \uc481. | 366 // for \uc481. |
367 appendData("\xef\xbb\xbf function foo() { var foob\xec\x92\x81r = 13; return
foob\xec\x92\x81r; } foo();"); | 367 appendData("\xef\xbb\xbf function foo() { var foob\xec\x92\x81r = 13; return
foob\xec\x92\x81r; } foo();"); |
368 | 368 |
369 finish(); | 369 finish(); |
370 processTasksUntilStreamingComplete(); | 370 processTasksUntilStreamingComplete(); |
371 EXPECT_TRUE(client.finished()); | 371 EXPECT_TRUE(client.finished()); |
372 bool errorOccurred = false; | 372 bool errorOccurred = false; |
373 ScriptSourceCode sourceCode = pendingScript()->getSource(KURL(), errorOccurr
ed); | 373 ScriptSourceCode sourceCode = pendingScript()->getSource(KURL(), errorOccurr
ed); |
374 EXPECT_FALSE(errorOccurred); | 374 EXPECT_FALSE(errorOccurred); |
375 EXPECT_TRUE(sourceCode.streamer()); | 375 EXPECT_TRUE(sourceCode.streamer()); |
376 v8::TryCatch tryCatch(isolate()); | 376 v8::TryCatch tryCatch(isolate()); |
377 v8::Local<v8::Script> script; | 377 v8::Local<v8::Script> script; |
378 EXPECT_TRUE(V8ScriptRunner::compileScript(sourceCode, isolate()).ToLocal(&sc
ript)); | 378 EXPECT_TRUE(V8ScriptRunner::compileScript(sourceCode, isolate()).ToLocal(&sc
ript)); |
379 EXPECT_FALSE(tryCatch.HasCaught()); | 379 EXPECT_FALSE(tryCatch.HasCaught()); |
380 } | 380 } |
381 | 381 |
382 } // namespace | 382 } // namespace |
383 | 383 |
384 } // namespace blink | 384 } // namespace blink |
OLD | NEW |