3 Make sure prerendered page load NaCl plugins when it's enabled.
6 <title>Prerender NaCl Enabled
</title>
11 var readyToSendResult
= false;
12 var pluginLoadStarted
= false;
15 * Sends true if |readyToSendResult| and |pluginLoadStarted| are both true.
16 * Otherwise, does nothing.
18 function sendResult() {
19 if (!readyToSendResult
|| !pluginLoadStarted
)
21 window
.domAutomationController
.send(true);
22 readyToSendResult
= false;
25 function eventListener(event
) {
26 var targetElement
= event
.target
;
27 if (event
.target
.id
!= 'naclPlugin')
29 pluginLoadStarted
= true;
33 document
.body
.addEventListener('loadstart', eventListener
, true);
35 function DidPrerenderPass() {
36 return !pluginLoadStarted
;
39 function DidDisplayPass() {
44 * It's possible for DidDisplayPass to be called before the loadstart event
45 * happens, since the loadstart event is posted asynchronously when a plugin
46 * loads. As a result, we need to wait until we've seen both the loadstart
47 * event and been called from the browser process before we can safely send
50 function DidDisplayReallyPass() {
51 readyToSendResult
= true;
56 <embed id=
"naclPlugin" type=
"application/x-nacl" src=
"dummy.nmf"></embed>