Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
renderjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
renderjs
Commits
04733133
Commit
04733133
authored
Jun 04, 2013
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix no type in postMessage can pass renderjs
parent
cf8b64e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
33 deletions
+38
-33
renderjs.js
renderjs.js
+38
-33
No files found.
renderjs.js
View file @
04733133
...
...
@@ -54,6 +54,9 @@
// http://bit.ly/WH2TRI
// http://bit.ly/zm0Csi
// URI-templates:
// https://code.google.com/p/uri-templates/
/*jslint indent: 2, maxlen: 80, nomen: true */
/*global window: true, $: true, undefined: true, console: true,
document: true, require: true*/
...
...
@@ -517,40 +520,42 @@
// => manages all interactions (listens to incoming postMessages)
// need a switch, because only one "message" listener can be set
priv
.
serviceHandler
=
function
(
event
)
{
var
route
=
event
.
data
.
type
.
split
(
"
/
"
),
trackingId
;
// authenticate all message senders
// basic "authentication" is done through the switch, which requires
// a matching type to be passed - still the incoming URL should be
// authenticated, too, plus preferably another ticket-authentication.
// route
switch
(
route
[
0
])
{
case
"
service
"
:
priv
.
registerNewService
(
event
);
break
;
case
"
request
"
:
trackingId
=
priv
.
generateUuid
();
// track this request, so we know where to send the response
priv
.
trackRequest
(
trackingId
,
event
.
originalTarget
);
// request the service
priv
.
requestServiceFromGadget
(
event
,
trackingId
);
break
;
case
"
tree
"
:
if
(
route
[
1
]
===
"
update
"
)
{
priv
.
addGadgetToTree
(
event
.
data
.
options
,
that
.
gadgetTree
);
var
type
=
event
.
data
.
type
,
route
,
trackingId
;
if
(
type
)
{
route
=
event
.
data
.
type
.
split
(
"
/
"
);
// authenticate all message senders
// basic "authentication" is done through the switch, which requires
// a matching type to be passed - still the incoming URL should be
// authenticated, too, plus preferably another ticket-authentication.
// route
switch
(
route
[
0
])
{
case
"
service
"
:
priv
.
registerNewService
(
event
);
break
;
case
"
request
"
:
trackingId
=
priv
.
generateUuid
();
// track this request, so we know where to send the response
priv
.
trackRequest
(
trackingId
,
event
.
originalTarget
);
// request the service
priv
.
requestServiceFromGadget
(
event
,
trackingId
);
break
;
case
"
tree
"
:
if
(
route
[
1
]
===
"
update
"
)
{
priv
.
addGadgetToTree
(
event
.
data
.
options
,
that
.
gadgetTree
);
}
break
;
case
"
run
"
:
priv
.
runService
(
event
);
break
;
case
"
result
"
:
priv
.
sendServiceReply
(
event
);
break
;
case
"
reply
"
:
priv
.
returnResult
(
event
);
break
;
}
break
;
case
"
run
"
:
priv
.
runService
(
event
);
break
;
case
"
result
"
:
priv
.
sendServiceReply
(
event
);
break
;
case
"
reply
"
:
priv
.
returnResult
(
event
);
break
;
}
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment