| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2011 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, targetOri
gin, info[targetOriginArgIndex]); | 211 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, targetOri
gin, info[targetOriginArgIndex]); |
| 212 | 212 |
| 213 RefPtr<SerializedScriptValue> message = SerializedScriptValueFactory::instan
ce().create(info.GetIsolate(), info[0], &portArray, &arrayBufferArray, exception
State); | 213 RefPtr<SerializedScriptValue> message = SerializedScriptValueFactory::instan
ce().create(info.GetIsolate(), info[0], &portArray, &arrayBufferArray, exception
State); |
| 214 if (exceptionState.throwIfNeeded()) | 214 if (exceptionState.throwIfNeeded()) |
| 215 return; | 215 return; |
| 216 | 216 |
| 217 window->postMessage(message.release(), &portArray, targetOrigin, source, exc
eptionState); | 217 window->postMessage(message.release(), &portArray, targetOrigin, source, exc
eptionState); |
| 218 exceptionState.throwIfNeeded(); | 218 exceptionState.throwIfNeeded(); |
| 219 } | 219 } |
| 220 | 220 |
| 221 // TODO(arv): Remove this custom method and implement Symbol.toStringTag instead
. | 221 // FIXME(fqian): returning string is cheating, and we should |
| 222 // fix this by calling toString function on the receiver. |
| 223 // However, V8 implements toString in JavaScript, which requires |
| 224 // switching context of receiver. I consider it is dangerous. |
| 222 void V8Window::toStringMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) | 225 void V8Window::toStringMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) |
| 223 { | 226 { |
| 224 v8SetReturnValueString(info, "[object Window]", info.GetIsolate()); | 227 v8::Local<v8::Object> domWrapper = V8Window::findInstanceInPrototypeChain(in
fo.This(), info.GetIsolate()); |
| 228 v8::Local<v8::Object> target = domWrapper.IsEmpty() ? info.This() : domWrapp
er; |
| 229 v8::Local<v8::String> value; |
| 230 if (target->ObjectProtoToString(info.GetIsolate()->GetCurrentContext()).ToLo
cal(&value)) |
| 231 v8SetReturnValue(info, value); |
| 225 } | 232 } |
| 226 | 233 |
| 227 void V8Window::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) | 234 void V8Window::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 228 { | 235 { |
| 229 LocalDOMWindow* impl = toLocalDOMWindow(V8Window::toImpl(info.Holder())); | 236 LocalDOMWindow* impl = toLocalDOMWindow(V8Window::toImpl(info.Holder())); |
| 230 ExceptionState exceptionState(ExceptionState::ExecutionContext, "open", "Win
dow", info.Holder(), info.GetIsolate()); | 237 ExceptionState exceptionState(ExceptionState::ExecutionContext, "open", "Win
dow", info.Holder(), info.GetIsolate()); |
| 231 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), exceptionState)) { | 238 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), exceptionState)) { |
| 232 exceptionState.throwIfNeeded(); | 239 exceptionState.throwIfNeeded(); |
| 233 return; | 240 return; |
| 234 } | 241 } |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 { | 345 { |
| 339 return securityCheck(host); | 346 return securityCheck(host); |
| 340 } | 347 } |
| 341 | 348 |
| 342 bool V8Window::indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t i
ndex, v8::AccessType type, v8::Local<v8::Value>) | 349 bool V8Window::indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t i
ndex, v8::AccessType type, v8::Local<v8::Value>) |
| 343 { | 350 { |
| 344 return securityCheck(host); | 351 return securityCheck(host); |
| 345 } | 352 } |
| 346 | 353 |
| 347 } // namespace blink | 354 } // namespace blink |
| OLD | NEW |