25 |
mode: "stream", |
mode: "stream", |
26 |
pingtimeout: 20000, |
pingtimeout: 20000, |
27 |
pingtimer: null, |
pingtimer: null, |
28 |
pollfreq: 5000, |
pollfreq: 3000, |
29 |
port: 80, |
port: 80, |
30 |
polltimeout: 30000, |
polltimeout: 30000, |
31 |
recvtimes: [], |
recvtimes: [], |
36 |
ifr.p = Meteor.process; |
ifr.p = Meteor.process; |
37 |
ifr.r = Meteor.reset; |
ifr.r = Meteor.reset; |
38 |
ifr.eof = Meteor.eof; |
ifr.eof = Meteor.eof; |
39 |
|
ifr.ch = Meteor.channelInfo; |
40 |
clearTimeout(Meteor.frameloadtimer); |
clearTimeout(Meteor.frameloadtimer); |
41 |
Meteor.setstatus(4); |
Meteor.setstatus(4); |
42 |
Meteor.log("Frame registered"); |
Meteor.log("Frame registered"); |
92 |
|
|
93 |
disconnect: function() { |
disconnect: function() { |
94 |
if (Meteor.status) { |
if (Meteor.status) { |
|
if (typeof(Meteor.frameref)=="iframe") Meteor.frameref.setAttribute("src", "about:blank"); |
|
|
Meteor.frameref = null; |
|
95 |
clearTimeout(Meteor.pingtimer); |
clearTimeout(Meteor.pingtimer); |
96 |
clearTimeout(Meteor.updatepollfreqtimer); |
clearTimeout(Meteor.updatepollfreqtimer); |
97 |
clearTimeout(Meteor.frameloadtimer); |
clearTimeout(Meteor.frameloadtimer); |
125 |
}, |
}, |
126 |
|
|
127 |
loadFrame: function(url) { |
loadFrame: function(url) { |
|
Meteor.frameref = null; |
|
128 |
try { |
try { |
129 |
var transferDoc = new ActiveXObject("htmlfile"); |
if (!Meteor.frameref) { |
130 |
transferDoc.open(); |
var transferDoc = new ActiveXObject("htmlfile"); |
131 |
transferDoc.write("<html><script>"); |
Meteor.frameref = transferDoc; |
132 |
transferDoc.write("document.domain=\""+(document.domain)+"\";"); |
} |
133 |
transferDoc.write("</"+"script></html>"); |
Meteor.frameref.open(); |
134 |
transferDoc.parentWindow.Meteor = Meteor; |
Meteor.frameref.write("<html><script>"); |
135 |
transferDoc.close(); |
Meteor.frameref.write("document.domain=\""+(document.domain)+"\";"); |
136 |
var ifrDiv = transferDoc.createElement("div"); |
Meteor.frameref.write("</"+"script></html>"); |
137 |
transferDoc.appendChild(ifrDiv); |
Meteor.frameref.parentWindow.Meteor = Meteor; |
138 |
|
Meteor.frameref.close(); |
139 |
|
var ifrDiv = Meteor.frameref.createElement("div"); |
140 |
|
Meteor.frameref.appendChild(ifrDiv); |
141 |
ifrDiv.innerHTML = "<iframe src=\""+url+"\"></iframe>"; |
ifrDiv.innerHTML = "<iframe src=\""+url+"\"></iframe>"; |
|
Meteor.frameref = transferDoc; |
|
142 |
} catch (e) { |
} catch (e) { |
143 |
var ifr = document.createElement("IFRAME"); |
if (!Meteor.frameref) { |
144 |
ifr.style.width = "10px"; |
var ifr = document.createElement("IFRAME"); |
145 |
ifr.style.height = "10px"; |
ifr.style.width = "10px"; |
146 |
ifr.style.border = "none"; |
ifr.style.height = "10px"; |
147 |
ifr.style.position = "absolute"; |
ifr.style.border = "none"; |
148 |
ifr.style.top = "-10px"; |
ifr.style.position = "absolute"; |
149 |
ifr.style.marginTop = "-10px"; |
ifr.style.top = "-10px"; |
150 |
ifr.style.zIndex = "-20"; |
ifr.style.marginTop = "-10px"; |
151 |
ifr.Meteor = Meteor; |
ifr.style.zIndex = "-20"; |
152 |
ifr.setAttribute("src", url); |
ifr.Meteor = Meteor; |
153 |
document.body.appendChild(ifr); |
document.body.appendChild(ifr); |
154 |
Meteor.frameref = ifr; |
Meteor.frameref = ifr; |
155 |
|
} |
156 |
|
Meteor.frameref.setAttribute("src", url); |
157 |
} |
} |
158 |
Meteor.log("Loading URL '"+url+"' into frame..."); |
Meteor.log("Loading URL '"+url+"' into frame..."); |
159 |
Meteor.frameloadtimer = setTimeout(Meteor.frameloadtimeout, 5000); |
Meteor.frameloadtimer = setTimeout(Meteor.frameloadtimeout, 5000); |
163 |
Meteor.log("Ping timeout"); |
Meteor.log("Ping timeout"); |
164 |
Meteor.mode="smartpoll"; |
Meteor.mode="smartpoll"; |
165 |
clearTimeout(Meteor.pingtimer); |
clearTimeout(Meteor.pingtimer); |
|
Meteor.connect(); |
|
166 |
Meteor.callbacks["changemode"]("poll"); |
Meteor.callbacks["changemode"]("poll"); |
167 |
Meteor.lastpingtime = false; |
Meteor.lastpingtime = false; |
168 |
|
Meteor.connect(); |
169 |
}, |
}, |
170 |
|
|
171 |
process: function(id, channel, data) { |
process: function(id, channel, data) { |
172 |
if (id == -1) { |
if (id == -1) { |
173 |
Meteor.log("Ping"); |
Meteor.log("Ping"); |
174 |
Meteor.ping(); |
Meteor.ping(); |
175 |
} else if (typeof(Meteor.channels[channel]) != "undefined" && id > Meteor.channels[channel].lastmsgreceived) { |
} else if (typeof(Meteor.channels[channel]) != "undefined") { |
176 |
Meteor.log("Message "+id+" received on channel "+channel+" (last id on channel: "+Meteor.channels[channel].lastmsgreceived+")\n"+data); |
Meteor.log("Message "+id+" received on channel "+channel+" (last id on channel: "+Meteor.channels[channel].lastmsgreceived+")\n"+data); |
177 |
Meteor.callbacks["process"](data); |
Meteor.callbacks["process"](data); |
178 |
Meteor.channels[channel].lastmsgreceived = id; |
Meteor.channels[channel].lastmsgreceived = id; |
208 |
|
|
209 |
eof: function() { |
eof: function() { |
210 |
Meteor.callbacks["eof"](); |
Meteor.callbacks["eof"](); |
211 |
|
Meteor.disconnect(); |
212 |
|
}, |
213 |
|
|
214 |
|
channelInfo: function(channel, id) { |
215 |
|
Meteor.channels[channel].lastmsgreceived = id; |
216 |
|
Meteor.log("Received channel info for channel "+channel+": resume from "+id); |
217 |
}, |
}, |
218 |
|
|
219 |
updatepollfreq: function() { |
updatepollfreq: function() { |
249 |
Meteor.log("Frame load timeout"); |
Meteor.log("Frame load timeout"); |
250 |
if (Meteor.frameloadtimer) clearTimeout(Meteor.frameloadtimer); |
if (Meteor.frameloadtimer) clearTimeout(Meteor.frameloadtimer); |
251 |
Meteor.setstatus(3); |
Meteor.setstatus(3); |
252 |
setTimeout(Meteor.connect, 5000); |
Meteor.pollmode(); |
253 |
}, |
}, |
254 |
|
|
255 |
extract_xss_domain: function(old_domain) { |
extract_xss_domain: function(old_domain) { |