[Mac] Remove the MiniBrowser injected bundle
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 1 Dec 2013 17:03:43 +0000 (17:03 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 1 Dec 2013 17:03:43 +0000 (17:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=125041

Reviewed by Anders Carlsson.

It had no ops!

* MiniBrowser/Configurations/WebBundle.xcconfig: Removed.
* MiniBrowser/MiniBrowser.xcodeproj/project.pbxproj:
* MiniBrowser/mac/AppDelegate.m:
(-[BrowserAppDelegate init]):
* MiniBrowser/mac/WebBundle/Info.plist: Removed.
* MiniBrowser/mac/WebBundle/WebBundleMain.m: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@159900 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/MiniBrowser/Configurations/WebBundle.xcconfig [deleted file]
Tools/MiniBrowser/MiniBrowser.xcodeproj/project.pbxproj
Tools/MiniBrowser/mac/AppDelegate.m
Tools/MiniBrowser/mac/WebBundle/Info.plist [deleted file]
Tools/MiniBrowser/mac/WebBundle/WebBundleMain.m [deleted file]

index 2b5993c..f6e7d47 100644 (file)
@@ -1,3 +1,19 @@
+2013-12-01  Dan Bernstein  <mitz@apple.com>
+
+        [Mac] Remove the MiniBrowser injected bundle
+        https://bugs.webkit.org/show_bug.cgi?id=125041
+
+        Reviewed by Anders Carlsson.
+
+        It had no ops!
+
+        * MiniBrowser/Configurations/WebBundle.xcconfig: Removed.
+        * MiniBrowser/MiniBrowser.xcodeproj/project.pbxproj:
+        * MiniBrowser/mac/AppDelegate.m:
+        (-[BrowserAppDelegate init]):
+        * MiniBrowser/mac/WebBundle/Info.plist: Removed.
+        * MiniBrowser/mac/WebBundle/WebBundleMain.m: Removed.
+
 2013-11-29  Gergo Balogh  <geryxyz@inf.u-szeged.hu>
 
         check-webkit-style should check for extraneous newline between config.h and primary header.
diff --git a/Tools/MiniBrowser/Configurations/WebBundle.xcconfig b/Tools/MiniBrowser/Configurations/WebBundle.xcconfig
deleted file mode 100644 (file)
index 253fdf7..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (C) 2010 Apple Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-// 1. Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
-// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-
-PRODUCT_NAME = WebBundle
-GCC_PREFIX_HEADER = mac/MiniBrowser_Prefix.pch
-INFOPLIST_FILE = mac/WebBundle/Info.plist
index 2bc2e90..6a7ff23 100644 (file)
@@ -8,33 +8,18 @@
 
 /* Begin PBXBuildFile section */
                0F7EB6E3134113C300F4D865 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0F7EB6E2134113C300F4D865 /* WebKit.framework */; };
-               0F7EB879134113F200F4D865 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0F7EB6E2134113C300F4D865 /* WebKit.framework */; };
                0FE643A1161FA8940059E3FF /* BrowserWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FE643A0161FA8940059E3FF /* BrowserWindowController.m */; };
                0FE643A4161FAC660059E3FF /* WK1BrowserWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FE643A3161FAC660059E3FF /* WK1BrowserWindowController.m */; };
                256AC3DA0F4B6AC300CF3369 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 256AC3D90F4B6AC300CF3369 /* AppDelegate.m */; };
                51E244FA11EFCE07008228D1 /* MBToolbarItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 51E244F911EFCE07008228D1 /* MBToolbarItem.m */; };
                8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
-               BC20545E11C96C92008F3375 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
                BC329487116A92E2008635D0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BC329486116A92E2008635D0 /* main.m */; };
                BC329498116A941B008635D0 /* WK2BrowserWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = BC329497116A941B008635D0 /* WK2BrowserWindowController.m */; };
                BC72B89511E57E07001EB4EA /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58150DA1D0A300B32029 /* MainMenu.xib */; };
                BC72B89611E57E0F001EB4EA /* BrowserWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = BC3294A2116A9852008635D0 /* BrowserWindow.xib */; };
                BC8FB5A8116AA1FE0080D413 /* WebKit2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC8FB5A7116AA1FE0080D413 /* WebKit2.framework */; };
