OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 5982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5993 USE(evil_script); | 5993 USE(evil_script); |
5994 Handle<i::ExternalTwoByteString> i_source( | 5994 Handle<i::ExternalTwoByteString> i_source( |
5995 i::ExternalTwoByteString::cast(*v8::Utils::OpenHandle(*source))); | 5995 i::ExternalTwoByteString::cast(*v8::Utils::OpenHandle(*source))); |
5996 // This situation can happen if source was an external string disposed | 5996 // This situation can happen if source was an external string disposed |
5997 // by its owner. | 5997 // by its owner. |
5998 i_source->set_resource(0); | 5998 i_source->set_resource(0); |
5999 | 5999 |
6000 bool allow_natives_syntax = i::FLAG_allow_natives_syntax; | 6000 bool allow_natives_syntax = i::FLAG_allow_natives_syntax; |
6001 i::FLAG_allow_natives_syntax = true; | 6001 i::FLAG_allow_natives_syntax = true; |
6002 EnableDebugger(); | 6002 EnableDebugger(); |
6003 CompileRun( | 6003 v8::MaybeLocal<v8::Value> result = |
6004 "var scripts = %DebugGetLoadedScripts();" | 6004 CompileRun(env.context(), |
6005 "var count = scripts.length;" | 6005 "var scripts = %DebugGetLoadedScripts();" |
6006 "for (var i = 0; i < count; ++i) {" | 6006 "var count = scripts.length;" |
6007 " scripts[i].line_ends;" | 6007 "for (var i = 0; i < count; ++i) {" |
6008 "}"); | 6008 " var lines = scripts[i].lineCount();" |
| 6009 " if (lines < 1) throw 'lineCount';" |
| 6010 " var last = -1;" |
| 6011 " for (var j = 0; j < lines; ++j) {" |
| 6012 " var end = scripts[i].lineEnd(j);" |
| 6013 " if (last >= end) throw 'lineEnd';" |
| 6014 " last = end;" |
| 6015 " }" |
| 6016 "}"); |
| 6017 CHECK(!result.IsEmpty()); |
6009 DisableDebugger(); | 6018 DisableDebugger(); |
6010 // Must not crash while accessing line_ends. | 6019 // Must not crash while accessing line_ends. |
6011 i::FLAG_allow_natives_syntax = allow_natives_syntax; | 6020 i::FLAG_allow_natives_syntax = allow_natives_syntax; |
6012 | 6021 |
6013 // Some scripts are retrieved - at least the number of native scripts. | 6022 // Some scripts are retrieved - at least the number of native scripts. |
6014 CHECK_GT((*env) | 6023 CHECK_GT((*env) |
6015 ->Global() | 6024 ->Global() |
6016 ->Get(v8::String::NewFromUtf8(env->GetIsolate(), "count")) | 6025 ->Get(v8::String::NewFromUtf8(env->GetIsolate(), "count")) |
6017 ->Int32Value(), | 6026 ->Int32Value(), |
6018 8); | 6027 8); |
(...skipping 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7683 "let y = 2; \n" | 7692 "let y = 2; \n" |
7684 "debugger; \n" | 7693 "debugger; \n" |
7685 "x * y", | 7694 "x * y", |
7686 30); | 7695 30); |
7687 ExpectInt32( | 7696 ExpectInt32( |
7688 "x = 1; y = 2; \n" | 7697 "x = 1; y = 2; \n" |
7689 "debugger;" | 7698 "debugger;" |
7690 "x * y", | 7699 "x * y", |
7691 30); | 7700 30); |
7692 } | 7701 } |
OLD | NEW |