3
3
4
4
var localport = '8080'
5
5
var localhost = 'localhost:' + localport ;
6
- var weblocs = [ / ^ h t t p s : \/ \/ g l o w s c r i p t \. o r g $ / , // put a couple of these explicitly in the list just in case.
6
+ var weblocs = [
7
+ / ^ h t t p s : \/ \/ g l o w s c r i p t \. o r g $ / , // put a couple of these explicitly in the list just in case.
7
8
/ ^ h t t p s : \/ \/ w w w \. g l o w s c r i p t \. o r g $ / ,
9
+ / ^ h t t p s : \/ \/ d e v b a s h e r w o \. o r g $ / , // put a couple of these explicitly in the list just in case.
10
+ / ^ h t t p s : \/ \/ w w w \. d e v b a s h e r w o \. o r g $ / ,
8
11
new RegExp ( "^http:\/\/" + localhost + "$" ) ,
9
12
/ ^ h t t p s : \/ \/ H O S T _ N A M E _ T E M P L A T E $ /
10
13
]
@@ -197,12 +200,12 @@ function ideRun() {
197
200
send ( { ready :true } )
198
201
function receiveMessage ( event ) {
199
202
event = event . originalEvent // originalEvent is a jquery entity
200
- let trimhost = event . origin . replace ( "sandbox." , "" ) // remove sandbox. if it's there
203
+ // let trimhost = event.origin.replace("sandbox.", "") // remove sandbox. if it's there
201
204
//trimhost = trimhost.replace("sandbox.", "") // remove www. if it's there
202
- trusted_origin = trimhost
205
+ // trusted_origin = trimhost
203
206
//console.log("in iFrame: receivedMessage from: " + event.origin)
204
207
//console.log("Setting trusted_origin:" + trusted_origin)
205
- if ( checkTrustedHosts ( trusted_origin ) ) {
208
+ if ( checkTrustedHosts ( event . origin ) ) {
206
209
// ensure that message is from glowscript
207
210
//console.log("rejecting origin!")
208
211
return
@@ -213,6 +216,12 @@ function ideRun() {
213
216
//console.log("in iFrame: receivedMessage: JSON parse error on " + event.data)
214
217
return
215
218
}
219
+
220
+ if ( ( trusted_origin === '*' ) && ( event . origin . search ( 'sandbox.' ) === - 1 ) ) {
221
+ trusted_origin = event . origin
222
+ //console.log("Setting trusted_origin:" + trusted_origin)
223
+ }
224
+
216
225
if ( message . program !== undefined ) {
217
226
// Determine the set of libraries to load
218
227
var progver = message . version . substr ( 0 , 3 ) // 'unp' if unpackaged
0 commit comments