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

Side by Side Diff: src/api.cc

Issue 20646006: Pipe a script's CORS status through V8 during compilation. (Closed) Base URL: https://chromium.googlesource.com/external/v8.git@master
Patch Set: rebaseline. Created 7 years, 4 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 unified diff | Download patch
OLDNEW
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 1899 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 i::Isolate* isolate = i::Isolate::Current(); 1910 i::Isolate* isolate = i::Isolate::Current();
1911 ON_BAILOUT(isolate, "v8::Script::New()", return Local<Script>()); 1911 ON_BAILOUT(isolate, "v8::Script::New()", return Local<Script>());
1912 LOG_API(isolate, "Script::New"); 1912 LOG_API(isolate, "Script::New");
1913 ENTER_V8(isolate); 1913 ENTER_V8(isolate);
1914 i::SharedFunctionInfo* raw_result = NULL; 1914 i::SharedFunctionInfo* raw_result = NULL;
1915 { i::HandleScope scope(isolate); 1915 { i::HandleScope scope(isolate);
1916 i::Handle<i::String> str = Utils::OpenHandle(*source); 1916 i::Handle<i::String> str = Utils::OpenHandle(*source);
1917 i::Handle<i::Object> name_obj; 1917 i::Handle<i::Object> name_obj;
1918 int line_offset = 0; 1918 int line_offset = 0;
1919 int column_offset = 0; 1919 int column_offset = 0;
1920 bool passed_access_check = false;
1920 if (origin != NULL) { 1921 if (origin != NULL) {
1921 if (!origin->ResourceName().IsEmpty()) { 1922 if (!origin->ResourceName().IsEmpty()) {
1922 name_obj = Utils::OpenHandle(*origin->ResourceName()); 1923 name_obj = Utils::OpenHandle(*origin->ResourceName());
1923 } 1924 }
1924 if (!origin->ResourceLineOffset().IsEmpty()) { 1925 if (!origin->ResourceLineOffset().IsEmpty()) {
1925 line_offset = static_cast<int>(origin->ResourceLineOffset()->Value()); 1926 line_offset = static_cast<int>(origin->ResourceLineOffset()->Value());
1926 } 1927 }
1927 if (!origin->ResourceColumnOffset().IsEmpty()) { 1928 if (!origin->ResourceColumnOffset().IsEmpty()) {
1928 column_offset = 1929 column_offset =
1929 static_cast<int>(origin->ResourceColumnOffset()->Value()); 1930 static_cast<int>(origin->ResourceColumnOffset()->Value());
1930 } 1931 }
1932 if (!origin->ResourcePassedAccessCheck().IsEmpty()) {
1933 passed_access_check = origin->ResourcePassedAccessCheck() == v8::True();
1934 }
1931 } 1935 }
1932 EXCEPTION_PREAMBLE(isolate); 1936 EXCEPTION_PREAMBLE(isolate);
1933 i::ScriptDataImpl* pre_data_impl = 1937 i::ScriptDataImpl* pre_data_impl =
1934 static_cast<i::ScriptDataImpl*>(pre_data); 1938 static_cast<i::ScriptDataImpl*>(pre_data);
1935 // We assert that the pre-data is sane, even though we can actually 1939 // We assert that the pre-data is sane, even though we can actually
1936 // handle it if it turns out not to be in release mode. 1940 // handle it if it turns out not to be in release mode.
1937 ASSERT(pre_data_impl == NULL || pre_data_impl->SanityCheck()); 1941 ASSERT(pre_data_impl == NULL || pre_data_impl->SanityCheck());
1938 // If the pre-data isn't sane we simply ignore it 1942 // If the pre-data isn't sane we simply ignore it
1939 if (pre_data_impl != NULL && !pre_data_impl->SanityCheck()) { 1943 if (pre_data_impl != NULL && !pre_data_impl->SanityCheck()) {
1940 pre_data_impl = NULL; 1944 pre_data_impl = NULL;
1941 } 1945 }
1942 i::Handle<i::SharedFunctionInfo> result = 1946 i::Handle<i::SharedFunctionInfo> result =
1943 i::Compiler::Compile(str, 1947 i::Compiler::Compile(str,
1944 name_obj, 1948 name_obj,
1945 line_offset, 1949 line_offset,
1946 column_offset, 1950 column_offset,
1951 passed_access_check,
1947 isolate->global_context(), 1952 isolate->global_context(),
1948 NULL, 1953 NULL,
1949 pre_data_impl, 1954 pre_data_impl,
1950 Utils::OpenHandle(*script_data, true), 1955 Utils::OpenHandle(*script_data, true),
1951 i::NOT_NATIVES_CODE); 1956 i::NOT_NATIVES_CODE);
1952 has_pending_exception = result.is_null(); 1957 has_pending_exception = result.is_null();
1953 EXCEPTION_BAILOUT_CHECK(isolate, Local<Script>()); 1958 EXCEPTION_BAILOUT_CHECK(isolate, Local<Script>());
1954 raw_result = *result; 1959 raw_result = *result;
1955 } 1960 }
1956 i::Handle<i::SharedFunctionInfo> result(raw_result, isolate); 1961 i::Handle<i::SharedFunctionInfo> result(raw_result, isolate);
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
2402 "GetPositionInLine", 2407 "GetPositionInLine",
2403 data_obj, 2408 data_obj,
2404 &has_pending_exception); 2409 &has_pending_exception);
2405 EXCEPTION_BAILOUT_CHECK(isolate, 0); 2410 EXCEPTION_BAILOUT_CHECK(isolate, 0);
2406 i::Handle<i::JSMessageObject> message = 2411 i::Handle<i::JSMessageObject> message =
2407 i::Handle<i::JSMessageObject>::cast(data_obj); 2412 i::Handle<i::JSMessageObject>::cast(data_obj);
2408 int start = message->start_position(); 2413 int start = message->start_position();
2409 int end = message->end_position(); 2414 int end = message->end_position();
2410 return static_cast<int>(start_col_obj->Number()) + (end - start); 2415 return static_cast<int>(start_col_obj->Number()) + (end - start);
2411 } 2416 }
2412 2417
Michael Starzinger 2013/07/30 09:52:55 nit: Two empty newlines between methods.
2418 bool Message::DidPassAccessCheck() const {
2419 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2420 if (IsDeadCheck(isolate, "v8::Message::DidPassAccessChecks()")) return 0;
2421 ENTER_V8(isolate);
2422 i::HandleScope scope(isolate);
2423 i::Handle<i::JSMessageObject> message =
2424 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
2425 i::Handle<i::JSValue> script =
2426 i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script(),
2427 isolate));
2428 return i::Script::cast(script->value())->passed_access_check();
2429 }
2430
2413 2431
2414 Local<String> Message::GetSourceLine() const { 2432 Local<String> Message::GetSourceLine() const {
2415 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2433 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2416 ON_BAILOUT(isolate, "v8::Message::GetSourceLine()", return Local<String>()); 2434 ON_BAILOUT(isolate, "v8::Message::GetSourceLine()", return Local<String>());
2417 ENTER_V8(isolate); 2435 ENTER_V8(isolate);
2418 HandleScope scope(reinterpret_cast<Isolate*>(isolate)); 2436 HandleScope scope(reinterpret_cast<Isolate*>(isolate));
2419 EXCEPTION_PREAMBLE(isolate); 2437 EXCEPTION_PREAMBLE(isolate);
2420 i::Handle<i::Object> result = CallV8HeapFunction("GetSourceLine", 2438 i::Handle<i::Object> result = CallV8HeapFunction("GetSourceLine",
2421 Utils::OpenHandle(this), 2439 Utils::OpenHandle(this),
2422 &has_pending_exception); 2440 &has_pending_exception);
(...skipping 5674 matching lines...) Expand 10 before | Expand all | Expand 10 after
8097 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 8115 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
8098 Address callback_address = 8116 Address callback_address =
8099 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8117 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8100 VMState<EXTERNAL> state(isolate); 8118 VMState<EXTERNAL> state(isolate);
8101 ExternalCallbackScope call_scope(isolate, callback_address); 8119 ExternalCallbackScope call_scope(isolate, callback_address);
8102 return callback(info); 8120 return callback(info);
8103 } 8121 }
8104 8122
8105 8123
8106 } } // namespace v8::internal 8124 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698