-               BCBD384011B08A6800E01E54 /* WebBundleMain.m in Sources */ = {isa = PBXBuildFile; fileRef = BCBD383D11B08A3100E01E54 /* WebBundleMain.m */; };
-               BCBD384411B08AAD00E01E54 /* WebKit2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC8FB5A7116AA1FE0080D413 /* WebKit2.framework */; };
-               BCBD38D011B08C0200E01E54 /* WebBundle.bundle in Copy WebBundle */ = {isa = PBXBuildFile; fileRef = BCBD381D11B0898200E01E54 /* WebBundle.bundle */; };
 /* End PBXBuildFile section */
 
-/* Begin PBXContainerItemProxy section */
-               BCBD38C511B08BA400E01E54 /* PBXContainerItemProxy */ = {
-                       isa = PBXContainerItemProxy;
-                       containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
-                       proxyType = 1;
-                       remoteGlobalIDString = BCBD381C11B0898200E01E54;
-                       remoteInfo = WebBundle;
-               };
-/* End PBXContainerItemProxy section */
-
 /* Begin PBXCopyFilesBuildPhase section */
                BCBD38CF11B08C0100E01E54 /* Copy WebBundle */ = {
                        isa = PBXCopyFilesBuildPhase;
@@ -42,7 +27,6 @@
                        dstPath = Contents;
                        dstSubfolderSpec = 1;
                        files = (
-                               BCBD38D011B08C0200E01E54 /* WebBundle.bundle in Copy WebBundle */,
                        );
                        name = "Copy WebBundle";
                        runOnlyForDeploymentPostprocessing = 0;
                BC329496116A941B008635D0 /* WK2BrowserWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WK2BrowserWindowController.h; path = mac/WK2BrowserWindowController.h; sourceTree = "<group>"; };
                BC329497116A941B008635D0 /* WK2BrowserWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WK2BrowserWindowController.m; path = mac/WK2BrowserWindowController.m; sourceTree = "<group>"; };
                BC3294A2116A9852008635D0 /* BrowserWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = BrowserWindow.xib; path = mac/BrowserWindow.xib; sourceTree = "<group>"; };
-               BC72B89711E57E6E001EB4EA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
                BC72B89A11E57E8A001EB4EA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = mac/Info.plist; sourceTree = "<group>"; };
                BC8FB5A7116AA1FE0080D413 /* WebKit2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebKit2.framework; sourceTree = BUILT_PRODUCTS_DIR; };
                BCA8CBDD11E578A000812FB7 /* Base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; };
                BCA8CBDE11E578A000812FB7 /* DebugRelease.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; };
                BCA8CBDF11E578A000812FB7 /* MiniBrowser.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = MiniBrowser.xcconfig; sourceTree = "<group>"; };
-               BCA8CBE011E578A000812FB7 /* WebBundle.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = WebBundle.xcconfig; sourceTree = "<group>"; };
-               BCBD381D11B0898200E01E54 /* WebBundle.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = WebBundle.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
-               BCBD383D11B08A3100E01E54 /* WebBundleMain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebBundleMain.m; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               BCBD381B11B0898200E01E54 /* Frameworks */ = {
-                       isa = PBXFrameworksBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
-                               BC20545E11C96C92008F3375 /* Cocoa.framework in Frameworks */,
-                               0F7EB879134113F200F4D865 /* WebKit.framework in Frameworks */,
-                               BCBD384411B08AAD00E01E54 /* WebKit2.framework in Frameworks */,
-                       );
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
                        isa = PBXGroup;
                        children = (
                                8D1107320486CEB800E47090 /* MiniBrowser.app */,
-                               BCBD381D11B0898200E01E54 /* WebBundle.bundle */,
                        );
                        name = Products;
                        sourceTree = "<group>";
                        children = (
                                256AC3F00F4B6AF500CF3369 /* MiniBrowser_Prefix.pch */,
                                080E96DDFE201D6D7F000001 /* MiniBrowser */,
-                               BCBD382B11B089F700E01E54 /* WebBundle */,
                                29B97317FDCFA39411CA2CEA /* Resources */,
                                BCA8CBDA11E5787800812FB7 /* Configurations */,
                                29B97323FDCFA39411CA2CEA /* Frameworks */,
                                BCA8CBDD11E578A000812FB7 /* Base.xcconfig */,
                                BCA8CBDE11E578A000812FB7 /* DebugRelease.xcconfig */,
                                BCA8CBDF11E578A000812FB7 /* MiniBrowser.xcconfig */,
-                               BCA8CBE011E578A000812FB7 /* WebBundle.xcconfig */,
                        );
                        path = Configurations;
                        sourceTree = "<group>";
                };
