This file is indexed.

/usr/share/libgda-4.0/web/mouseirb_2.js is in libgda-4.0-common 4.2.8-2build1.

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
//
// Copyright (c) 2008 why the lucky stiff
// 
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
// SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
// OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//

/* Irb running moush */
MouseApp.Irb = function(element, options) {
  this.element = $(element);
  this.setOptions(options);
  this.showHelp = this.options.showHelp;
  if ( this.options.showChapter ) {
      this.showChapter = this.options.showChapter;
  }
  if ( this.options.init ) {
      this.init = this.options.init;
  }
  this.initWindow();
  this.setup();
  this.helpPage = null;
  this.irbInit = false;
};

$.extend(MouseApp.Irb.prototype, MouseApp.Terminal.prototype, {
    cmdToQuery: function(cmd) {
        return "cmd=" + escape(cmd.replace(/&lt;/g, '<').replace(/&gt;/g, '>').
            replace(/&amp;/g, '&').replace(/\r?\n/g, "\n")).replace(/\+/g, "%2B") +
	    "&cid=" + this.options.gdaid;
    },

    fireOffCmd: function(cmd, func) {
      var irb = this;
          $.ajax({url: this.options.irbUrl + "?" + this.cmdToQuery(cmd), type: "GET", 
            complete: func});
    },

    reply: function(str) {
        var raw = str.replace(/\033\[(\d);(\d+)m/g, '');
        this.checkAnswer(raw);
        if (!str.match(/^(\.\.)+$/)) {
            if ( str[str.length - 1] != "\n" ) {
                str += "\n";
            }
            js_payload = /\033\[1;JSm(.*)\033\[m/;
            js_in = str.match(js_payload);
            if (js_in) {
                try {
                    js_in = eval(js_in[1]);
                } catch (e) {}
                str = str.replace(js_payload, '');
            }
            var pr_re = new RegExp("(^|\\n)=>");
            if ( str.match( pr_re ) ) {
              str = str.replace(new RegExp("(^|\\n)=>"), "$1\033[1;34m=>\033[m");
            } else {
              str = str.replace(new RegExp("(^|\\n)= (.+?) ="), "$1\033[1;33m$2\033[m");
            }
	    if (str.search(/^</) != -1) {
		    var irbdiv = $("#irb");
		    $("#irb div:last-child").hide();
		    var table = $("<div class=\"tcontents\">"+str+"</div>");
		    table.children(":first").children(":first").attr("class","ctable");
		    var folded = $("<div></div>");
		    var nbrows = table.children(":first").children(":last");
		    nbrows.appendTo(folded);
		    nbrows.css("margin","0");
		    irbdiv.append(table);
		    table.dblclick(function() {table.hide(); folded.show();});
		    
		    irbdiv.append(folded);
		    folded.hide();
		    folded.dblclick(function() {table.show(); folded.hide();});

		    this.cursorOff();
		    this.advanceLine();
		    this.cursorOn();
	    }
            else
            this.write(str);
            this.prompt();
        } else {
            this.prompt("\033[1;32m" + ".." + "\033[m", true);
            this.puts(str.replace(/\./g, ' '), 0);
        }
    },

    setHelpPage: function(n, page) {
        if (this.helpPage)
          $(this.helpPage.ele).hide('fast');
        this.helpPage = {index: n, ele: page};
        match = this.scanHelpPageFor('load');
        if (match != -1)
        {
          this.fireOffCmd(match, (function(r) {
            $(page).show('fast');
          }));
        }
        else
        {
          $(page).show('fast');
        }
    },

    scanHelpPageFor: function(eleClass) {
        match = $("div." + eleClass, this.helpPage.ele);
        if ( match[0] ) return match[0].innerHTML;
        else            return -1;
    },

    checkAnswer: function(str) {
        if ( this.helpPage ) {
            match = this.scanHelpPageFor('answer');
            if ( match != -1 ) {
                if ( str.match( new RegExp('^\s*=> ' + match + '\s*$', 'm') ) ) {
                    this.showHelp(this.helpPage.index + 1);
                }
            } else {
                match = this.scanHelpPageFor('stdout');
                if ( match != -1 ) {
                    if ( match == '' ) {
                        if ( str == '' || str == null ) this.showHelp(this.helpPage.index + 1);
                    } else if ( str.match( new RegExp('^\s*' + match + '$', 'm') ) ) {
                        this.showHelp(this.helpPage.index + 1);
                    }
                }
            }
        }
    },

    onKeyCtrld: function() {
        this.clearCommand();
        this.puts("reset");
        this.onKeyEnter();
    },

    onKeyEnter: function() {
        this.typingOff();
        var cmd = this.getCommand();
        if (cmd) {
            this.history[this.historyNum] = cmd;
            this.backupNum = ++this.historyNum;
        }
        this.commandNum++;
        this.advanceLine();
        if (cmd) {
            if ( cmd == "clear" ) {
                this.clear();
                this.prompt();
            } else if ( cmd.match(/^(back)$/) ) {
                if (this.helpPage && this.helpPage.index >= 1) {
                    this.showHelp(this.helpPage.index - 1);
                }
                this.prompt();
            } else if ( cmd.match(/^(next)$/) ) {
                if (this.helpPage) {
                    this.showHelp(this.helpPage.index + 1);
                }
                this.prompt();
            } else if ( cmd.match(/^(help|wtf\?*)$/) ) {
                this.showHelp(1);
                this.prompt();
            } else if ( regs = cmd.match(/^(help|wtf\?*)\s+#?(\d+)\s*$/) ) {
                this.showChapter(parseInt(regs[2]));
                this.prompt();
            } else {
                var term = this;
                this.fireOffCmd(cmd, (function(r) {
					//term.reply(r.responseText ? r.responseText : ''); 
					var xmlDoc=r.responseXML.documentElement;
					var txt;
					if (xmlDoc.getElementsByTagName("cmde")[0].childNodes[0]) {
						// it appears Firefox and some others split long text nodes into several
						// smaller chunks of 4kb, so we need to get all of them.
						txt="";
						for (i = 0; i < xmlDoc.getElementsByTagName("cmde")[0].childNodes.length; i++)
							txt += xmlDoc.getElementsByTagName("cmde")[0].childNodes[i].nodeValue
					}
 					var pt = xmlDoc.getElementsByTagName("prompt")[0].childNodes[0].nodeValue;
 					term.reply(txt ? txt: '', pt ? pt : null);
				}));
            }
        } else {
            this.prompt();
        }
    }
});