From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#65678: 30.0.50; EWW rendered errs when the EWW buffer is closed before the page gets loaded Date: Sat, 02 Sep 2023 14:38:16 +0300 Message-ID: <83cyz0ajpz.fsf@gnu.org> References: <87sf7yhuth.fsf@localhost> <83ledp9f91.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14105"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65678@debbugs.gnu.org To: yantar92@posteo.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 02 13:39:07 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qcOy3-0003Tz-FP for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 Sep 2023 13:39:07 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qcOxu-0001hD-RM; Sat, 02 Sep 2023 07:38:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qcOxq-0001gu-JU for bug-gnu-emacs@gnu.org; Sat, 02 Sep 2023 07:38:54 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qcOxo-0002YZ-O3 for bug-gnu-emacs@gnu.org; Sat, 02 Sep 2023 07:38:54 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qcOxy-0004VY-Dk for bug-gnu-emacs@gnu.org; Sat, 02 Sep 2023 07:39:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 02 Sep 2023 11:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65678 X-GNU-PR-Package: emacs Original-Received: via spool by 65678-submit@debbugs.gnu.org id=B65678.169365472717305 (code B ref 65678); Sat, 02 Sep 2023 11:39:02 +0000 Original-Received: (at 65678) by debbugs.gnu.org; 2 Sep 2023 11:38:47 +0000 Original-Received: from localhost ([127.0.0.1]:35335 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qcOxj-0004V3-4k for submit@debbugs.gnu.org; Sat, 02 Sep 2023 07:38:47 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41016) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qcOxg-0004Uo-Jv for 65678@debbugs.gnu.org; Sat, 02 Sep 2023 07:38:45 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qcOxR-0002XI-7G; Sat, 02 Sep 2023 07:38:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=U800u7Ho2lIOalYV5oNpDYh+UMs0rjB2sJsZFTSZvho=; b=As9hgMNU1kqn 00MilnjdIH5xsP1iduUSXrPspNSQGX3dsU7S2v6U2TkXZJwaNDWjOt7AGM0RQjcZab7LVzd2AJ9Zl slSqyM2+qStLCucRnVAebrFY1a4YaupVGIHJ3T6d/QrPxMQr3yvKnD/s/5UKvLm9PfYLFleH0XGJu Xn50l46R0hzngGYnNTGSQA5/0iE4HRg5rpg4SrfqWRMaH7qX9mZgu/L1Nw2I4DT48C+iJsHk6sJ9t nTGFpB1WWKUgEF+HPQ93pcz95W3Azp+dTWAhqbPbeXzMEMkqPrNlRTwD5Cxys5C4E4OxDtJda1ZRn 9I7CvJCGAnvs1UT5IbAjgA==; In-Reply-To: <83ledp9f91.fsf@gnu.org> (message from Eli Zaretskii on Sat, 02 Sep 2023 11:00:10 +0300) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:268981 Archived-At: > Cc: 65678@debbugs.gnu.org > Date: Sat, 02 Sep 2023 11:00:10 +0300 > From: Eli Zaretskii > > I couldn't easily simulate that here (you didn't say what you do to > "close a EWW page"), so would you please see if the change below gives > good results? Sorry, that patch included a thinko. Please try the below one instead: diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 089e481..4ddda21 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -620,46 +620,49 @@ eww-render (let ((redirect (plist-get status :redirect))) (when redirect (setq url redirect))) - (with-current-buffer buffer - ;; Save the https peer status. - (plist-put eww-data :peer (plist-get status :peer)) - ;; Make buffer listings more informative. - (setq list-buffers-directory url) - ;; Let the URL library have a handle to the current URL for - ;; referer purposes. - (setq url-current-lastloc (url-generic-parse-url url))) - (unwind-protect - (progn - (cond - ((and eww-use-external-browser-for-content-type - (string-match-p eww-use-external-browser-for-content-type - (car content-type))) - (erase-buffer) - (insert "Unsupported content type") - (insert (format "

Content-type %s is unsupported

" - (car content-type))) - (insert (format "Direct link to the document" - url)) - (goto-char (point-min)) - (eww-display-html charset url nil point buffer encode)) - ((eww-html-p (car content-type)) - (eww-display-html charset url nil point buffer encode)) - ((equal (car content-type) "application/pdf") - (eww-display-pdf)) - ((string-match-p "\\`image/" (car content-type)) - (eww-display-image buffer)) - (t - (eww-display-raw buffer (or encode charset 'utf-8)))) - (with-current-buffer buffer - (plist-put eww-data :url url) - (eww--after-page-change) - (setq eww-history-position 0) - (and last-coding-system-used - (set-buffer-file-coding-system last-coding-system-used)) - (run-hooks 'eww-after-render-hook) - ;; Enable undo again so that undo works in text input - ;; boxes. - (setq buffer-undo-list nil))) + (when (buffer-live-p buffer) + (with-current-buffer buffer + ;; Save the https peer status. + (plist-put eww-data :peer (plist-get status :peer)) + ;; Make buffer listings more informative. + (setq list-buffers-directory url) + ;; Let the URL library have a handle to the current URL for + ;; referer purposes. + (setq url-current-lastloc (url-generic-parse-url url))) + (unwind-protect + (progn + (cond + ((and eww-use-external-browser-for-content-type + (string-match-p eww-use-external-browser-for-content-type + (car content-type))) + (erase-buffer) + (insert "Unsupported content type") + (insert (format "

Content-type %s is unsupported

" + (car content-type))) + (insert (format "Direct link to the document" + url)) + (goto-char (point-min)) + (eww-display-html charset url nil point buffer encode)) + ((eww-html-p (car content-type)) + (eww-display-html charset url nil point buffer encode)) + ((equal (car content-type) "application/pdf") + (eww-display-pdf)) + ((string-match-p "\\`image/" (car content-type)) + (eww-display-image buffer)) + (t + (eww-display-raw buffer (or encode charset 'utf-8)))) + (with-current-buffer buffer + (plist-put eww-data :url url) + (eww--after-page-change) + (setq eww-history-position 0) + (and last-coding-system-used + (set-buffer-file-coding-system last-coding-system-used)) + (run-hooks 'eww-after-render-hook) + ;; Enable undo again so that undo works in text input + ;; boxes. + (setq buffer-undo-list nil))) + (kill-buffer data-buffer))) + (unless (buffer-live-p buffer) (kill-buffer data-buffer)))) (defun eww-parse-headers ()