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 #include "bindings/core/v8/ScriptStreamer.h" | 5 #include "bindings/core/v8/ScriptStreamer.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "bindings/core/v8/ScriptSourceCode.h" | 9 #include "bindings/core/v8/ScriptSourceCode.h" |
10 #include "bindings/core/v8/ScriptStreamerThread.h" | 10 #include "bindings/core/v8/ScriptStreamerThread.h" |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 EXPECT_TRUE(source_code.Streamer()); | 410 EXPECT_TRUE(source_code.Streamer()); |
411 v8::TryCatch try_catch(scope.GetIsolate()); | 411 v8::TryCatch try_catch(scope.GetIsolate()); |
412 v8::Local<v8::Script> script; | 412 v8::Local<v8::Script> script; |
413 EXPECT_TRUE(V8ScriptRunner::CompileScript(source_code, scope.GetIsolate(), | 413 EXPECT_TRUE(V8ScriptRunner::CompileScript(source_code, scope.GetIsolate(), |
414 kSharableCrossOrigin, | 414 kSharableCrossOrigin, |
415 kV8CacheOptionsDefault) | 415 kV8CacheOptionsDefault) |
416 .ToLocal(&script)); | 416 .ToLocal(&script)); |
417 EXPECT_FALSE(try_catch.HasCaught()); | 417 EXPECT_FALSE(try_catch.HasCaught()); |
418 } | 418 } |
419 | 419 |
| 420 // A test for crbug.com/711703. Should not crash. |
| 421 TEST_F(ScriptStreamingTest, GarbageCollectDuringStreaming) { |
| 422 V8TestingScope scope; |
| 423 ScriptStreamer::StartStreaming( |
| 424 GetPendingScript(), ScriptStreamer::kParsingBlocking, settings_.get(), |
| 425 scope.GetScriptState(), loading_task_runner_); |
| 426 |
| 427 TestPendingScriptClient* client = new TestPendingScriptClient; |
| 428 GetPendingScript()->WatchForLoad(client); |
| 429 EXPECT_FALSE(client->Finished()); |
| 430 |
| 431 pending_script_ = nullptr; |
| 432 ThreadState::Current()->CollectGarbage(BlinkGC::kNoHeapPointersOnStack, |
| 433 BlinkGC::kGCWithSweep, |
| 434 BlinkGC::kForcedGC); |
| 435 } |
| 436 |
420 } // namespace | 437 } // namespace |
421 | 438 |
422 } // namespace blink | 439 } // namespace blink |
OLD | NEW |