1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Called by the common.js module.
6 function moduleDidLoad() {
7 // The module is not hidden by default so we can easily see if the plugin
12 // Called by the common.js module.
13 function attachListeners() {
14 document.getElementById('button').addEventListener('click', loadUrl);
18 common.naclModule.postMessage('getUrl:url_loader_success.html');
21 // Called by the common.js module.
22 function handleMessage(message_event) {
23 var logEl = document.getElementById('output');
24 // Find the first line break. This separates the URL data from the
25 // result text. Note that the result text can contain any number of
26 // '\n' characters, so split() won't work here.
27 var url = message_event.data;
29 var eolPos = message_event.data.indexOf('\n');
31 url = message_event.data.substring(0, eolPos);
32 if (eolPos < message_event.data.length - 1) {
33 result = message_event.data.substring(eolPos + 1);
36 logEl.textContent += 'FULLY QUALIFIED URL: ' + url + '\n';
37 logEl.textContent += 'RESULT:\n' + result + '\n';