Since you are automating things, you can get rid of this feature by setting the setting
devtools.selfxss.countto a high number like 100.
https://bugzilla.mozilla.org/show_bug.cgi?id=994134#c82
This settings can be changed on page about:config.
Posted by jpluimers on 2024/08/08
Last year I posted about Some JavaScript bookmarklets for WordPress published pages centered around navigation and IDs.
It depended on HighlanderComments to exist in order for getting its .connectURL which contains the canonical blog post URL (i.e. from https://wiert.me it obtains https://wiert.wordpress.com).
Nowadays HighlanderComments does not always exist, but in that case <link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://wiert.wordpress.com/xmlrpc.php?rsd"> does exist.
Its’ href value can be obtained by querying document.querySelector('link[rel="EditURI"]').href and truncate it, so I made some conditional code that first tries the HighlanderComments and defers code obtaining it from the link element I mentioned above.
I also added proper Bookmarklet wrappers so the function results don’t leak to the console or Browser (Firefox really does not like Bookmarklets without this wrapper).
javascript:(function(){
//Statements returning a non-undefined type, e.g. assignments
})();
Firefox also dislikes pasting code into the development console.
Code:
Thanks to [Wayback/Archive] User Samuel Liew – Stack Overflow at [Wayback/Archive] function – JavaScript check if variable exists (is defined/initialized) – Stack Overflow
The
typeofoperator will check if the variable is really undefined.if (typeof variable === 'undefined') { // variable is undefined }The
typeofoperator, unlike the other operators, doesn’t throw a ReferenceError exception when used with an undeclared variable.However, do note that
typeof nullwill return"object". We have to be careful to avoid the mistake of initializing a variable tonull. To be safe, this is what we could use instead:if (typeof variable === 'undefined' || variable === null) { // variable is undefined or null }
javascript:(function(){ var postID = document.getElementsByName("comment_post_ID")[0]?.value; var a = document.createElement("a"); if ((typeof HighlanderComments === 'undefined') || (HighlanderComments == null)) { a.href = document.querySelector('link[rel="EditURI"]').href; var searchParams = new URLSearchParams(window.location.search); } else { a.href=HighlanderComments.connectURL; }; a.pathname='wp-admin/post.php'; a.search=`post=${postID}&action=edit&classic-editor`; a.hash=''; open(a.href); } )();
javascript:(function(){ var postID = document.getElementsByName("comment_post_ID")[0]?.value; var a = document.createElement("a"); if ((typeof HighlanderComments === 'undefined') || (HighlanderComments == null)) { a.href = document.querySelector('link[rel="EditURI"]').href; var searchParams = new URLSearchParams(window.location.search); } else { a.href=HighlanderComments.connectURL; }; a.pathname=''; a.search=`?p=${postID}`; a.hash=''; a.target="blank"; a.rel="noopener"; a.text=document.querySelector('meta[property="og:title"]')?.content; prompt("Anchor", a.outerHTML); } )();
Typing “allow pasting” in the Firefox 15.13.0esr development console enabled me to paste and is persistent.
There was absolutely no warning that pasting is disabled by default.
Found the workaround at [Wayback/Archive] javascript – How to disable paste protection in Mozilla Firefox Developer Console? – Stack Overflow (thanks [Wayback/Archive] Ms01 , [Wayback/Archive] sreekanth kuriyala , [Wayback/Archive] User maaw – Stack Overflow, [Wayback/Archive] Sri Harsha Chilakapati and [Wayback/Archive] Andrew Royer):
Q
I have noticed that in recent versions of Mozilla Firefox there is a super, super annoying bug that disables pastes into the developer console. This has to be the single worst idea ever.
A
If you want to fix it only temporarily you can do this:
- Open console and type “
allow pasting” and hit enter.- Now try to paste something. It will paste.
C
Note that this is affected by the host’s language. So in my case I had to write “permitir pegado”.
C
I use my Firefox in Telugu, but keep English as the default input method. Changing the input type and typing పేస్టింగ్ అనుమతించు into the field every time I open dev-tools is not easy!
A
Since you are automating things, you can get rid of this feature by setting the setting
devtools.selfxss.countto a high number like 100.https://bugzilla.mozilla.org/show_bug.cgi?id=994134#c82
This settings can be changed on page
about:config.A
Actually as of May 21, 2020 “allow paste” “allow pasting” and
devtools.selfxss.countdo not work. I already migrated from Chrome because of backdoors literally built into the browser by developers. I’d really rather not have to do that again already.
Bugzilla link at [Wayback/Archive] 994134 – Warn first time users on pasting code into the console
(In reply to Girish Sharma [:Optimizer] from comment #82) > Since you are automating things, you can get rid of this feature by setting > the setting devtools.selfxss.count to a high number like 100. Thank you very much, this worked
Query: [Wayback/Archive] “devtools.selfxss.count” – Google Search
--jeroen
| javascript:(function(){ var postID = document.getElementsByName("comment_post_ID")[0]?.value; var a = document.createElement("a"); if ((typeof HighlanderComments === 'undefined') || (HighlanderComments == null)) { a.href = document.querySelector('link[rel="EditURI"]').href; var searchParams = new URLSearchParams(window.location.search); } else { a.href=HighlanderComments.connectURL; }; a.pathname='wp-admin/post.php'; a.search=`post=${postID}&action=edit&classic-editor`; a.hash=''; open(a.href); } )(); |
| javascript:(function(){ var postID = document.getElementsByName("comment_post_ID")[0]?.value; var a = document.createElement("a"); if ((typeof HighlanderComments === 'undefined') || (HighlanderComments == null)) { a.href = document.querySelector('link[rel="EditURI"]').href; var searchParams = new URLSearchParams(window.location.search); } else { a.href=HighlanderComments.connectURL; }; a.pathname=''; a.search=`?p=${postID}`; a.hash=''; a.target="blank"; a.rel="noopener"; a.text=document.querySelector('meta[property="og:title"]')?.content; prompt("Anchor", a.outerHTML); } )(); |
Leave a comment