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
Romain Courteaud
renderjs
Commits
84bcf0e9
Commit
84bcf0e9
authored
Jul 31, 2017
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Iframe: ensure all channels are OK before calling ready
parent
987147b7
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
361 additions
and
383 deletions
+361
-383
renderjs.js
renderjs.js
+345
-369
test/embedded.js
test/embedded.js
+1
-2
test/renderjs_test.js
test/renderjs_test.js
+14
-8
test/trigger_rjsready_event_on_ready_gadget.js
test/trigger_rjsready_event_on_ready_gadget.js
+1
-4
No files found.
renderjs.js
View file @
84bcf0e9
This diff is collapsed.
Click to expand it.
test/embedded.js
View file @
84bcf0e9
...
@@ -15,8 +15,7 @@
...
@@ -15,8 +15,7 @@
(
modification_dict
.
foo
===
'
bar
'
);
(
modification_dict
.
foo
===
'
bar
'
);
state_change_count
+=
1
;
state_change_count
+=
1
;
};
};
gk
.
ready
(
function
()
{
gk
.
ready
(
function
(
g
)
{
ready_called
=
true
;
ready_called
=
true
;
})
})
.
setState
(
init_state
)
.
setState
(
init_state
)
...
...
test/renderjs_test.js
View file @
84bcf0e9
...
@@ -4868,7 +4868,8 @@
...
@@ -4868,7 +4868,8 @@
// Check that declare gadget returns the gadget
// Check that declare gadget returns the gadget
var
gadget
=
new
RenderJSGadget
(),
var
gadget
=
new
RenderJSGadget
(),
acquire_called
=
false
,
acquire_called
=
false
,
url
=
"
./embedded.html
"
;
url
=
"
./embedded.html
"
,
new_gadget
;
gadget
.
__aq_parent
=
function
(
method_name
,
argument_list
)
{
gadget
.
__aq_parent
=
function
(
method_name
,
argument_list
)
{
acquire_called
=
true
;
acquire_called
=
true
;
...
@@ -4889,9 +4890,11 @@
...
@@ -4889,9 +4890,11 @@
stop
();
stop
();
gadget
.
declareGadget
(
url
,
{
gadget
.
declareGadget
(
url
,
{
sandbox
:
'
iframe
'
,
sandbox
:
'
iframe
'
,
element
:
document
.
getElementById
(
'
qunit-fixture
'
)
element
:
document
.
getElementById
(
'
qunit-fixture
'
),
scope
:
'
foobar
'
})
})
.
then
(
function
(
new_gadget
)
{
.
then
(
function
(
sub_gadget
)
{
new_gadget
=
sub_gadget
;
return
new
RSVP
.
Queue
()
return
new
RSVP
.
Queue
()
// Method returns an RSVP.Queue
// Method returns an RSVP.Queue
...
@@ -4901,12 +4904,14 @@
...
@@ -4901,12 +4904,14 @@
result
instanceof
RSVP
.
Queue
,
result
instanceof
RSVP
.
Queue
,
"
iframe method should return Queue
"
"
iframe method should return Queue
"
);
);
return
result
;
})
})
/*
// Check that ready function are called
// Check that ready function are called
.push(function () {
.push(function () {
return new_gadget.wasReadyCalled();
return new_gadget.wasReadyCalled();
})
})
*/
.
push
(
function
(
result
)
{
.
push
(
function
(
result
)
{
equal
(
result
,
true
);
equal
(
result
,
true
);
})
})
...
@@ -5776,7 +5781,7 @@
...
@@ -5776,7 +5781,7 @@
fixture
.
innerHTML
=
fixture
.
innerHTML
=
"
<iframe id=renderjsIframe src='./not_declared_gadget.html'></iframe>
"
;
"
<iframe id=renderjsIframe src='./not_declared_gadget.html'></iframe>
"
;
stop
();
stop
();
return
RSVP
.
delay
(
9
00
)
return
RSVP
.
delay
(
15
00
)
.
then
(
function
()
{
.
then
(
function
()
{
var
iframe
=
document
.
getElementById
(
'
renderjsIframe
'
),
var
iframe
=
document
.
getElementById
(
'
renderjsIframe
'
),
acquisition_div
=
iframe
.
contentWindow
.
acquisition_div
=
iframe
.
contentWindow
.
...
@@ -5820,8 +5825,6 @@
...
@@ -5820,8 +5825,6 @@
return
;
return
;
}
}
iframe_text
=
iframe_body
.
textContent
;
iframe_text
=
iframe_body
.
textContent
;
/*global console*/
// console.log(iframe_text);
if
(
iframe_text
.
indexOf
(
'
Page changed
'
)
!==
-
1
)
{
if
(
iframe_text
.
indexOf
(
'
Page changed
'
)
!==
-
1
)
{
// Final page
// Final page
ok
(
true
,
iframe_text
);
ok
(
true
,
iframe_text
);
...
@@ -5873,6 +5876,9 @@
...
@@ -5873,6 +5876,9 @@
resolve
(
evt
.
target
.
result
);
resolve
(
evt
.
target
.
result
);
});
});
})
})
.
then
(
function
()
{
return
RSVP
.
delay
(
1100
);
})
.
then
(
function
()
{
.
then
(
function
()
{
var
iframe_body
=
iframe
.
contentWindow
.
document
.
body
,
var
iframe_body
=
iframe
.
contentWindow
.
document
.
body
,
iframe_text
=
iframe_body
.
textContent
;
iframe_text
=
iframe_body
.
textContent
;
...
@@ -5946,7 +5952,7 @@
...
@@ -5946,7 +5952,7 @@
// if no event is fired within 500ms, just resolve and fail later
// if no event is fired within 500ms, just resolve and fail later
window
.
setTimeout
(
function
()
{
window
.
setTimeout
(
function
()
{
reject
(
"
Timeout, RenderJS is not Ready
"
);
reject
(
"
Timeout, RenderJS is not Ready
"
);
},
5
00
);
},
30
00
);
iframe
.
contentWindow
.
rJS
.
manualBootstrap
();
iframe
.
contentWindow
.
rJS
.
manualBootstrap
();
});
});
})
})
...
...
test/trigger_rjsready_event_on_ready_gadget.js
View file @
84bcf0e9
...
@@ -6,9 +6,6 @@
...
@@ -6,9 +6,6 @@
rJS
(
window
)
rJS
(
window
)
.
ready
(
function
(
gadget
)
{
.
ready
(
function
(
gadget
)
{
return
gadget
.
getElement
()
return
gadget
.
element
.
dispatchEvent
(
new
Event
(
"
rjsready
"
));
.
push
(
function
(
element
)
{
element
.
dispatchEvent
(
new
Event
(
"
rjsready
"
));
});
});
});
}(
window
,
rJS
));
}(
window
,
rJS
));
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