Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
d6a0d6f0
Commit
d6a0d6f0
authored
Apr 03, 2014
by
Christina Roberts
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3180 from edx/christina/iframe_binding_bug
Check iframe src for the specific value TinyMCE uses.
parents
c202e2aa
cc275a93
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
6 deletions
+17
-6
cms/static/js/spec/utils/handle_iframe_binding_spec.js
+13
-5
cms/static/js/utils/handle_iframe_binding.js
+4
-1
No files found.
cms/static/js/spec/utils/handle_iframe_binding_spec.js
View file @
d6a0d6f0
...
...
@@ -12,6 +12,15 @@ function ($, _, IframeBinding) {
iframe_html
+=
'<embed type="application/x-shockwave-flash" src="http://www.youtube.com/embed/NHd27UvY-lw" height="315" width="560">'
;
doc
.
body
.
innerHTML
=
iframe_html
;
var
verify_no_modification
=
function
(
src
)
{
iframe_html
=
'<iframe width="618" height="350" src="'
+
src
+
'" frameborder="0" allowfullscreen></iframe>'
;
doc
.
body
.
innerHTML
=
iframe_html
;
IframeBinding
.
iframeBinding
(
doc
);
expect
(
$
(
doc
).
find
(
"iframe"
)[
0
].
src
).
toEqual
(
src
);
};
it
(
"modifies src url of DOM iframe and embed elements when iframeBinding function is executed"
,
function
()
{
expect
(
$
(
doc
).
find
(
"iframe"
)[
0
].
src
).
toEqual
(
"http://www.youtube.com/embed/NHd27UvY-lw"
);
expect
(
$
(
doc
).
find
(
"iframe"
)[
1
].
src
).
toEqual
(
"http://www.youtube.com/embed/NHd27UvY-lw?allowFullScreen=false"
);
...
...
@@ -35,12 +44,11 @@ function ($, _, IframeBinding) {
});
it
(
"does not modify src url of DOM iframe if it is empty"
,
function
()
{
iframe_html
=
'<iframe width="618" height="350" src="" frameborder="0" allowfullscreen></iframe>'
;
doc
.
body
.
innerHTML
=
iframe_html
;
IframeBinding
.
iframeBinding
(
doc
);
verify_no_modification
(
""
);
});
expect
(
$
(
doc
).
find
(
"iframe"
)[
0
].
src
).
toEqual
(
""
);
it
(
"does nothing on tinymce iframe"
,
function
()
{
verify_no_modification
(
"javascript:"
);
});
});
});
cms/static/js/utils/handle_iframe_binding.js
View file @
d6a0d6f0
...
...
@@ -29,7 +29,10 @@ define(["jquery"], function($) {
$
(
this
).
attr
(
'src'
,
newString
+
'?'
+
wmode
+
'&'
+
oldString
);
}
}
else
{
// The TinyMCE editor is hosted in an iframe, and before the iframe is
// removed we execute this code. To avoid throwing an error when setting the
// attr, check that the source doesn't start with the value specified by TinyMCE ('javascript:""').
else
if
(
ifr_source
.
lastIndexOf
(
"javascript:"
,
0
)
!==
0
)
{
$
(
this
).
attr
(
'src'
,
ifr_source
+
'?'
+
wmode
);
}
}
...
...
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