<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>48367</bug_id>
          
          <creation_ts>2010-10-26 12:49:14 -0700</creation_ts>
          <short_desc>Post any pending messages to the Injected Bundle in WebContext::processDidFinishLaunching instead of in WebContext::ensureWebProcess</short_desc>
          <delta_ts>2010-10-26 13:53:05 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit2</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jessie Berlin">jberlin</reporter>
          <assigned_to name="Jessie Berlin">jberlin</assigned_to>
          <cc>andersca</cc>
    
    <cc>jberlin</cc>
    
    <cc>sam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>299733</commentid>
    <comment_count>0</comment_count>
    <who name="Jessie Berlin">jberlin</who>
    <bug_when>2010-10-26 12:49:14 -0700</bug_when>
    <thetext>We currently post those pending Injected Bundle messages in WebContext::ensureWebProcess.

However it is possible for messages to be sent to WebContext::postMessageToInjectedBundle in between the call to ensureWebProcess and the asychronous callback that results in WebProcessProxy::didFinishLaunching being called.

During that time, the WebProcessProxy is invalid so messages in WebContext::postMessageToInjectedBundle get added to the m_pendingMessagesToPostToInjectedBundle and will never actually be sent.

Instead, we should wait for the process to finish launching before we post the pending messages to the Injected Bundle (in WebContext::processDidFinishLaunching).

&lt;rdar://problem/8595623&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>299739</commentid>
    <comment_count>1</comment_count>
      <attachid>71931</attachid>
    <who name="Jessie Berlin">jberlin</who>
    <bug_when>2010-10-26 12:53:15 -0700</bug_when>
    <thetext>Created attachment 71931
Post pending messages to the Injected Bundle in WebContext::processDidFinishLaunching</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>299764</commentid>
    <comment_count>2</comment_count>
      <attachid>71931</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2010-10-26 13:30:42 -0700</bug_when>
    <thetext>Comment on attachment 71931
Post pending messages to the Injected Bundle in WebContext::processDidFinishLaunching

View in context: https://bugs.webkit.org/attachment.cgi?id=71931&amp;action=review

&gt; WebKit2/UIProcess/WebContext.cpp:192
&gt; +        pair&lt;String, RefPtr&lt;APIObject&gt; &gt;* message = &amp;m_pendingMessagesToPostToInjectedBundle[i];
&gt; +        m_process-&gt;send(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(message-&gt;first, WebContextUserMessageEncoder(message-&gt;second.get())));

You are just moving this code, and didn’t write it. I would have used a reference instead of a pointer here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>299772</commentid>
    <comment_count>3</comment_count>
    <who name="Jessie Berlin">jberlin</who>
    <bug_when>2010-10-26 13:40:09 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; (From update of attachment 71931 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=71931&amp;action=review
&gt; 
&gt; &gt; WebKit2/UIProcess/WebContext.cpp:192
&gt; &gt; +        pair&lt;String, RefPtr&lt;APIObject&gt; &gt;* message = &amp;m_pendingMessagesToPostToInjectedBundle[i];
&gt; &gt; +        m_process-&gt;send(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(message-&gt;first, WebContextUserMessageEncoder(message-&gt;second.get())));
&gt; 
&gt; You are just moving this code, and didn’t write it. I would have used a reference instead of a pointer here.

Actually, I believe that was me in http://trac.webkit.org/changeset/67593.

Changed to be:

pair&lt;String, RefPtr&lt;APIObject&gt; &gt;&amp; message = m_pendingMessagesToPostToInjectedBundle[i];
m_process-&gt;send(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(message.first, WebContextUserMessageEncoder(message.second.get())));

Thanks for the review!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>299781</commentid>
    <comment_count>4</comment_count>
      <attachid>71931</attachid>
    <who name="Jessie Berlin">jberlin</who>
    <bug_when>2010-10-26 13:52:59 -0700</bug_when>
    <thetext>Comment on attachment 71931
Post pending messages to the Injected Bundle in WebContext::processDidFinishLaunching

Committed in r70568
http://trac.webkit.org/changeset/70568</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>71931</attachid>
            <date>2010-10-26 12:53:15 -0700</date>
            <delta_ts>2010-10-26 13:52:59 -0700</delta_ts>
            <desc>Post pending messages to the Injected Bundle in WebContext::processDidFinishLaunching</desc>
            <filename>postPendingMessagesInProcessDidFinishLaunching.patch</filename>
            <type>text/plain</type>
            <size>2442</size>
            <attacher name="Jessie Berlin">jberlin</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYktpdDIvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYktpdDIvQ2hhbmdlTG9n
CShyZXZpc2lvbiA3MDU1NSkKKysrIFdlYktpdDIvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMjAgQEAKKzIwMTAtMTAtMjYgIEplc3NpZSBCZXJsaW4gIDxqYmVybGluQGFwcGxl
LmNvbT4KKworICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFkgKE9PUFMhKS4KKworICAgICAgICBQ
b3N0IGFueSBwZW5kaW5nIG1lc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