<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[160616] trunk/Source/WebKit2</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/160616">160616</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2013-12-14 22:32:27 -0800 (Sat, 14 Dec 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add page load delegate for WebProcessPlugInBrowsingContextController.
https://bugs.webkit.org/show_bug.cgi?id=125697

Add page load delegate for WebProcessPlugInBrowsingContextController so that a
WebProcess injected bundle can listen to page load events.

Patch by Yongjun Zhang &lt;yongjun_zhang@apple.com&gt; on 2013-12-14
Reviewed by Sam Weinig.

* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h: Added.
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.h:
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
(didStartProvisionalLoadForFrame):
(didFinishLoadForFrame):
(globalObjectIsAvailableForFrame):
(setUpPageLoaderClient):
(-[WKWebProcessPlugInBrowserContextController loadDelegate]):
(-[WKWebProcessPlugInBrowserContextController setLoadDelegate:]):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPImacWKWebProcessPlugInBrowserContextControllerh">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPImacWKWebProcessPlugInBrowserContextControllermm">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPICocoaWKWebProcessPlugInLoadDelegateh">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (160615 => 160616)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2013-12-15 06:20:05 UTC (rev 160615)
+++ trunk/Source/WebKit2/ChangeLog        2013-12-15 06:32:27 UTC (rev 160616)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2013-12-14  Yongjun Zhang  &lt;yongjun_zhang@apple.com&gt;
+
+        Add page load delegate for WebProcessPlugInBrowsingContextController.
+        https://bugs.webkit.org/show_bug.cgi?id=125697
+
+        Add page load delegate for WebProcessPlugInBrowsingContextController so that a
+        WebProcess injected bundle can listen to page load events.
+
+        Reviewed by Sam Weinig.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h: Added.
+        * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.h:
+        * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
+        (didStartProvisionalLoadForFrame):
+        (didFinishLoadForFrame):
+        (globalObjectIsAvailableForFrame):
+        (setUpPageLoaderClient):
+        (-[WKWebProcessPlugInBrowserContextController loadDelegate]):
+        (-[WKWebProcessPlugInBrowserContextController setLoadDelegate:]):
+
</ins><span class="cx"> 2013-12-14  Dan Bernstein  &lt;mitz@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] Implement NetworkProcess::allowSpecificHTTPSCertificateForHost
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (160615 => 160616)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2013-12-15 06:20:05 UTC (rev 160615)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2013-12-15 06:32:27 UTC (rev 160616)
</span><span class="lines">@@ -332,6 +332,7 @@
</span><span class="cx">                 1CA8B954127C891500576C2B /* WebInspectorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C8E2DAD1278C5B200BC7BD0 /* WebInspectorMac.mm */; };
</span><span class="cx">                 1CB75C941701E880009F809F /* DockRight.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 1CB75C931701E880009F809F /* DockRight.pdf */; };
</span><span class="cx">                 1CBC945E16515ED200D68AAE /* DockBottom.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 1CBC945D16515ED200D68AAE /* DockBottom.pdf */; };
</span><ins>+                1F335BC0185B84F0001A201A /* WKWebProcessPlugInLoadDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F335BBF185B84D8001A201A /* WKWebProcessPlugInLoadDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
</ins><span class="cx">                 1F7506AD1859161C00EC0FF7 /* WKWebProcessPlugInFrame.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1F01816A1858DC1500F92884 /* WKWebProcessPlugInFrame.mm */; };
</span><span class="cx">                 1F7506AE1859162200EC0FF7 /* WKWebProcessPlugInHitTestResult.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1F01816D1858DC1600F92884 /* WKWebProcessPlugInHitTestResult.mm */; };
</span><span class="cx">                 1F7506AF1859162800EC0FF7 /* WKWebProcessPlugInNodeHandle.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1F0181701858DC1600F92884 /* WKWebProcessPlugInNodeHandle.mm */; };
</span><span class="lines">@@ -1902,6 +1903,7 @@
</span><span class="cx">                 1F0181721858DC1600F92884 /* WKWebProcessPlugInScriptWorld.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessPlugInScriptWorld.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1F0181731858DC1600F92884 /* WKWebProcessPlugInScriptWorld.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebProcessPlugInScriptWorld.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1F0181741858DC1600F92884 /* WKWebProcessPlugInScriptWorldInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessPlugInScriptWorldInternal.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                1F335BBF185B84D8001A201A /* WKWebProcessPlugInLoadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessPlugInLoadDelegate.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 290F4271172A0C7400939FF0 /* ChildProcessSupplement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChildProcessSupplement.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 293EBEA91627D9C9005F89F1 /* WKDOMText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDOMText.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 293EBEAA1627D9C9005F89F1 /* WKDOMText.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKDOMText.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -3747,6 +3749,7 @@
</span><span class="cx">                                 1F01816C1858DC1500F92884 /* WKWebProcessPlugInHitTestResult.h */,
</span><span class="cx">                                 1F01816D1858DC1600F92884 /* WKWebProcessPlugInHitTestResult.mm */,
</span><span class="cx">                                 1F01816E1858DC1600F92884 /* WKWebProcessPlugInHitTestResultInternal.h */,
</span><ins>+                                1F335BBF185B84D8001A201A /* WKWebProcessPlugInLoadDelegate.h */,
</ins><span class="cx">                                 1F01816F1858DC1600F92884 /* WKWebProcessPlugInNodeHandle.h */,
</span><span class="cx">                                 1F0181701858DC1600F92884 /* WKWebProcessPlugInNodeHandle.mm */,
</span><span class="cx">                                 1F0181711858DC1600F92884 /* WKWebProcessPlugInNodeHandleInternal.h */,
</span><span class="lines">@@ -5781,6 +5784,7 @@
</span><span class="cx">                                 378E1A4E18208D700031007A /* WKNSURL.h in Headers */,
</span><span class="cx">                                 512935E41288D97800A4B695 /* InjectedBundlePageContextMenuClient.h in Headers */,
</span><span class="cx">                                 E1EE53E311F8CFC000CCBEE4 /* InjectedBundlePageEditorClient.h in Headers */,
</span><ins>+                                1F335BC0185B84F0001A201A /* WKWebProcessPlugInLoadDelegate.h in Headers */,
</ins><span class="cx">                                 BC14E10A120B905E00826C0C /* InjectedBundlePageFormClient.h in Headers */,
</span><span class="cx">                                 1A445BA5184D5FDA004B3414 /* WKContextConnectionClient.h in Headers */,
</span><span class="cx">                                 CD5C66A1134B9D38004FE2A8 /* InjectedBundlePageFullScreenClient.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPICocoaWKWebProcessPlugInLoadDelegatehfromrev160615trunkSourceWebKit2WebProcessInjectedBundleAPImacWKWebProcessPlugInBrowserContextControllerh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h (from rev 160615, trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.h) (0 => 160616)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h                                (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h        2013-12-15 06:32:27 UTC (rev 160616)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+/*
+ * Copyright (C) 2013 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.
+ */
+#import &lt;Foundation/Foundation.h&gt;
+
+@class WKWebProcessPlugInBrowsingContextController;
+@class WKWebProcessPlugInFrame;
+@class WKWebProcessPlugInScriptWorld;
+
+@protocol WKWebProcessPlugInLoadDelegate &lt;NSObject&gt;
+@optional
+- (void)webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController*)controller didStartProvisionalLoadForFrame:(WKWebProcessPlugInFrame *)frame;
+- (void)webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController*)controller didFinishLoadForFrame:(WKWebProcessPlugInFrame *)frame;
+- (void)webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController*)controller globalObjectIsAvailableForFrame:(WKWebProcessPlugInFrame *)frame inScriptWorld:(WKWebProcessPlugInScriptWorld *)scriptWorld;
+@end
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPImacWKWebProcessPlugInBrowserContextControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.h (160615 => 160616)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.h        2013-12-15 06:20:05 UTC (rev 160615)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.h        2013-12-15 06:32:27 UTC (rev 160616)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> 
</span><span class="cx"> @class WKDOMDocument;
</span><span class="cx"> @class WKDOMRange;
</span><ins>+@protocol WKWebProcessPlugInLoadDelegate;
</ins><span class="cx"> 
</span><span class="cx"> WK_API_CLASS
</span><span class="cx"> @interface WKWebProcessPlugInBrowserContextController : NSObject
</span><span class="lines">@@ -39,6 +40,8 @@
</span><span class="cx"> 
</span><span class="cx"> @property(readonly) WKDOMRange *selectedRange;
</span><span class="cx"> 
</span><ins>+@property (weak) id &lt;WKWebProcessPlugInLoadDelegate&gt; loadDelegate;
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #endif // WK_API_ENABLED
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPImacWKWebProcessPlugInBrowserContextControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm (160615 => 160616)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm        2013-12-15 06:20:05 UTC (rev 160615)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm        2013-12-15 06:32:27 UTC (rev 160616)
</span><span class="lines">@@ -34,7 +34,11 @@
</span><span class="cx"> #import &quot;WKBundlePagePrivate.h&quot;
</span><span class="cx"> #import &quot;WKDOMInternals.h&quot;
</span><span class="cx"> #import &quot;WKRetainPtr.h&quot;
</span><ins>+#import &quot;WKWebProcessPluginFrameInternal.h&quot;
</ins><span class="cx"> #import &quot;WKWebProcessPlugInInternal.h&quot;
</span><ins>+#import &quot;WKWebProcessPlugInLoadDelegate.h&quot;
+#import &quot;WKWebProcessPlugInScriptWorldInternal.h&quot;
+#import &quot;WeakObjCPtr.h&quot;
</ins><span class="cx"> #import &quot;WebPage.h&quot;
</span><span class="cx"> #import &quot;WebProcess.h&quot;
</span><span class="cx"> #import &lt;WebCore/Document.h&gt;
</span><span class="lines">@@ -45,8 +49,65 @@
</span><span class="cx"> 
</span><span class="cx"> @implementation WKWebProcessPlugInBrowserContextController {
</span><span class="cx">     API::ObjectStorage&lt;WebPage&gt; _page;
</span><ins>+    WeakObjCPtr&lt;id &lt;WKWebProcessPlugInLoadDelegate&gt;&gt; _loadDelegate;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static void didStartProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userDataRef, const void *clientInfo)
+{
+    WKWebProcessPlugInBrowserContextController *pluginContextController = (WKWebProcessPlugInBrowserContextController *)clientInfo;
+    auto loadDelegate = pluginContextController-&gt;_loadDelegate.get();
+
+    if ([loadDelegate respondsToSelector:@selector(webProcessPlugInBrowserContextController:didStartProvisionalLoadForFrame:)])
+        [loadDelegate webProcessPlugInBrowserContextController:pluginContextController didStartProvisionalLoadForFrame:wrapper(*toImpl(frame))];
+}
+
+static void didFinishLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo)
+{
+    WKWebProcessPlugInBrowserContextController *pluginContextController = (WKWebProcessPlugInBrowserContextController *)clientInfo;
+    auto loadDelegate = pluginContextController-&gt;_loadDelegate.get();
+
+    if ([loadDelegate respondsToSelector:@selector(webProcessPlugInBrowserContextController:didFinishLoadForFrame:)])
+        [loadDelegate webProcessPlugInBrowserContextController:pluginContextController didFinishLoadForFrame:wrapper(*toImpl(frame))];
+}
+
+static void globalObjectIsAvailableForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleScriptWorldRef scriptWorld, const void* clientInfo)
+{
+    WKWebProcessPlugInBrowserContextController *pluginContextController = (WKWebProcessPlugInBrowserContextController *)clientInfo;
+    auto loadDelegate = pluginContextController-&gt;_loadDelegate.get();
+
+    if ([loadDelegate respondsToSelector:@selector(webProcessPlugInBrowserContextController:globalObjectIsAvailableForFrame:inScriptWorld:)])
+        [loadDelegate webProcessPlugInBrowserContextController:pluginContextController globalObjectIsAvailableForFrame:wrapper(*toImpl(frame)) inScriptWorld:wrapper(*toImpl(scriptWorld))];
+}
+
+static void setUpPageLoaderClient(WKWebProcessPlugInBrowserContextController *contextController, WebPage&amp; page)
+{
+    WKBundlePageLoaderClientV7 client;
+    memset(&amp;client, 0, sizeof(client));
+
+    client.base.version = 7;
+    client.base.clientInfo = contextController;
+    client.didStartProvisionalLoadForFrame = didStartProvisionalLoadForFrame;
+    client.didFinishLoadForFrame = didFinishLoadForFrame;
+    client.globalObjectIsAvailableForFrame = globalObjectIsAvailableForFrame;
+
+    page.initializeInjectedBundleLoaderClient(&amp;client.base);
+}
+
+- (id &lt;WKWebProcessPlugInLoadDelegate&gt;)loadDelegate
+{
+    return _loadDelegate.getAutoreleased();
+}
+
+- (void)setLoadDelegate:(id &lt;WKWebProcessPlugInLoadDelegate&gt;)loadDelegate
+{
+    _loadDelegate = loadDelegate;
+
+    if (loadDelegate)
+        setUpPageLoaderClient(self, *_page);
+    else
+        _page-&gt;initializeInjectedBundleLoaderClient(nullptr);
+}
+
</ins><span class="cx"> - (void)dealloc
</span><span class="cx"> {
</span><span class="cx">     _page-&gt;~WebPage();
</span></span></pre>
</div>
</div>

</body>
</html>