From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id UNenMGvNameDHwAAqHPOHw:P1 (envelope-from ) for ; Tue, 24 Dec 2024 15:04:11 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id UNenMGvNameDHwAAqHPOHw (envelope-from ) for ; Tue, 24 Dec 2024 16:04:11 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1735052651; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=LYBF+eeOLk2J6MDVAW4y2TqP/UPP/Bx5Okeg1votByE=; b=SKh/vmX5283joEbGmgJZI6MF9yNs3X0ZxFsqKwbmaZwJOg8klgbBmysHo7UF4fFCccFkjc ec0pcsTrTkQjS/zz/u6iwd6H5n+PclBIIAf5DXH7DOmbXuGpj9z6UpJyPmZNs9UNoIRcg8 tcg4Z0q9ZuvJVPfxqrMnPVUEIh/R/dVjrAZVXSZFcgeunEtXtktzsF0YTybv3tL/IA+P7E I3K2xt6d+sCAGW1V7g/p3xtKVU3+sW8b/2zGn/UJYiwZgkjucprk9rlY0NZ2mOqpYuPt55 4Ze38spuz81HSGETPxHtmSJZHhkol1ieDf5lEBGPQBawI7p0ocgpuofmD+lT8Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1735052651; a=rsa-sha256; cv=none; b=qv3lp/fEDzo8OSvoy4T8+QrY/aHqsd5h8KtC468NcF1T/1wU0NDmpOUlTU23qEMK+YqKJw HoZhAZLULenHB+kT8VElteXQAERQCzxYbFrjA4RbwZzNG6O7TDPyDdNUpB9RNeUQ4UPUqH 7eFVkMjTqawHjxfbRgszrU3cA+lW1bDViGXb6OAxzsp6zgmTZn7FcJXGRHmD8CLR748gI9 D473cgI8v4unoqgGTRQOgMGdV1Z6eLSrm4YfvvJxc0bF6l1931y8ZkCQGDpaBcv0gc8z32 OMv8tZVq3xIUjRd6Q0MzB87+8AmtH2FL8GNAI5SaoUD3RLIyoAEy6tU/uMJGrg== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id C68597C4FF for ; Tue, 24 Dec 2024 16:04:10 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQ5g9-0002Tr-3X; Tue, 24 Dec 2024 09:14:33 -0500 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 1tQ5g7-0002Ti-Gy for emacs-orgmode@gnu.org; Tue, 24 Dec 2024 09:14:31 -0500 Received: from ciao.gmane.io ([116.202.254.214]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQ5g5-00045V-Sm for emacs-orgmode@gnu.org; Tue, 24 Dec 2024 09:14:31 -0500 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1tQ5g3-0000aH-M5 for emacs-orgmode@gnu.org; Tue, 24 Dec 2024 15:14:27 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: Max Nikulin Subject: Re: [PATCH] org-protocol: Add void() to bookmarklets Date: Tue, 24 Dec 2024 21:14:17 +0700 Message-ID: References: <87pllx7219.fsf@gmail.com> <9aea6ebe-66a2-47d6-a7cc-a7ad9e8af284@gmail.com> <366e2a83-3703-40fd-b8eb-f5746a17864d@gmail.com> <878qsk68ma.fsf@gmail.com> <87frmf99dq.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla Thunderbird Content-Language: en-US, ru-RU In-Reply-To: <87frmf99dq.fsf@localhost> Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 25 X-Spam_score: 2.5 X-Spam_bar: ++ X-Spam_report: (2.5 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FORGED_MUA_MOZILLA=2.309, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.156, NML_ADSP_CUSTOM_MED=0.9, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: C68597C4FF X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -2.60 X-Spam-Score: -2.60 X-TUID: 6aecOdRdPhYX On 22/12/2024 19:42, Ihor Radchenko wrote: > Max Nikulin writes: > >> -javascript:location.href='org-protocol://store-link?' + >> - new URLSearchParams({url:location.href, title:document.title}); >> +javascript:void(location.href='org-protocol://store-link?' + >> + new URLSearchParams({url:location.href, title:document.title})); >> #+end_example > > Another variant from reddit is > > javascript:location.href='org-protocol://store-link?'+new URLSearchParams({url:location.href, title:document.title}); void(0); If you think that ";void(0)" variant is less prone to errors then I may update my patch. I have no idea if balanced void(...) parenthesis around the whole expressions would cause more user mistakes. Otherwise both variants are equivalent. > https://old.reddit.com/r/emacs/comments/1h7ws1i/the_orgprotocol_bookmarklet_opens_a_blank_page/ I can not figure out why it did not work without user's ~/.local/share/applications/org-protocol.org. The only guess is that firefox might be confused by complex Exec entry in emacsclient.desktop. So I am curious if /usr/share/applications/emacsclient.desktop has org-protocol in MimeType (Emacs >= 29.2) and if a copy of emacsclient.desktop in ~/.local/share/application changes behavior in the absence of custom org-protocol.desktop. I have never used bookmarklets, so I am unsure concerning behavior in earlier Firefox versions. Unfortunately security-related bugs are non-public yet, so I have not idea what has been changed. (I am not motivated to search for related commits.) > Also, will the change work in older browsers? In non-Firefox? page has a citation that "void" appeared in JavaScript namely for bookmarklets and it happened in the previous century. ";undefined" instead of ";void(0)" suffix might be an issue in old browsers since "undefined" was added to JS ~10 years ago. I do not expect any problem with "void" despite I have used it only in workaround for a browser bug. >> Should ORG-NEWS be updated as well? > > Yes, I think. In announcement section. > This is one of the cases when we want people to consider changing their > usual configs. My idea is to fix existing examples in place, perhaps with a small remark on update reason. Maybe experienced users of bookmarklets are aware of the "void" trick and provided examples were enough for them. I consider the change as a minor fix that does not deserves loud announcement, especially taking into account that browsers discourages protocol handlers launched on behalf of web pages nowadays.