-               BCBD382B11B089F700E01E54 /* WebBundle */ = {
-                       isa = PBXGroup;
-                       children = (
-                               BC72B89711E57E6E001EB4EA /* Info.plist */,
-                               BCBD383D11B08A3100E01E54 /* WebBundleMain.m */,
-                       );
-                       name = WebBundle;
-                       path = mac/WebBundle;
-                       sourceTree = "<group>";
-               };
 /* End PBXGroup section */
 
 /* Begin PBXNativeTarget section */
                        buildRules = (
                        );
                        dependencies = (
-                               BCBD38C611B08BA400E01E54 /* PBXTargetDependency */,
                        );
                        name = MiniBrowser;
                        productInstallPath = "$(HOME)/Applications";
                        productReference = 8D1107320486CEB800E47090 /* MiniBrowser.app */;
                        productType = "com.apple.product-type.application";
                };
-               BCBD381C11B0898200E01E54 /* WebBundle */ = {
-                       isa = PBXNativeTarget;
-                       buildConfigurationList = BCBD382111B0898300E01E54 /* Build configuration list for PBXNativeTarget "WebBundle" */;
-                       buildPhases = (
-                               BCBD381911B0898200E01E54 /* Resources */,
-                               BCBD381A11B0898200E01E54 /* Sources */,
-                               BCBD381B11B0898200E01E54 /* Frameworks */,
-                       );
-                       buildRules = (
-                       );
-                       dependencies = (
-                       );
-                       name = WebBundle;
-                       productName = WebBundle;
-                       productReference = BCBD381D11B0898200E01E54 /* WebBundle.bundle */;
-                       productType = "com.apple.product-type.bundle";
-               };
 /* End PBXNativeTarget section */
 
 /* Begin PBXProject section */
                        projectRoot = "";
                        targets = (
                                8D1107260486CEB800E47090 /* MiniBrowser */,
-                               BCBD381C11B0898200E01E54 /* WebBundle */,
                        );
                };
 /* End PBXProject section */
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               BCBD381911B0898200E01E54 /* Resources */ = {
-                       isa = PBXResourcesBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
 /* End PBXResourcesBuildPhase section */
 
 /* Begin PBXSourcesBuildPhase section */
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               BCBD381A11B0898200E01E54 /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
-                               BCBD384011B08A6800E01E54 /* WebBundleMain.m in Sources */,
-                       );
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
 /* End PBXSourcesBuildPhase section */
 
-/* Begin PBXTargetDependency section */
-               BCBD38C611B08BA400E01E54 /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = BCBD381C11B0898200E01E54 /* WebBundle */;
-                       targetProxy = BCBD38C511B08BA400E01E54 /* PBXContainerItemProxy */;
-               };
-/* End PBXTargetDependency section */
-
 /* Begin XCBuildConfiguration section */
