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

Side by Side Diff: Source/bindings/core/v8/V8DOMWrapper.h

Issue 1323453005: Modifies V8WrapperInstantiationScope::SecurityCheck to only call BindingSecurity::shouldAllowAccess… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: addressed haraken@'s comments. Created 5 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
« no previous file with comments | « no previous file | Source/bindings/core/v8/V8DOMWrapper.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // creationContext should not be empty. Because if we have an 117 // creationContext should not be empty. Because if we have an
118 // empty creationContext, we will end up creating 118 // empty creationContext, we will end up creating
119 // a new object in the context currently entered. This is wrong. 119 // a new object in the context currently entered. This is wrong.
120 RELEASE_ASSERT(!creationContext.IsEmpty()); 120 RELEASE_ASSERT(!creationContext.IsEmpty());
121 v8::Local<v8::Context> contextForWrapper = creationContext->CreationCont ext(); 121 v8::Local<v8::Context> contextForWrapper = creationContext->CreationCont ext();
122 // For performance, we enter the context only if the currently running c ontext 122 // For performance, we enter the context only if the currently running c ontext
123 // is different from the context that we are about to enter. 123 // is different from the context that we are about to enter.
124 if (contextForWrapper == m_context) 124 if (contextForWrapper == m_context)
125 return; 125 return;
126 if (withSecurityCheck) 126 if (withSecurityCheck)
127 SecurityCheck(isolate, contextForWrapper); 127 securityCheck(isolate, contextForWrapper);
128 m_context = v8::Local<v8::Context>::New(isolate, contextForWrapper); 128 m_context = v8::Local<v8::Context>::New(isolate, contextForWrapper);
129 m_didEnterContext = true; 129 m_didEnterContext = true;
130 m_context->Enter(); 130 m_context->Enter();
131 } 131 }
132 132
133 ~V8WrapperInstantiationScope() 133 ~V8WrapperInstantiationScope()
134 { 134 {
135 if (!m_didEnterContext) 135 if (!m_didEnterContext)
136 return; 136 return;
137 m_context->Exit(); 137 m_context->Exit();
138 } 138 }
139 139
140 v8::Local<v8::Context> context() const { return m_context; } 140 v8::Local<v8::Context> context() const { return m_context; }
141 141
142 private: 142 private:
143 void SecurityCheck(v8::Isolate*, v8::Local<v8::Context> contextForWrapper); 143 void securityCheck(v8::Isolate*, v8::Local<v8::Context> contextForWrapper);
144 144
145 bool m_didEnterContext; 145 bool m_didEnterContext;
146 v8::Local<v8::Context> m_context; 146 v8::Local<v8::Context> m_context;
147 }; 147 };
148 148
149 } // namespace blink 149 } // namespace blink
150 150
151 #endif // V8DOMWrapper_h 151 #endif // V8DOMWrapper_h
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/core/v8/V8DOMWrapper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698