Index: test/GlobalJsObject.cpp |
diff --git a/test/GlobalJsObject.cpp b/test/GlobalJsObject.cpp |
index cc8478ae07413a16fa65326f1bab161886dd482e..62a2a20503471dc7831a575af3971609d7f89d94 100644 |
--- a/test/GlobalJsObject.cpp |
+++ b/test/GlobalJsObject.cpp |
@@ -55,3 +55,13 @@ TEST_F(GlobalJsObjectTest, SetMultipleTimeouts) |
AdblockPlus::Sleep(200); |
ASSERT_EQ("1,2", jsEngine->Evaluate("this.foo")->AsString()); |
} |
+ |
+TEST_F(GlobalJsObjectTest, TimeoutDoesNotKeepJsEngine) |
+{ |
+ jsEngine->Evaluate("setTimeout(function() {}, 50000)"); |
+ EXPECT_EQ(1u, jsEngine.use_count()); // check that counter is still 1 |
+ AdblockPlus::Sleep(200); |
+ std::weak_ptr<AdblockPlus::JsEngine> weakJsEngine = jsEngine; |
+ jsEngine.reset(); |
+ EXPECT_FALSE(weakJsEngine.lock()); |
+} |