// Returns the owner frame pointer of a DOM wrapper object. It only works for // these DOM objects requiring cross-domain access check. static Frame* getTargetFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> data) { Frame* target = 0; WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data); if (V8DOMWindow::info.equals(type)) { v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), host); if (window.IsEmpty()) return target; DOMWindow* targetWindow = V8DOMWindow::toNative(window); target = targetWindow->frame(); } else if (V8History::info.equals(type)) { History* history = V8History::toNative(host); target = history->frame(); } else if (V8Location::info.equals(type)) { Location* location = V8Location::toNative(host); target = location->frame(); } return target; }
bool V8History::namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value>) { // Only allow same origin access. History* history = V8History::toNative(host); return V8BindingSecurity::canAccessFrame(V8BindingState::Only(), history->frame(), false); }
bool V8History::namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value>) { History* history = V8History::toNative(host); return BindingSecurity::shouldAllowAccessToFrame(BindingState::instance(), history->frame(), DoNotReportSecurityError); }