Discussion:
[chromium-discuss] Call method inside promise do nothing
Gustavo marques adolph
2018-10-22 03:39:12 UTC
Permalink
Hello everyone,

I'm dealing with a strange problem, when i call click method inside a
promise doesnt works but same code works in others browsers.

Have any security stuffs to prevent this?


this is a sample of my code.

async uploadBase(event) {
if (this.checkIfElementAlreadyDisableByEvent(event)) {
event.preventDefault();
return;
}
this.blockButton(this.getButtonIdByEvent(event));
const uploadFile = document.getElementById("uploadFile");
document.body.onfocus = this.checkUploadCancel;
uploadFile.addEventListener("change", this.onUploadFile, false);

if (!this.additional.hasProjects) {
uploadFile.click();
}
var resultSwal = await this.$swal({
title: "Existem Grupos já associados a essa base de dados!",
text:
"Caso prossiga não será mais possível realizar alterações na base de
Simulação desses Grupos.",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
confirmButtonText: this.$t("swal.delete.confirmText"),
cancelButtonText: this.$t("swal.delete.cancelText"),
confirmButtonClass: "btn btn-success",
cancelButtonClass: "btn btn-danger",
buttonsStyling: false,
reverseButtons: true,
showLoaderOnConfirm: true,
allowOutsideClick: () => !that.$swal.isLoading(),
preConfirm: () =>
contractsProxy.blockAllProjectsToUpdateFilters(
this.selectedContractId
)
});
if(resultSwal.success){
uploadFile.click();
}
},
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
PhistucK
2018-10-22 06:39:37 UTC
Permalink
Looks like it should work. Did you enable breaking on caught exceptions?
Can you create some CodePen <https://codepen.io>, Plunkr <https://plnkr.co/>
or something similar that demonstrates the issue?

☆*PhistucK*


On Mon, Oct 22, 2018 at 9:36 AM Gustavo marques adolph <
Post by Gustavo marques adolph
Hello everyone,
I'm dealing with a strange problem, when i call click method inside a
promise doesnt works but same code works in others browsers.
Have any security stuffs to prevent this?
this is a sample of my code.
async uploadBase(event) {
if (this.checkIfElementAlreadyDisableByEvent(event)) {
event.preventDefault();
return;
}
this.blockButton(this.getButtonIdByEvent(event));
const uploadFile = document.getElementById("uploadFile");
document.body.onfocus = this.checkUploadCancel;
uploadFile.addEventListener("change", this.onUploadFile, false);
if (!this.additional.hasProjects) {
uploadFile.click();
}
var resultSwal = await this.$swal({
title: "Existem Grupos já associados a essa base de dados!",
"Caso prossiga não será mais possível realizar alterações na base de
Simulação desses Grupos.",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
confirmButtonText: this.$t("swal.delete.confirmText"),
cancelButtonText: this.$t("swal.delete.cancelText"),
confirmButtonClass: "btn btn-success",
cancelButtonClass: "btn btn-danger",
buttonsStyling: false,
reverseButtons: true,
showLoaderOnConfirm: true,
allowOutsideClick: () => !that.$swal.isLoading(),
preConfirm: () =>
contractsProxy.blockAllProjectsToUpdateFilters(
this.selectedContractId
)
});
if(resultSwal.success){
uploadFile.click();
}
},
--
--
http://groups.google.com/a/chromium.org/group/chromium-discuss
---
You received this message because you are subscribed to the Google Groups
"Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
Gustavo marques adolph
2018-10-22 07:35:59 UTC
Permalink
https://pt.stackoverflow.com/questions/337939/calling-click-inside-http-request-promise-does-nothing-on-chrome
Post by PhistucK
Looks like it should work. Did you enable breaking on caught exceptions?
Can you create some CodePen <https://codepen.io>, Plunkr
<https://plnkr.co/> or something similar that demonstrates the issue?
☆*PhistucK*
On Mon, Oct 22, 2018 at 9:36 AM Gustavo marques adolph <
Post by Gustavo marques adolph
Hello everyone,
I'm dealing with a strange problem, when i call click method inside a
promise doesnt works but same code works in others browsers.
Have any security stuffs to prevent this?
this is a sample of my code.
async uploadBase(event) {
if (this.checkIfElementAlreadyDisableByEvent(event)) {
event.preventDefault();
return;
}
this.blockButton(this.getButtonIdByEvent(event));
const uploadFile = document.getElementById("uploadFile");
document.body.onfocus = this.checkUploadCancel;
uploadFile.addEventListener("change", this.onUploadFile, false);
if (!this.additional.hasProjects) {
uploadFile.click();
}
var resultSwal = await this.$swal({
title: "Existem Grupos já associados a essa base de dados!",
"Caso prossiga não será mais possível realizar alterações na base de
Simulação desses Grupos.",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
confirmButtonText: this.$t("swal.delete.confirmText"),
cancelButtonText: this.$t("swal.delete.cancelText"),
confirmButtonClass: "btn btn-success",
cancelButtonClass: "btn btn-danger",
buttonsStyling: false,
reverseButtons: true,
showLoaderOnConfirm: true,
allowOutsideClick: () => !that.$swal.isLoading(),
preConfirm: () =>
contractsProxy.blockAllProjectsToUpdateFilters(
this.selectedContractId
)
});
if(resultSwal.success){
uploadFile.click();
}
},
--
--
http://groups.google.com/a/chromium.org/group/chromium-discuss
---
You received this message because you are subscribed to the Google Groups
"Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
PhistucK
2018-10-22 07:41:06 UTC
Permalink
The promise button actually works for me (shows a file picker) -
https://jsfiddle.net/sknyL90b/
The fetch button does not, though. Not sure why. Maybe the user gesture
indication is lost.