-               BCBD381F11B0898300E01E54 /* Debug */ = {
-                       isa = XCBuildConfiguration;
-                       baseConfigurationReference = BCA8CBE011E578A000812FB7 /* WebBundle.xcconfig */;
-                       buildSettings = {
-                       };
-                       name = Debug;
-               };
-               BCBD382011B0898300E01E54 /* Release */ = {
-                       isa = XCBuildConfiguration;
-                       baseConfigurationReference = BCA8CBE011E578A000812FB7 /* WebBundle.xcconfig */;
-                       buildSettings = {
-                       };
-                       name = Release;
-               };
                C01FCF4B08A954540054247B /* Debug */ = {
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = BCA8CBDF11E578A000812FB7 /* MiniBrowser.xcconfig */;
 /* End XCBuildConfiguration section */
 
 /* Begin XCConfigurationList section */
-               BCBD382111B0898300E01E54 /* Build configuration list for PBXNativeTarget "WebBundle" */ = {
-                       isa = XCConfigurationList;
-                       buildConfigurations = (
-                               BCBD381F11B0898300E01E54 /* Debug */,
-                               BCBD382011B0898300E01E54 /* Release */,
-                       );
-                       defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Release;
-               };
                C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "MiniBrowser" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
index f7c3760..680ccbe 100644 (file)
@@ -41,30 +41,6 @@ enum {
 
 @implementation BrowserAppDelegate
 
-void didReceiveMessageFromInjectedBundle(WKContextRef context, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo)
-{
-    CFStringRef cfMessageName = WKStringCopyCFString(0, messageName);
-
-    WKTypeID typeID = WKGetTypeID(messageBody);
-    if (typeID == WKStringGetTypeID()) {
-        CFStringRef cfMessageBody = WKStringCopyCFString(0, (WKStringRef)messageBody);
-        LOG(@"ContextInjectedBundleClient - didReceiveMessage - MessageName: %@ MessageBody %@", cfMessageName, cfMessageBody);
-        CFRelease(cfMessageBody);
-    } else {
-        LOG(@"ContextInjectedBundleClient - didReceiveMessage - MessageName: %@ (MessageBody Unhandled)\n", cfMessageName);
-    }
-    
-    CFRelease(cfMessageName);
-
-    WKStringRef newMessageName = WKStringCreateWithCFString(CFSTR("Response"));
-    WKStringRef newMessageBody = WKStringCreateWithCFString(CFSTR("Roger that!"));
-
-    WKContextPostMessageToInjectedBundle(context, newMessageName, newMessageBody);
-    
-    WKRelease(newMessageName);
-    WKRelease(newMessageBody);
-}
-
 // MARK: History Client Callbacks
 
 static void didNavigateWithNavigationData(WKContextRef context, WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef frame, const void *clientInfo)
@@ -128,24 +104,11 @@ static void populateVisitedLinks(WKContextRef context, const void *clientInfo)
             populateVisitedLinks
         };
 
-        CFStringRef bundlePathCF = (CFStringRef)[[NSBundle mainBundle] pathForAuxiliaryExecutable:@"WebBundle.bundle"];
-        WKStringRef bundlePath = WKStringCreateWithCFString(bundlePathCF);
-
-        _processContext = WKContextCreateWithInjectedBundlePath(bundlePath);
-        
-        WKContextInjectedBundleClient bundleClient = {
-            kWKContextInjectedBundleClientCurrentVersion,
-            0,      /* clientInfo */
-            didReceiveMessageFromInjectedBundle,
-            0,      /* didReceiveSynchronousMessageFromInjectedBundle */
-            0       /* getInjectedBundleInitializationUserData */
-        };
-        WKContextSetInjectedBundleClient(_processContext, &bundleClient);
+        _processContext = WKContextCreate();
+
         WKContextSetHistoryClient(_processContext, &historyClient);
         WKContextSetCacheModel(_processContext, kWKCacheModelPrimaryWebBrowser);
 
-        WKRelease(bundlePath);
-        
         WKStringRef pageGroupIdentifier = WKStringCreateWithCFString(CFSTR("MiniBrowser"));
         _pageGroup = WKPageGroupCreateWithIdentifier(pageGroupIdentifier);
         WKRelease(pageGroupIdentifier);
diff --git a/Tools/MiniBrowser/mac/WebBundle/Info.plist b/Tools/MiniBrowser/mac/WebBundle/Info.plist
deleted file mode 100644 (file)
index 59bb80d..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-       <key>CFBundleDevelopmentRegion</key>
-       <string>English</string>
-       <key>CFBundleExecutable</key>
-       <string>${EXECUTABLE_NAME}</string>
-       <key>CFBundleIdentifier</key>
-       <string>org.webkit.${PRODUCT_NAME:rfc1034identifier}</string>
-       <key>CFBundleInfoDictionaryVersion</key>
-       <string>6.0</string>
-       <key>CFBundlePackageType</key>
-       <string>BNDL</string>
-       <key>CFBundleShortVersionString</key>
-       <string>1.0</string>
-       <key>CFBundleSignature</key>
-       <string>????</string>
-       <key>CFBundleVersion</key>
-       <string>1</string>
-</dict>
-</plist>
diff --git a/Tools/MiniBrowser/mac/WebBundle/WebBundleMain.m b/Tools/MiniBrowser/mac/WebBundle/WebBundleMain.m
deleted file mode 100644 (file)
index 16e86b4..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <Cocoa/Cocoa.h>
-#include <WebKit2/WKBundle.h>
-#include <WebKit2/WKBundleFrame.h>
-#include <WebKit2/WKBundleInitialize.h>
-#include <WebKit2/WKBundlePage.h>
-#include <WebKit2/WKString.h>
-#include <WebKit2/WKStringCF.h>
-#include <WebKit2/WKURLCF.h>
-#include <stdio.h>
-
-static WKBundleRef globalBundle;
-
-// WKBundlePageClient functions
-
-void didClearWindowObjectForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleScriptWorldRef world, const void *clientInfo)
-{
-    WKURLRef wkURL = WKBundleFrameCopyURL(WKBundlePageGetMainFrame(page));
-    CFURLRef cfURL = WKURLCopyCFURL(0, wkURL);
-    WKRelease(wkURL);
-
-    LOG(@"WKBundlePageClient - didClearWindowForFrame %@", [(NSURL *)cfURL absoluteString]);
-    if (cfURL)
-        CFRelease(cfURL);
-
-    WKStringRef messageName = WKStringCreateWithCFString(CFSTR("Callback"));
-    WKStringRef messageBody = WKStringCreateWithCFString(CFSTR("Window was cleared"));
-    WKBundlePostMessage(globalBundle, messageName, messageBody);
-    WKRelease(messageName);
-    WKRelease(messageBody);
-}
-
-
-// WKBundleClient
-
-void didCreatePage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo)
-{
-    LOG(@"WKBundleClient - didCreatePage\n");
-
-    WKBundlePageLoaderClient client;
-    memset(&client, 0, sizeof(client));
-    client.didClearWindowObjectForFrame = didClearWindowObjectForFrame;
-
-    WKBundlePageSetPageLoaderClient(page, &client);
-}
-
-void willDestroyPage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo)
-{
-    LOG(@"WKBundleClient - willDestroyPage\n");
-}
-
-void didReceiveMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo)
-{
-    CFStringRef cfMessageName = WKStringCopyCFString(0, messageName);
-
-    WKTypeID typeID = WKGetTypeID(messageBody);
-    if (typeID == WKStringGetTypeID()) {
-        CFStringRef cfMessageBody = WKStringCopyCFString(0, (WKStringRef)messageBody);
-        LOG(@"WKBundleClient - didReceiveMessage - MessageName: %@ MessageBody %@", cfMessageName, cfMessageBody);
-        CFRelease(cfMessageBody);
-    } else {
-        LOG(@"WKBundleClient - didReceiveMessage - MessageName: %@ (MessageBody Unhandled)\n", cfMessageName);
-    }
-
-    CFRelease(cfMessageName);
-}
-
-void WKBundleInitialize(WKBundleRef bundle, WKTypeRef initializationUserData)
-{
-    globalBundle = bundle;
-
-    WKBundleClient client = {
-        kWKBundleClientCurrentVersion,
-        0,
-        didCreatePage,
-        willDestroyPage,
-        0, // didInitializePageGroup
-        didReceiveMessage,
-        0 // didReceiveMessageToPage
-    };
-    WKBundleSetClient(bundle, &client);
-}