Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: test/WebRequest.cpp

Issue 29523555: Issue 5552 - use strict mode for all JS in libadblocklus (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: move setting of strict mode to do it once Created Aug. 22, 2017, 7:58 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/JsEngine.cpp ('K') | « test/JsEngine.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/WebRequest.cpp
diff --git a/test/WebRequest.cpp b/test/WebRequest.cpp
index fbad8f9ae59b7b082ef19c1b2fa0ef798a34597b..fad940533f35d308e8ac1ca818fc565e7d4537c9 100644
--- a/test/WebRequest.cpp
+++ b/test/WebRequest.cpp
@@ -160,8 +160,8 @@ TEST_F(MockWebRequestTest, BadCall)
TEST_F(MockWebRequestTest, SuccessfulRequest)
{
auto& jsEngine = GetJsEngine();
- jsEngine.Evaluate("_webRequest.GET('http://example.com/', {X: 'Y'}, function(result) {foo = result;} )");
- ASSERT_TRUE(jsEngine.Evaluate("this.foo").IsUndefined());
+ jsEngine.Evaluate("let foo; _webRequest.GET('http://example.com/', {X: 'Y'}, function(result) {foo = result;} )");
+ ASSERT_TRUE(jsEngine.Evaluate("foo").IsUndefined());
ProcessPendingWebRequests();
ASSERT_EQ(IWebRequest::NS_OK, jsEngine.Evaluate("foo.status").AsInt());
ASSERT_EQ(123, jsEngine.Evaluate("foo.responseStatus").AsInt());
@@ -175,8 +175,8 @@ TEST_F(DefaultWebRequestTest, RealWebRequest)
auto& jsEngine = GetJsEngine();
// This URL should redirect to easylist-downloads.adblockplus.org and we
// should get the actual filter list back.
- jsEngine.Evaluate("_webRequest.GET('https://easylist-downloads.adblockplus.org/easylist.txt', {}, function(result) {foo = result;} )");
- WaitForVariable("this.foo", jsEngine);
+ jsEngine.Evaluate("let foo; _webRequest.GET('https://easylist-downloads.adblockplus.org/easylist.txt', {}, function(result) {foo = result;} )");
+ WaitForVariable("foo", jsEngine);
ASSERT_EQ("text/plain", jsEngine.Evaluate("foo.responseHeaders['content-type'].substr(0, 10)").AsString());
ASSERT_EQ(IWebRequest::NS_OK, jsEngine.Evaluate("foo.status").AsInt());
ASSERT_EQ(200, jsEngine.Evaluate("foo.responseStatus").AsInt());
@@ -212,8 +212,8 @@ TEST_F(DefaultWebRequestTest, XMLHttpRequest)
TEST_F(DefaultWebRequestTest, DummyWebRequest)
{
auto& jsEngine = GetJsEngine();
- jsEngine.Evaluate("_webRequest.GET('https://easylist-downloads.adblockplus.org/easylist.txt', {}, function(result) {foo = result;} )");
- WaitForVariable("this.foo", jsEngine);
+ jsEngine.Evaluate("let foo; _webRequest.GET('https://easylist-downloads.adblockplus.org/easylist.txt', {}, function(result) {foo = result;} )");
+ WaitForVariable("foo", jsEngine);
ASSERT_EQ(IWebRequest::NS_ERROR_FAILURE, jsEngine.Evaluate("foo.status").AsInt());
ASSERT_EQ(0, jsEngine.Evaluate("foo.responseStatus").AsInt());
ASSERT_EQ("", jsEngine.Evaluate("foo.responseText").AsString());
« src/JsEngine.cpp ('K') | « test/JsEngine.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld