/// <summary>Called when a resource for this document is loading.</summary> internal virtual bool ResourceStatus(EventTarget package, int status) { if (status == 1) { // Loading: resourcesLoading++; } else if (status == 4) { // Done: resourcesLoading--; if (resourcesLoading <= 0 && readyState_ != 2) { // Fire onload now! ReadyStateChange(2); // Fire event: PowerUI.UIEvent de = new PowerUI.UIEvent("load"); de.SetTrusted(true); dispatchEvent(de); return(true); } } return(false); }
/// <summary>Sets the document content with a status code. /// Displays error info if html is blank or ErrorHandlers.CatchAll is set.</summary> internal void GotDocumentContent(string html, int status, bool openClose) { if (status != 200 && (string.IsNullOrEmpty(html) || ErrorHandlers.CatchAll)) { // Build an error message now: ErrorInfo error = new ErrorInfo(); error.document = this; error.Url = location; error.Custom = html; error.StatusCode = status; // Display: ErrorHandlers.Display(error); } else { if (openClose) { // Full open/close cycle: innerHTML = html; } else { // Parse now: HtmlLexer lexer = new HtmlLexer(html, this); lexer.Parse(); close(); } } if (resourcesLoading <= 0 && readyState != "complete") { // Fire onload now! ReadyStateChange(2); // Fire event: PowerUI.UIEvent de = new PowerUI.UIEvent("load"); de.SetTrusted(true); dispatchEvent(de); } }