Add a hack to prevent Chrome from hard-crashing when opening links from inner

pull/1/head
yflory 4 years ago
parent 8874f2fdb1
commit ff8c811227

@ -1598,9 +1598,9 @@ define([
content: h('span', Messages.profileButton),
action: function () {
if (padType) {
window.open(origin+'/profile/');
Common.openURL(origin+'/profile/');
} else {
window.parent.location = origin+'/profile/';
Common.gotoURL(origin+'/profile/');
}
},
});
@ -1645,9 +1645,9 @@ define([
content: h('span', Messages.settingsButton),
action: function () {
if (padType) {
window.open(origin+'/settings/');
Common.openURL(origin+'/settings/');
} else {
window.parent.location = origin+'/settings/';
Common.gotoURL(origin+'/settings/');
}
},
});
@ -1662,9 +1662,9 @@ define([
content: h('span', Messages.adminPage || 'Admin'),
action: function () {
if (padType) {
window.open(origin+'/admin/');
Common.openURL(origin+'/admin/');
} else {
window.parent.location = origin+'/admin/';
Common.gotoURL(origin+'/admin/');
}
},
});
@ -1676,9 +1676,9 @@ define([
content: h('span', Messages.supportPage || 'Support'),
action: function () {
if (padType) {
window.open(origin+'/support/');
Common.openURL(origin+'/support/');
} else {
window.parent.location = origin+'/support/';
Common.gotoURL(origin+'/support/');
}
},
});
@ -1763,7 +1763,7 @@ define([
content: h('span', Messages.logoutEverywhere),
action: function () {
Common.getSframeChannel().query('Q_LOGOUT_EVERYWHERE', null, function () {
window.parent.location = origin + '/';
Common.gotoURL(origin + '/');
});
},
});
@ -1773,7 +1773,7 @@ define([
content: h('span', Messages.logoutButton),
action: function () {
Common.logout(function () {
window.parent.location = origin+'/';
Common.gotoURL(origin+'/');
});
},
});

@ -1355,6 +1355,10 @@ define([
});
};
APP.openURL = function (url) {
common.openUnsafeURL(url);
};
APP.loadingImage = 0;
APP.getImageURL = function(name, callback) {
var mediasSources = getMediasSources();

File diff suppressed because one or more lines are too long

@ -136,13 +136,11 @@ define([
file.uid = Util.uid();
response.expect(file.uid, function (href) {
var mdMgr = common.getMetadataMgr();
var origin = mdMgr.getPrivateData().origin;
$link.prepend($('<span>', {'class': 'fa fa-external-link'}));
$link.attr('href', href)
.click(function (e) {
e.preventDefault();
window.open(origin + $link.attr('href'), '_blank');
common.openURL($link.attr('href'));
});
var title = metadata.name;
if (!config.noStore) {

@ -722,7 +722,16 @@ define([
sframeChan.on('EV_OPEN_URL', function (url) {
if (url) {
window.open(url);
var a = window.open(url);
if (!a) {
sframeChan.event('EV_POPUP_BLOCKED');
}
}
});
sframeChan.on('EV_OPEN_UNSAFE_URL', function (url) {
if (url) {
window.open(ApiConfig.httpSafeOrigin + '/bounce/#' + encodeURIComponent(url));
}
});

@ -552,6 +552,10 @@ define([
funcs.gotoURL = function (url) { ctx.sframeChan.event('EV_GOTO_URL', url); };
funcs.openURL = function (url) { ctx.sframeChan.event('EV_OPEN_URL', url); };
funcs.openUnsafeURL = function (url) {
var app = ctx.metadataMgr.getPrivateData().app;
if (app === "sheet") {
return void ctx.sframeChan.event('EV_OPEN_UNSAFE_URL', url);
}
var bounceHref = window.location.origin + '/bounce/#' + encodeURIComponent(url);
window.open(bounceHref);
};
@ -682,6 +686,10 @@ define([
UI.errorLoadingScreen(Messages.password_error_seed);
});
ctx.sframeChan.on("EV_POPUP_BLOCKED", function () {
UI.alert(Messages.errorPopupBlocked);
});
ctx.sframeChan.on("EV_EXPIRED_ERROR", function () {
funcs.onServerError({
type: 'EEXPIRED'

@ -338,7 +338,7 @@ MessengerUI, Messages) {
if (data.profile) {
$span.addClass('cp-userlist-clickable');
$span.click(function () {
window.open(origin+'/profile/#' + data.profile);
Common.openURL(origin+'/profile/#' + data.profile);
});
}
Common.displayAvatar($span, data.avatar, name, function () {
@ -830,7 +830,7 @@ MessengerUI, Messages) {
title: buttonTitle,
'class': "cp-toolbar-link-logo"
}).append(UIElements.getSvgLogo());
/*.append($('<img>', {
//src: '/customize/images/logo_white.png?' + ApiConfig.requireConf.urlArgs
src: '/customize/main-favicon.png?' + ApiConfig.requireConf.urlArgs
@ -838,10 +838,10 @@ MessengerUI, Messages) {
var onClick = function (e) {
e.preventDefault();
if (e.ctrlKey) {
window.open(href);
Common.openURL(href);
return;
}
window.parent.location = href;
Common.gotoURL(href);
};
var onContext = function (e) { e.stopPropagation(); };

Loading…
Cancel
Save