Changeset 86516 in webkit


Ignore:
Timestamp:
May 15, 2011 5:53:59 PM (13 years ago)
Author:
andersca@apple.com
Message:

2011-05-15 Anders Carlsson <andersca@apple.com>

Reviewed by Geoffrey Garen.

Pass the document URL and toplevel document URL when creating a plug-in
https://bugs.webkit.org/show_bug.cgi?id=60863

This is the first of a series of patches intended to reduce the IPC traffic
during plug-in instantiation.

  • WebProcess/Plugins/Plugin.cpp: (WebKit::Plugin::Parameters::encode): Encode the URLs.

(WebKit::Plugin::Parameters::decode):
Decode the URLs.

  • WebProcess/Plugins/Plugin.h: Add the document and toplevel document URLs.
  • WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::createPlugin): Initialize the document and toplevel document URLs.
Location:
trunk/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r86499 r86516  
     12011-05-15  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Geoffrey Garen.
     4
     5        Pass the document URL and toplevel document URL when creating a plug-in
     6        https://bugs.webkit.org/show_bug.cgi?id=60863
     7
     8        This is the first of a series of patches intended to reduce the IPC traffic
     9        during plug-in instantiation.
     10
     11        * WebProcess/Plugins/Plugin.cpp:
     12        (WebKit::Plugin::Parameters::encode):
     13        Encode the URLs.
     14
     15        (WebKit::Plugin::Parameters::decode):
     16        Decode the URLs.
     17
     18        * WebProcess/Plugins/Plugin.h:
     19        Add the document and toplevel document URLs.
     20
     21        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
     22        (WebKit::WebFrameLoaderClient::createPlugin):
     23        Initialize the document and toplevel document URLs.
     24
    1252011-05-13  Oliver Hunt  <oliver@apple.com>
    226
  • trunk/Source/WebKit2/WebProcess/Plugins/Plugin.cpp

    r76916 r86516  
    4040    encoder->encode(mimeType);
    4141    encoder->encode(loadManually);
     42    encoder->encode(documentURL);
     43    encoder->encode(toplevelDocumentURL);
    4244}
    4345
     
    5759        return false;
    5860    if (!decoder->decode(parameters.loadManually))
     61        return false;
     62    if (!decoder->decode(parameters.documentURL))
     63        return false;
     64    if (!decoder->decode(parameters.toplevelDocumentURL))
    5965        return false;
    6066
  • trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h

    r86467 r86516  
    6161        String mimeType;
    6262        bool loadManually;
     63
     64        // The URL of the document that the plug-in is in.
     65        String documentURL;
     66
     67        // The URL of the document in the main frame. Will be null if the document the plug-in
     68        // doesn't have access to the main frame document.
     69        String toplevelDocumentURL;
    6370
    6471        void encode(CoreIPC::ArgumentEncoder*) const;
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r85785 r86516  
    11991199}
    12001200
     1201static String documentURL(Frame* frame)
     1202{
     1203    const KURL& url = frame->document()->url();
     1204    return url.hasPath() ? url.prettyURL() : url.prettyURL() + "/";
     1205}
     1206
    12011207PassRefPtr<Widget> WebFrameLoaderClient::createPlugin(const IntSize&, HTMLPlugInElement* pluginElement, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually)
    12021208{
     
    12121218    parameters.mimeType = mimeType;
    12131219    parameters.loadManually = loadManually;
     1220    parameters.documentURL = documentURL(m_frame->coreFrame());
     1221
     1222    Frame* mainFrame = webPage->mainFrame()->coreFrame();
     1223    if (m_frame->coreFrame() == mainFrame)
     1224        parameters.toplevelDocumentURL = parameters.documentURL;
     1225    else if (m_frame->coreFrame()->document()->securityOrigin()->canAccess(mainFrame->document()->securityOrigin())) {
     1226        // We only want to set the toplevel document URL if the plug-in has access to it.
     1227        parameters.toplevelDocumentURL = documentURL(mainFrame);
     1228    }
    12141229
    12151230    // <rdar://problem/8440903>: AppleConnect has a bug where it does not
Note: See TracChangeset for help on using the changeset viewer.