Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions www/core/directives/iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ angular.module('mm.core')
*/
function redefineWindowOpen(element) {
var el = element[0],
contentWindow = element.contentWindow || el.contentWindow,
contents = element.contents();
contentWindow = element.contentWindow || el.contentWindow;

if (!contentWindow && el && el.contentDocument) {
// It's probably an <object>. Try to get the window.
Expand Down Expand Up @@ -131,11 +130,16 @@ angular.module('mm.core')
}

// Search sub frames.
angular.forEach(tags, function(tag) {
angular.forEach(contents.find(tag), function(subelement) {
treatFrame(angular.element(subelement));
try {
var contents = element.contents();
angular.forEach(tags, function(tag) {
angular.forEach(contents.find(tag), function(subelement) {
treatFrame(angular.element(subelement));
});
});
});
} catch (ex) {
// Error getting iframe contents, probably due to a cross-origin problem.
}
}

/**
Expand All @@ -146,7 +150,13 @@ angular.module('mm.core')
* @return {Void}
*/
function treatLinks(element) {
var links = element.contents().find('a');
var links;
try {
links = element.contents().find('a');
} catch (ex) {
// Error getting iframe contents, probably due to a cross-origin problem.
}

angular.forEach(links, function(el) {
var href = el.href;

Expand Down
2 changes: 1 addition & 1 deletion www/core/directives/recaptcha.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ angular.module('mm.core')
scope.closeModal();
};
contentWindow.recaptchaexpiredcallback = function() {
// Verification expired. Check the checkbox again.
scope.expired = true;
scope.model[scope.modelValueName] = '';
$timeout(); // Use $timeout to force a digest and update the view.
};
// Verification expired. Check the checkbox again.
}
};
} else if (scope.recaptchaV1Enabled && !scope.initializedV1) {
Expand Down