mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-12-29 19:05:05 +08:00
add handling to some places in javascript that can potentially cause issues #6898
This commit is contained in:
parent
79d802b48a
commit
c12d7ddd72
@ -93,10 +93,12 @@ function checkBrackets(evt) {
|
||||
}
|
||||
|
||||
var shadowRootLoaded = setInterval(function() {
|
||||
var shadowTextArea = document.querySelector('gradio-app').shadowRoot.querySelectorAll('#txt2img_prompt > label > textarea');
|
||||
if(shadowTextArea.length < 1) {
|
||||
return false;
|
||||
}
|
||||
var sahdowRoot = document.querySelector('gradio-app').shadowRoot;
|
||||
if(! sahdowRoot) return false;
|
||||
|
||||
var shadowTextArea = sahdowRoot.querySelectorAll('#txt2img_prompt > label > textarea');
|
||||
if(shadowTextArea.length < 1) return false;
|
||||
|
||||
|
||||
clearInterval(shadowRootLoaded);
|
||||
|
||||
|
@ -81,8 +81,13 @@ function request(url, data, handler, errorHandler){
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState === 4) {
|
||||
if (xhr.status === 200) {
|
||||
var js = JSON.parse(xhr.responseText);
|
||||
handler(js)
|
||||
try {
|
||||
var js = JSON.parse(xhr.responseText);
|
||||
handler(js)
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
errorHandler()
|
||||
}
|
||||
} else{
|
||||
errorHandler()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user