This file is indexed.

/usr/share/pyshared/nevow/liveglue.js is in python-nevow 0.10.0-4build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
var nevow_clientHandleId;       /* This variable must be defined in your HTML.
                                 */

var liveevil_unload = false;
var auto_open = true;

var last_request = null;
var last_server_message_time = null;

var disconnectListeners = [];

var inputListeners = [];
var listenerId = 0;

var base_url = this.location.toString();
var queryParamIndex = base_url.indexOf('?');
var userAgent = navigator.userAgent.toLowerCase();

if (queryParamIndex != -1) {
  base_url = base_url.substring(0, queryParamIndex);
 }

if (base_url.charAt(base_url.length-1) != '/') {
  base_url += '/';
 }

base_url += 'livepage_client/'


function createRequest() {
    if (window.XMLHttpRequest) {
      req = new XMLHttpRequest();
    } else {
        req = new ActiveXObject("Microsoft.XMLHTTP")
    }
    reqObj = new Object()
    reqObj.request = req
    return reqObj
}

function connect(outputNum) {
  var xmlhttp = createRequest();
  last_request = xmlhttp.request;
  xmlhttp.request.onreadystatechange = function() {
    if (xmlhttp.request.readyState == 4) {
      if (xmlhttp.request.responseText) {
        last_server_message_time = new Date()
        eval(xmlhttp.request.responseText)
        if (!liveevil_unload && auto_open) {
          connect(outputNum + 1)
        }
      } else {
        for (var i=0; i<disconnectListeners.length; i++) {
          disconnectListeners[i]()
          disconnectListeners = []
        }
        last_request = null
      }
    }
  }
  var U = base_url + nevow_clientHandleId + "/output?outputNum=" + outputNum;
  xmlhttp.request.open("GET", U, true);
  xmlhttp.request.send(null);
}


if (userAgent.indexOf("msie") != -1) {
    /* IE specific stuff */
    /* Abort last request so we don't 'leak' connections */
    window.attachEvent("onbeforeunload", function() { if (last_request != null) {last_request.abort();} } )
    /* Set unload flag */
    window.attachEvent("onbeforeunload", function() { liveevil_unload = true; } )
} else if (document.implementation && document.implementation.createDocument) {
    /* Mozilla specific stuff (onbeforeunload is in v1.7+ only) */
    window.addEventListener("beforeunload", function() { liveevil_unload = true; }, false)
}


function listener(callWhenAllDone) {
    this.listenerId = listenerId
    listenerId += 1
    this.events = []
    this.callWhenAllDone = callWhenAllDone
    this.fired = false
    this.inputDone = function(what) {
        var found = false
        for (var i=0; i<this.events.length; i++) {
            if (this.events[i] == what) {
                this.events.splice(i, 1)
                found = true
                break
            }
        }
        if (this.events.length == 0) {
            if (this.fired) {
                alert("Tried to fire twice :(")
            } else {
                this.callWhenAllDone()
                this.fired = true
            }
        }
    }
}


function listenForInputEvents(callWhenAllDone) {
    var newListener = new listener(callWhenAllDone)
    inputListeners.push(newListener)
    return newListener
}


function stopListening(theListener) {
    for (var i=0; i<inputListeners.length; i++) {
        if (inputListeners[i] == theListener) {
            inputListeners.splice(i, 1)
            break
        }
    }
    if (theListener.events.length == 0) {
        theListener.callWhenAllDone()
    }
}

function addDisconnectListener(callback) {
    disconnectListeners.push(callback)
    return callback
}

function delDisconnectListener(theListener) {
    for (var i=0; i<disconnectListeners.length; i++) {
	if (disconnectListeners[i] == theListener){
	    disconnectListeners.splice(i, 1)
	    break
	}
    }
}

function nevow_clientToServerEvent(theTarget, evalAfterDone) {
    if (theTarget != 'close' && liveevil_unload) {
        // Server had previously closed the output; let's open it again.
        if (auto_open) {
            liveevil_unload = false }
        connect(0)
    }
    var additionalArguments = ''
    for (i = 2; i<arguments.length; i++) {
        additionalArguments += '&arguments='
        additionalArguments += encodeURIComponent(arguments[i])
    }
    var input = createRequest()
    input.request.onreadystatechange = function() {
        if (input.request.readyState == 4) {
            eval(input.request.responseText)
            if (evalAfterDone) {
               eval(evalAfterDone)
            }
            for (var i=0; i<input.events.length; i++) {
                input.events[i].inputDone(input.request)
            }
        }
    }
    input.events = []
    for (var i=0; i<inputListeners.length; i++) {
        inputListeners[i].events.push(input.request)
        input.events.push(inputListeners[i])
    }
    input.request.open(
      "GET",
      base_url +
      nevow_clientHandleId +
      "/input?" +
      "handler-path=&handler-name=" +
      encodeURIComponent(theTarget) +
      additionalArguments)

    input.request.send(null)
}

function nevow_setNode(node, to) {
    document.getElementById(node).innerHTML = to;
}

function nevow_appendNode(node, what) {
    var oldnode = document.getElementById(node);
    var newspan = document.createElement('span');
    newspan.innerHTML = what;
    for (i=0; i<newspan.childNodes.length; i++) {
        oldnode.appendChild(newspan.childNodes[i]);
    }
}

function nevow_prependNode(node, what) {
  var oldnode = document.getElementById(node);
  var newspan = document.createElement('span');
  newspan.innerHTML = what;
  for (i=newspan.childNodes.length-1; i>=0; i--){
    if (oldnode.childNodes.length == 0)
      oldnode.appendChild(newspan.childNodes[i]);
    else
      oldnode.insertBefore(newspan.childNodes[i], oldnode.childNodes[0]);
  }
}

function nevow_insertNode(node, before) {
    var oldnode = document.getElementById('before');
    var newspan = document.createElement('span');
    newspan.innerHTML = what;
    var previous = oldnode;
    for (i=0; i<newspan.childNodes.length; i++) {
        previous.parentNode.insertBefore(newspan.childNodes[i], previous);
        previous = newspan.childNodes[i];
    }
}

function nevow_closeLive(evalAfterDone) {
    // Tell connect() not to complain at us when the server closes the
    // connection with no serverToClientEvent
    liveevil_unload = true
    var old_auto_open = auto_open
    auto_open = false
    // Tell the server we know we're done, send us an empty event
    // evalAfterDone will be evalled after the server sends us an empty event
    nevow_clientToServerEvent('close', '', evalAfterDone)
    auto_open = old_auto_open
}


var server = {
    handle: function(handlerName) {
        var args = [handlerName, '']
        for (var i = 1; i < arguments.length; i++) {
            args.push(arguments[i])
        }
        nevow_clientToServerEvent.apply(this, args)
    }
};

function nevow_startLivePage() {
  if (nevow_clientHandleId == null) {
    alert('UNSUPPORTED!  USE AT YOUR OWN RISK!');
    var x = createRequest();
    x.request.onreadstatechange = function () {
      if (x.request.readyState == 4) {
        nevow_clientHandleId = x.request.responseText;
        nevow_startLivePage();
      }
    };
    x.request.open("GET", base_url + "new");
    x.request.send(null);
  } else {
    connect(0);
  }
}


var nevow_origOnLoad = window.onload;
function nevow_onLoad() {
    if (nevow_origOnLoad) {
      if(typeof(nevow_origOnLoad) == "string") {
        eval(nevow_origOnLoad);
      }
      else {
        nevow_origOnLoad();
      }
    }      
    if (auto_open) {
        nevow_startLivePage();
    }
}
window.onload = nevow_onLoad;