Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Unified Diff: test/mjsunit/regress/string-split-monkey-patching.js

Issue 17391016: Avoid relying on monkey-patchable things in String.prototype.split. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/string.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/string-split-monkey-patching.js
diff --git a/test/cctest/test-platform.cc b/test/mjsunit/regress/string-split-monkey-patching.js
similarity index 81%
copy from test/cctest/test-platform.cc
copy to test/mjsunit/regress/string-split-monkey-patching.js
index 6c20b853c5e7408b1877ee74617c01c3fc32ed5f..ea5c8679cb6e5931c96e9494288e5134c313648f 100644
--- a/test/cctest/test-platform.cc
+++ b/test/mjsunit/regress/string-split-monkey-patching.js
@@ -25,13 +25,16 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include <stdlib.h>
+// Test that String.prototype.split with an regexp does not call the
+// monkey-patchable Array.prototype.push or PutValue.
-#include "cctest.h"
-#include "platform.h"
+Array.prototype.push = assertUnreachable;
-using namespace ::v8::internal;
+Object.defineProperty(Array.prototype, "0", {
+ get: assertUnreachable,
+ set: assertUnreachable });
-TEST(NumberOfCores) {
- CHECK_GT(OS::NumberOfCores(), 0);
-}
+"-".split(/-/);
+"I-must-not-use-push!".split(/-/);
+"Oh-no!".split(/(-)/);
+"a".split(/(a)|(b)/);
« no previous file with comments | « src/string.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698