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

Side by Side Diff: src/api.cc

Issue 10837358: Throw a more descriptive exception when blocking 'eval' via CSP. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add SetErrorMessageForCodeGenerationFromStrings API function. Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « include/v8.h ('k') | src/contexts.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4559 matching lines...) Expand 10 before | Expand all | Expand 10 after
4570 return false; 4570 return false;
4571 } 4571 }
4572 ENTER_V8(isolate); 4572 ENTER_V8(isolate);
4573 i::Object** ctx = reinterpret_cast<i::Object**>(this); 4573 i::Object** ctx = reinterpret_cast<i::Object**>(this);
4574 i::Handle<i::Context> context = 4574 i::Handle<i::Context> context =
4575 i::Handle<i::Context>::cast(i::Handle<i::Object>(ctx)); 4575 i::Handle<i::Context>::cast(i::Handle<i::Object>(ctx));
4576 return !context->allow_code_gen_from_strings()->IsFalse(); 4576 return !context->allow_code_gen_from_strings()->IsFalse();
4577 } 4577 }
4578 4578
4579 4579
4580 void Context::SetErrorMessageForCodeGenerationFromStrings(
4581 Handle<String> error) {
4582 i::Isolate* isolate = i::Isolate::Current();
4583 if (IsDeadCheck(isolate,
4584 "v8::Context::SetErrorMessageForCodeGenerationFromStrings()")) {
4585 return;
4586 }
4587 ENTER_V8(isolate);
4588 i::Object** ctx = reinterpret_cast<i::Object**>(this);
4589 i::Handle<i::Context> context =
4590 i::Handle<i::Context>::cast(i::Handle<i::Object>(ctx));
4591 i::Handle<i::Object> error_handle = Utils::OpenHandle(*error);
4592 context->set_error_message_for_code_gen_from_strings(*error_handle);
4593 }
4594
4595
4580 void V8::SetWrapperClassId(i::Object** global_handle, uint16_t class_id) { 4596 void V8::SetWrapperClassId(i::Object** global_handle, uint16_t class_id) {
4581 i::GlobalHandles::SetWrapperClassId(global_handle, class_id); 4597 i::GlobalHandles::SetWrapperClassId(global_handle, class_id);
4582 } 4598 }
4583 4599
4584 4600
4585 Local<v8::Object> ObjectTemplate::NewInstance() { 4601 Local<v8::Object> ObjectTemplate::NewInstance() {
4586 i::Isolate* isolate = i::Isolate::Current(); 4602 i::Isolate* isolate = i::Isolate::Current();
4587 ON_BAILOUT(isolate, "v8::ObjectTemplate::NewInstance()", 4603 ON_BAILOUT(isolate, "v8::ObjectTemplate::NewInstance()",
4588 return Local<v8::Object>()); 4604 return Local<v8::Object>());
4589 LOG_API(isolate, "ObjectTemplate::NewInstance"); 4605 LOG_API(isolate, "ObjectTemplate::NewInstance");
(...skipping 1945 matching lines...) Expand 10 before | Expand all | Expand 10 after
6535 6551
6536 v->VisitPointers(blocks_.first(), first_block_limit_); 6552 v->VisitPointers(blocks_.first(), first_block_limit_);
6537 6553
6538 for (int i = 1; i < blocks_.length(); i++) { 6554 for (int i = 1; i < blocks_.length(); i++) {
6539 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 6555 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
6540 } 6556 }
6541 } 6557 }
6542 6558
6543 6559
6544 } } // namespace v8::internal 6560 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/contexts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698