OLD | NEW |
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // creationContext should not be empty. Because if we have an | 108 // creationContext should not be empty. Because if we have an |
109 // empty creationContext, we will end up creating | 109 // empty creationContext, we will end up creating |
110 // a new object in the context currently entered. This is wrong. | 110 // a new object in the context currently entered. This is wrong. |
111 RELEASE_ASSERT(!creationContext.IsEmpty()); | 111 RELEASE_ASSERT(!creationContext.IsEmpty()); |
112 v8::Local<v8::Context> contextForWrapper = creationContext->CreationCont
ext(); | 112 v8::Local<v8::Context> contextForWrapper = creationContext->CreationCont
ext(); |
113 | 113 |
114 // For performance, we enter the context only if the currently running c
ontext | 114 // For performance, we enter the context only if the currently running c
ontext |
115 // is different from the context that we are about to enter. | 115 // is different from the context that we are about to enter. |
116 if (contextForWrapper == m_context) | 116 if (contextForWrapper == m_context) |
117 return; | 117 return; |
| 118 RELEASE_ASSERT(creationContext->CreationContext()->Global() == m_context
->Global()); |
118 if (withSecurityCheck) { | 119 if (withSecurityCheck) { |
119 securityCheck(isolate, contextForWrapper); | 120 securityCheck(isolate, contextForWrapper); |
120 } else { | 121 } else { |
121 m_convertExceptions = true; | 122 m_convertExceptions = true; |
122 } | 123 } |
123 m_context = v8::Local<v8::Context>::New(isolate, contextForWrapper); | 124 m_context = v8::Local<v8::Context>::New(isolate, contextForWrapper); |
124 m_didEnterContext = true; | 125 m_didEnterContext = true; |
125 m_context->Enter(); | 126 m_context->Enter(); |
126 } | 127 } |
127 | 128 |
(...skipping 22 matching lines...) Expand all Loading... |
150 | 151 |
151 bool m_didEnterContext; | 152 bool m_didEnterContext; |
152 v8::Local<v8::Context> m_context; | 153 v8::Local<v8::Context> m_context; |
153 v8::TryCatch m_tryCatch; | 154 v8::TryCatch m_tryCatch; |
154 bool m_convertExceptions; | 155 bool m_convertExceptions; |
155 }; | 156 }; |
156 | 157 |
157 } // namespace blink | 158 } // namespace blink |
158 | 159 |
159 #endif // V8DOMWrapper_h | 160 #endif // V8DOMWrapper_h |
OLD | NEW |