You can search crbug.com for an existing issue and star it. If you cannot
find one, file a new issue using the "New issue" link on the same page.
Please, do not add a "+1" or "Me too" or "Confirmed" (or similar) comment.
It just wastes the time of Chrome engineers and sends unnecessary e-mails
to all of the people who starred the issue.

You can reply with a link to the found or created issue and might get
triaged (and fixed) faster.

Thank you.

☆*PhistucK*


On Mon, Oct 22, 2018 at 10:36 AM Gustavo marques adolph <
Post by Gustavo marques adolph
https://pt.stackoverflow.com/questions/337939/calling-click-inside-http-request-promise-does-nothing-on-chrome
Post by PhistucK
Looks like it should work. Did you enable breaking on caught exceptions?
Can you create some CodePen <https://codepen.io>, Plunkr
<https://plnkr.co/> or something similar that demonstrates the issue?
☆*PhistucK*
On Mon, Oct 22, 2018 at 9:36 AM Gustavo marques adolph <
Post by Gustavo marques adolph
Hello everyone,
I'm dealing with a strange problem, when i call click method inside a
promise doesnt works but same code works in others browsers.
Have any security stuffs to prevent this?
this is a sample of my code.
async uploadBase(event) {
if (this.checkIfElementAlreadyDisableByEvent(event)) {
event.preventDefault();
return;
}
this.blockButton(this.getButtonIdByEvent(event));
const uploadFile = document.getElementById("uploadFile");
document.body.onfocus = this.checkUploadCancel;
uploadFile.addEventListener("change", this.onUploadFile, false);
if (!this.additional.hasProjects) {
uploadFile.click();
}
var resultSwal = await this.$swal({
title: "Existem Grupos já associados a essa base de dados!",
"Caso prossiga não será mais possível realizar alterações na base de
Simulação desses Grupos.",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
confirmButtonText: this.$t("swal.delete.confirmText"),
cancelButtonText: this.$t("swal.delete.cancelText"),
confirmButtonClass: "btn btn-success",
cancelButtonClass: "btn btn-danger",
buttonsStyling: false,
reverseButtons: true,
showLoaderOnConfirm: true,
allowOutsideClick: () => !that.$swal.isLoading(),
preConfirm: () =>
contractsProxy.blockAllProjectsToUpdateFilters(
this.selectedContractId
)
});
if(resultSwal.success){
uploadFile.click();
}
},
--
--
http://groups.google.com/a/chromium.org/group/chromium-discuss
---
You received this message because you are subscribed to the Google
Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send
--
--
Chromium Discussion mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+***@chromium.org.
Loading...