| Index: ppapi/native_client/src/trusted/plugin/plugin.cc
|
| ===================================================================
|
| --- ppapi/native_client/src/trusted/plugin/plugin.cc (revision 115018)
|
| +++ ppapi/native_client/src/trusted/plugin/plugin.cc (working copy)
|
| @@ -866,7 +866,10 @@
|
|
|
| const char* const Plugin::kNaClMIMEType = "application/x-nacl";
|
|
|
| -bool Plugin::IsForeignMIMEType() const {
|
| +bool Plugin::NexeIsContentHandler() const {
|
| + // Tests if the MIME type is not a NaCl MIME type.
|
| + // If the MIME type is foreign, then this NEXE is being used as a content
|
| + // type handler rather than directly by an HTML document.
|
| return
|
| !mime_type().empty() &&
|
| mime_type() != kNaClMIMEType;
|
| @@ -936,10 +939,14 @@
|
| }
|
|
|
| const char* manifest_url = LookupArgument(kSrcManifestAttribute);
|
| - // If the MIME type is foreign, then 'src' will be the URL for the content
|
| - // and 'nacl' will be the URL for the manifest.
|
| - if (IsForeignMIMEType()) {
|
| + if (NexeIsContentHandler()) {
|
| + // For content handlers 'src' will be the URL for the content
|
| + // and 'nacl' will be the URL for the manifest.
|
| manifest_url = LookupArgument(kNaClManifestAttribute);
|
| + // For content handlers the NEXE runs in the security context of the
|
| + // content it is rendering and the NEXE itself appears to be a
|
| + // cross-origin resource stored in a Chrome extension. We request
|
| + // universal access during the NEXE load so that we can read the NEXE.
|
| }
|
| // Use the document URL as the base for resolving relative URLs to find the
|
| // manifest. This takes into account the setting of <base> tags that
|
| @@ -1636,6 +1643,7 @@
|
| CHECK(
|
| nexe_downloader_.Open(program_url,
|
| DOWNLOAD_TO_FILE,
|
| + NexeIsContentHandler(),
|
| open_callback,
|
| &UpdateDownloadProgress));
|
| return;
|
| @@ -1677,6 +1685,7 @@
|
| // Will always call the callback on success or failure.
|
| CHECK(nexe_downloader_.Open(nmf_resolved_url.AsString(),
|
| DOWNLOAD_TO_BUFFER,
|
| + NexeIsContentHandler(),
|
| open_callback,
|
| NULL));
|
| } else {
|
| @@ -1685,6 +1694,7 @@
|
| // Will always call the callback on success or failure.
|
| CHECK(nexe_downloader_.Open(nmf_resolved_url.AsString(),
|
| DOWNLOAD_TO_FILE,
|
| + NexeIsContentHandler(),
|
| open_callback,
|
| NULL));
|
| }
|
| @@ -1755,8 +1765,10 @@
|
|
|
|
|
| bool Plugin::StreamAsFile(const nacl::string& url,
|
| + bool permits_extension_urls,
|
| PP_CompletionCallback callback) {
|
| - PLUGIN_PRINTF(("Plugin::StreamAsFile (url='%s')\n", url.c_str()));
|
| + PLUGIN_PRINTF(("Plugin::StreamAsFile (url='%s', permits_extension_urls=%d)\n",
|
| + url.c_str(), permits_extension_urls));
|
| FileDownloader* downloader = new FileDownloader();
|
| downloader->Initialize(this);
|
| url_downloaders_.insert(downloader);
|
| @@ -1777,6 +1789,7 @@
|
| // If true, will always call the callback on success or failure.
|
| return downloader->Open(url,
|
| DOWNLOAD_TO_FILE,
|
| + permits_extension_urls || NexeIsContentHandler(),
|
| open_callback,
|
| &UpdateDownloadProgress);
|
| }
|
|
|