Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1855)

Side by Side Diff: chrome/test/data/load_pepper_plugin.html

Issue 2356053002: [HBD] Only use Plugin Content Settings for Flash. (Closed)
Patch Set: fix Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <title>Initial Title</title> 3 <title>Initial Title</title>
4 <script> 4 <script>
5 var QueryString = function() { 5 var QueryString = function() {
6 // Allows access to query parameters on the URL; e.g., given a URL like: 6 // Allows access to query parameters on the URL; e.g., given a URL like:
7 // http://<server>/my.html?test=123&bob=123 7 // http://<server>/my.html?test=123&bob=123
8 // Parameters can then be accessed via QueryString.test or QueryString.bob. 8 // Parameters can then be accessed via QueryString.test or QueryString.bob.
9 var params = {}; 9 var params = {};
10 // RegEx to split out values by &. 10 // RegEx to split out values by &.
11 var r = /([^&=]+)=?([^&]*)/g; 11 var r = /([^&=]+)=?([^&]*)/g;
12 // Lambda function for decoding extracted match values. Replaces '+' with 12 // Lambda function for decoding extracted match values. Replaces '+' with
13 // space so decodeURIComponent functions properly. 13 // space so decodeURIComponent functions properly.
14 function d(s) { return decodeURIComponent(s.replace(/\+/g, ' ')); } 14 function d(s) { return decodeURIComponent(s.replace(/\+/g, ' ')); }
15 var match; 15 var match;
16 while (match = r.exec(window.location.search.substring(1))) 16 while (match = r.exec(window.location.search.substring(1)))
17 params[d(match[1])] = d(match[2]); 17 params[d(match[1])] = d(match[2]);
18 return params; 18 return params;
19 }(); 19 }();
20 20
21 var mimeType = QueryString.mimetype; 21 var mimeType = QueryString.mimetype;
22 22
23 function inject() { 23 function inject() {
24 var child = document.createElement('div'); 24 var child = document.createElement('div');
25 child.innerHTML = '<object type="' + mimeType + '" id="plugin" border=1>' + 25 child.innerHTML = '<object type="' + mimeType + '" id="plugin" data="foo">' +
raymes 2016/09/26 08:18:29 is data="foo" needed?
tommycli 2016/09/27 18:51:06 Yes, and I added a comment.
26 ' <b>You should not see this text!</b>' + 26 ' <b>You should not see this text!</b>' +
27 '</object>'; 27 '</object>';
28 document.getElementById('content').appendChild(child); 28 document.getElementById('content').appendChild(child);
29 // Plugins are loaded synchronously during layout, so the plugin has either 29 // Plugins are loaded synchronously during layout, so the plugin has either
30 // been loaded or blocked at this point. 30 // been loaded or blocked at this point.
31 var plugin = document.getElementById('plugin'); 31 var plugin = document.getElementById('plugin');
32 try { 32 try {
33 // All Pepper plugins support postMessage(). 33 // All Pepper plugins support postMessage().
34 // If postMessage is undefined, the plugin is not loaded. 34 // If postMessage is undefined, the plugin is not loaded.
35 if (plugin.postMessage == undefined) { 35 if (plugin.postMessage == undefined) {
36 document.title = 'Not Loaded'; 36 document.title = 'Not Loaded';
37 return; 37 return;
38 } 38 }
39 39
40 plugin.postMessage('hello'); 40 plugin.postMessage('hello');
41 // If we do not get an exception, the Pepper plugin is loaded. 41 // If we do not get an exception, the Pepper plugin is loaded.
42 document.title = 'Loaded'; 42 document.title = 'Loaded';
43 } catch (e) { 43 } catch (e) {
44 var errorMessage = 'Unexpected Exception: ' + e.toString(); 44 var errorMessage = 'Unexpected Exception: ' + e.toString();
45 document.title = errorMessage; 45 document.title = errorMessage;
46 console.log(errorMessage); 46 console.log(errorMessage);
47 } 47 }
48 } 48 }
49 </script> 49 </script>
50 </head> 50 </head>
51 <body onload='inject();'> 51 <body onload='inject();'>
52 <div id='content'></div> 52 <div id='content'></div>
53 </body> 53 </body>
54 </html> 54 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698