void DOMWindowExtensionNoCache::globalObjectIsAvailableForFrame(WKBundleFrameRef frame, WKBundleScriptWorldRef world) { WKBundleDOMWindowExtensionRef extension = WKBundleDOMWindowExtensionCreate(frame, world); int index = 0; bool standard; standard = world == WKBundleScriptWorldNormalWorld(); bool mainFrame = !WKBundleFrameGetParentFrame(frame); switch (m_numberMainFrameLoads) { case 0: index = mainFrame ? (standard ? 0 : 1) : (standard ? 2 : 3); break; case 1: index = standard ? 4 : 5; break; case 2: index = mainFrame ? (standard ? 6 : 7) : (standard ? 8 : 9); break; default: ASSERT_NOT_REACHED(); break; } m_extensionToRecordMap.set(extension, index); updateExtensionStateRecord(extension, Connected); sendBundleMessage("GlobalObjectIsAvailableForFrame called"); }
static void didFinishLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo) { if (!WKBundleFrameIsMainFrame(frame)) { childFrame = frame; return; } bool isParentFrameCheckSuccessful = childFrame ? WKBundleFrameGetParentFrame(childFrame.get()) == frame : false; WKBundlePostMessage(testBundle.get(), Util::toWK("DidCheckParentFrame").get(), adoptWK(WKBooleanCreate(isParentFrameCheckSuccessful)).get()); }
void DOMWindowExtensionBasic::didCreateGlobalObjectForFrame(WKBundleFrameRef frame, WKBundleScriptWorldRef world) { WKBundleDOMWindowExtensionRef extension = WKBundleDOMWindowExtensionCreate(frame, world); int index; bool standard; standard = world == WKBundleScriptWorldNormalWorld(); if (WKBundleFrameGetParentFrame(frame)) index = standard ? 2 : 3; else index = m_finishedOneMainFrameLoad ? (standard ? 4 : 5) : (standard ? 0 : 1); m_extensionToRecordMap.set(extension, index); updateExtensionStateRecord(extension, Connected); sendBundleMessage("DidCreateGlobalObjectForFrame called"); }
void DOMWindowExtensionBasic::frameLoadFinished(WKBundleFrameRef frame) { bool mainFrame = !WKBundleFrameGetParentFrame(frame); if (mainFrame) m_finishedOneMainFrameLoad = true; char body[16384]; sprintf(body, "%s finished loading", mainFrame ? "Main frame" : "Subframe"); // Only consider load finished for the main frame const char* name = mainFrame ? "DidFinishLoadForMainFrame" : "DidFinishLoadForFrame"; WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString(name)); WKRetainPtr<WKStringRef> messageBody = adoptWK(WKStringCreateWithUTF8CString(body)); WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get()); sendExtensionStateMessage(); }