Are you sure you want to go to an external site to donate a monetary value?
WARNING: Some countries laws may supersede the payment processors policy such as the GDPR and PayPal. While it is highly appreciated to donate, please check with your countries privacy and identity laws regarding privacy of information first. Use at your utmost discretion.
Hello,
I'm using Falkon Browser which has it's own Greasemonkey extension.
I'm happily using Newspaper Native Feed Reader on Falkon.
Apparently, this script doesn't work with Firefox (tested against Greasemonkey and Tampermonkey).
However, since Firefox has dropped RSS (why, I don't know) we can still open files with PHP and XML extensions (in contrast .atom and .rss open download prompt since 2018), so trying against these feeds doesn't yield results.
https://kodi.tv/rss.xml
https://www.blacklistednews.com/rss.php
Please help!
It might has to do with these:
https://techdows.com/2018/10/mozilla-removes-rss-live-bookmarks-support-from-firefox-64.html
https://www.zdnet.com/article/end-nears-for-rss-firefox-64-to-drop-built-in-support-for-rss-atom-feeds-says-mozilla/
https://www.bleepingcomputer.com/news/software/mozilla-to-remove-support-for-built-in-feed-reader-from-firefox/
http://camendesign.com/blog/rss_is_dying (RSS lives on!)
Re: @sjehuda:
I've briefly skimmed over the script syntax and I don't see anything right away that would prevent it from working. Do you get any errors/warnings in Browser Console specific to the script?
Never utilized that feature however I do briefly check in Firefox (Fx) the XML generated before importing into Thunderbird's (TB) feeds which definitely supports RSS and atom feeds (and obviously not a Userscript engine there).
Btw what version of Falkon are you using please. I loaded in their latest under Linux and there is no GreaseMonkey (last known properly casing) extension via their snap but is present via current distro (which is older). As the AM of the site it is on my lengthy TODO list to verify the on-site documents.
I suppose I could fire up a VM of Windows and check that in a bit but anyone attempting to diagnose your question would need to know to compare.
Re: @sjehuda:
Fun... Windows binary installation is currently 3.1.0 and snap is 3.2.0. Windows has GreaseMonkey extension (and a weird mirrored and rotated 180d
falkon:start
page); snap does not have the GreaseMonkey extension.WSL 1 was running about a year'ish or so ago on Windows 10... however current WSL 2 doesn't work on dev station VM (neither does WSL 1 last try). So can't get windows snap installed to even try the Ubuntu version on Windows... although running it directly on Ubuntu as previously mentioned.
Only when using Tampermonkey for Firefox. Greasemonkey for Firefox shows no errors.
Uncaught Exception { name: "", message: "", result: 2153775105, filename: "moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0", lineNumber: 181, columnNumber: 0, data: null, stack: "renderFeed@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:181:17\ncheckMediaType@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:138:15\nhttpGetAsync/xmlHTTPRequest.onreadystatechange@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:85:15\nEventHandlerNonNull*httpGetAsync@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:69:3\ntms_acd40735_0cb5_4484_bcb0_b1d674174df0$@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:249:13\nit@https://www.blacklistednews.com/rss.php:14:1075\nwindow[\"__p__13666865.141279189\"]/</<@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:1:131\nwindow[\"__p__13666865.141279189\"]/<@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:1:531\nwindow[\"__p__13666865.141279189\"]@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:251:6\nit@https://www.blacklistednews.com/rss.php:14:1075\nset@https://www.blacklistednews.com/rss.php:3:400\n@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:1:1\nit@https://www.blacklistednews.com/rss.php:14:1075\nI[t]@https://www.blacklistednews.com/rss.php:4:485\nit@https://www.blacklistednews.com/rss.php:14:1075\ny@https://www.blacklistednews.com/rss.php:6:40\nsend@https://www.blacklistednews.com/rss.php:7:128\nV@https://www.blacklistednews.com/rss.php:3:307\nE_u/<@https://www.blacklistednews.com/rss.php:4:275\nE_u@https://www.blacklistednews.com/rss.php:4:330\ncreate/<@eval:64:45\ncreate@eval:65:178\nl@eval:6:96\nn@eval:5:325\nrun@eval:6:188\nTM_back/</</<@eval:67:49\nit@https://www.blacklistednews.com/rss.php:14:1075\nt@https://www.blacklistednews.com/rss.php:15:366\nTM_back/</<@eval:67:30\nTM_back/<@eval:67:59\nTM_back@eval:68:3\nwindow[\"__c__10191374.835477514\"]@eval:68:10\nit@https://www.blacklistednews.com/rss.php:14:1075\nset@https://www.blacklistednews.com/rss.php:3:400\n@eval:1:1\n" } columnNumber: 0 data: null filename: "moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0" lineNumber: 181 message: "" name: "" result: 2153775105 stack: "renderFeed@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:181:17\ncheckMediaType@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:138:15\nhttpGetAsync/xmlHTTPRequest.onreadystatechange@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:85:15\nEventHandlerNonNull*httpGetAsync@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:69:3\ntms_acd40735_0cb5_4484_bcb0_b1d674174df0$@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:249:13\nit@https://www.blacklistednews.com/rss.php:14:1075\nwindow[\"__p__13666865.141279189\"]/</<@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:1:131\nwindow[\"__p__13666865.141279189\"]/<@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:1:531\nwindow[\"__p__13666865.141279189\"]@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:251:6\nit@https://www.blacklistednews.com/rss.php:14:1075\nset@https://www.blacklistednews.com/rss.php:3:400\n@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:1:1\nit@https://www.blacklistednews.com/rss.php:14:1075\nI[t]@https://www.blacklistednews.com/rss.php:4:485\nit@https://www.blacklistednews.com/rss.php:14:1075\ny@https://www.blacklistednews.com/rss.php:6:40\nsend@https://www.blacklistednews.com/rss.php:7:128\nV@https://www.blacklistednews.com/rss.php:3:307\nE_u/<@https://www.blacklistednews.com/rss.php:4:275\nE_u@https://www.blacklistednews.com/rss.php:4:330\ncreate/<@eval:64:45\ncreate@eval:65:178\nl@eval:6:96\nn@eval:5:325\nrun@eval:6:188\nTM_back/</</<@eval:67:49\nit@https://www.blacklistednews.com/rss.php:14:1075\nt@https://www.blacklistednews.com/rss.php:15:366\nTM_back/</<@eval:67:30\nTM_back/<@eval:67:59\nTM_back@eval:68:3\nwindow[\"__c__10191374.835477514\"]@eval:68:10\nit@https://www.blacklistednews.com/rss.php:14:1075\nset@https://www.blacklistednews.com/rss.php:3:400\n@eval:1:1\n" <prototype>: ExceptionPrototype { toString: toString(), name: Getter, message: Getter, … } columnNumber: data: filename: lineNumber: message: name: result: stack: toString: function toString() Symbol(Symbol.toStringTag): "Exception" <get columnNumber()>: function columnNumber() <get data()>: function data() <get filename()>: function filename() <get lineNumber()>: function lineNumber() <get message()>: function message() <get name()>: function name() <get result()>: function result() <get stack()>: function stack() <set stack()>: function stack() <prototype>: Object { … } Newspaper.user.js:181
It points to
xsltProcessor.importStylesheet(xsltStylesheet);
falkon 22.04.0-1 (x86_64) - Arch Linux
Re: @sjehuda:
Here should be a more readable stack trace (newline escaped removed to actual and some indention):
{ name: "", message: "", result: 2153775105, filename: "moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0", lineNumber: 181, columnNumber: 0, data: null, stack: "renderFeed@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:181:17 checkMediaType @moz - extension: //21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:138:15 httpGetAsync / xmlHTTPRequest.onreadystatechange @moz - extension: //21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:85:15 EventHandlerNonNull * httpGetAsync @moz - extension: //21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:69:3 tms_acd40735_0cb5_4484_bcb0_b1d674174df0$ @moz - extension: //21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:249:13 it @https: //www.blacklistednews.com/rss.php:14:1075 window[\"__p__13666865.141279189\"]/</<@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:1:131 window[\"__p__13666865.141279189\"]/<@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:1:531 window[\"__p__13666865.141279189\"]@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:251:6 it @https: //www.blacklistednews.com/rss.php:14:1075 set @https: //www.blacklistednews.com/rss.php:3:400 @moz - extension: //21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:1:1 it @https: //www.blacklistednews.com/rss.php:14:1075 I[t] @https: //www.blacklistednews.com/rss.php:4:485 it @https: //www.blacklistednews.com/rss.php:14:1075 y @https: //www.blacklistednews.com/rss.php:6:40 send @https: //www.blacklistednews.com/rss.php:7:128 V @https: //www.blacklistednews.com/rss.php:3:307 E_u / < @https: //www.blacklistednews.com/rss.php:4:275 E_u @https: //www.blacklistednews.com/rss.php:4:330 create / < @eval: 64: 45 create @eval: 65: 178 l @eval: 6: 96 n @eval: 5: 325 run @eval: 6: 188 TM_back / < /</ < @eval: 67: 49 it @https: //www.blacklistednews.com/rss.php:14:1075 t @https: //www.blacklistednews.com/rss.php:15:366 TM_back / < /<@eval:67:30 TM_back / < @eval: 67: 59 TM_back @eval: 68: 3 window[\"__c__10191374.835477514\"]@eval:68:10 it @https: //www.blacklistednews.com/rss.php:14:1075 set @https: //www.blacklistednews.com/rss.php:3:400 @eval: 1: 1 " }
DOMParser.parseFromString
has been notoriously different between browsers (a.k.a finicky) over the years on how it handles Strings and might be throwing an error since you don't appear to be checking for that.Are you sure that 181 is that line... usually the line before that could also be suspect where you set it to
null
currently here. Try not doing your own garbage collection and let JavaScript do it for you... or even tryundefined
instead of anull
Object assignment for a possible work-around.Fun... nothing like non-matching version numbers between Arch and non-Arch. My Arch VM hasn't been around since the Qupzilla days but perhaps in time (when I have it) I can peruse the source and see what it might be doing different than Fx... however I'm still swamped with real life duties atm... probably until the end of the month.
Your XML appears to be validated properly so I'm taking a wild guess there is a JavaScript issue with the implementation. You might see if any of your isolated areas of your code are mentioned on bugzilla.
The RSS feed appears at a very quick glance to be correct too... but that's a dynamic data stream and can produce different results on-the-fly especially since it's PHP.
Re: @sjehuda:
One other quick note... your current
@include
is way too wide... perhaps you are getting other data processed too from different URLs. Perhaps narrow that down a bit to rule out this.Certainly.
Clicking on
Newspaper.user.js:181
highlights codexsltProcessor.importStylesheet(xsltStylesheet);
I've also changed
null
toundefined
and also deleted all lines. Both didn't work and yield the same result.I always check that it works in the traditional way, adding a reference to the stylesheet inside a given XML.
We can always test against https://kodi.tv/rss.xml or any other feed that doesn't cause to download prompt to open.
I'll take a look.
Re: @Martii:
How exactly please?
This script has to be inclusive.
Perhaps
// @match *://*
?Re: @sjehuda:
Just did that in Fx with GM... and I get errors:
... the document.body is null one is suspect for failure of
DOMParser.parseFromString
if I recall correctly. The others are internal to Fx. Debugging in Fx isn't exactly pleasant any more so sometimes I have to hop to Chromium with TM to get a clearer picture.Re: @sjehuda:
For debugging purposes do as you just said here with:
Temporarily, or create a temporary script, and debug against that include specifically. Chromium decodes the feed but the prior reply I did with Fx shows a contentscript.js error... that can be Userscripts or just the browser itself. Same with document.head too.
Re: @sjehuda:
Haven't been prompted for that here... it's always loaded in the page here. PHP can do that as well depending on region, browser, etc.
So I did, placing the exact address inside
@include
or@match
. Same result.I also executed the script from console.
It works with Falkon, but not with Fx.
What do you get for https://otter-browser.org/feed/ ?
With Fx, I get a download prompt.
Re: @sjehuda:
Download prompt and silent error iteration.
Luckily Chromium shows what the error is:
Unchecked runtime.lastError: The message port closed before a response was received. otter-browser.org/:1 Unchecked runtime.lastError: The message port closed before a response was received.
That particular feed seems to be doing some "voodoo" against Fx. i.e.
Content-Disposition
and related HTTP headers that get intercepted internally by Fx and Chromium.Re: @sjehuda:
You have to remember that Falkon is an abstracted WebKit/V8 fork (Qt) so they might have different implementations than standard CPP to JavaScript. The syntax of the core of the browser is typically CPP with a toolkit Qt browser vs native CPP and non-Qt (GNU to be exact) toolkits... so expect some differences in ECMAScript implementation.
xslFile = '<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet ...</xsl:stylesheet>'; domParser = new DOMParser(); xsltStylesheet = domParser.parseFromString(xslFile, "application/xml"); const errorNode = xsltStylesheet.querySelector('parsererror'); if (errorNode) { // parsing failed console.log("parsing failed") } else { // parsing succeeded console.log("parsing succeeded") }
I don't know how to handle this error:
[Learn More]
For record, I've tested against document.URI. Document is OK
xmlHTTPRequest = new XMLHttpRequest(); xmlHTTPRequest.open('GET', document.documentURI, false); xmlHTTPRequest.send(); xmlHTTPRequest.getResponseHeader('Content-Type'); xmlFile = xmlHTTPRequest.responseText; domParser = new DOMParser(); xmlDocument = domParser.parseFromString(xmlFile, 'text/xml'); const errorNode = xmlDocument.querySelector('parsererror'); if (errorNode) { // parsing failed console.log("parsing failed") } else { // parsing succeeded console.log("parsing succeeded") }
I stand corrected. Both are OK
parsing succeeded
debugger eval code:10:11
xslFile = '<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom10="http://www.w3.org/2005/Atom" xmlns:atom="http://www.w3.org/2005/Atom" version="1.0"><xsl:output method="html" indent="yes" omit-xml-decleration="no"/><!-- Atom 1.0 Syndication Format --><xsl:output media-type="application/atom+xml"/><xsl:template match="/atom:feed"><!-- index right-to-left language codes --><!-- TODO http://www.w3.org/TR/xpath/#function-lang --><xsl:variable name="rtl" select="@xml:lang[ contains(self::node(),"ar") or contains(self::node(),"fa") or contains(self::node(),"he") or contains(self::node(),"ji") or contains(self::node(),"ku") or contains(self::node(),"ur") or contains(self::node(),"yi")]"/><html><head><xsl:call-template name="metadata"><xsl:with-param name="name" select=""description""/><xsl:with-param name="content" select="atom:subtitle"/></xsl:call-template><xsl:call-template name="metadata"><xsl:with-param name="name" select=""generator""/><xsl:with-param name="content" select=""syndication4humans https://sjehuda.github.io/""/></xsl:call-template><xsl:call-template name="metadata"><xsl:with-param name="name" select=""mimetype""/><xsl:with-param name="content" select=""application/atom+xml""/></xsl:call-template><title><xsl:choose><xsl:when test="atom:title and not(atom:title="")"><xsl:value-of select="atom:title"/></xsl:when><xsl:otherwise>Falkon Feed Viewer</xsl:otherwise></xsl:choose></title><!-- TODO media="print" --><link href="syndication.css" rel="stylesheet" type="text/css" media="screen"/><!-- whether language code is of direction right-to-left --><xsl:if test="$rtl"><link id="semitic" href="syndication-rtl.css" rel="stylesheet" type="text/css"/></xsl:if></head><body><div id="feed"><header><!-- feed title --><div id="title"><xsl:choose><xsl:when test="atom:title and not(atom:title="")"><xsl:attribute name="title"><xsl:value-of select="atom:title"/></xsl:attribute><xsl:value-of select="atom:title"/></xsl:when><xsl:otherwise><div class="empty"/></xsl:otherwise></xsl:choose></div><!-- feed subtitle --><div id="subtitle"><xsl:attribute name="title"><xsl:value-of select="atom:subtitle"/></xsl:attribute><xsl:value-of select="atom:subtitle"/></div></header><section id="links"><a title="Click to get the latest updates and news" onclick="location.href = "feed:" + location.href"/><a title="Learn about syndication feed" onclick="document.getElementById("aboutfeed").classList.toggle("show");" class="popup"><span class="popuptext" id="aboutfeed"/></a><a href="https://falkon.org/get-reader/" title="Get a feed reader for desktop and mobile"/><a href="https://falkon.org/about-feeds/" title="Learn the benefits of using feeds for personal and corporates"/></section><xsl:choose><xsl:when test="atom:entry"><div id="toc"><xsl:for-each select="atom:entry"><xsl:if test="atom:title"><xsl:element name="a"><xsl:attribute name="href"><xsl:text>#newspaper-oujs-</xsl:text><xsl:value-of select="position()"/></xsl:attribute><xsl:value-of select="atom:title"/></xsl:element></xsl:if></xsl:for-each></div></xsl:when></xsl:choose><section id="articles"><!-- feed entry --><xsl:choose><xsl:when test="atom:entry"><xsl:for-each select="atom:entry"><div class="entry"><!-- entry title --><xsl:if test="atom:title"><div class="title"><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="atom:link[contains(@rel,"alternate")]/@href"/></xsl:attribute><xsl:attribute name="title"><xsl:value-of select="atom:title"/></xsl:attribute><xsl:attribute name="id"><xsl:text>newspaper-oujs-</xsl:text><xsl:value-of select="position()"/></xsl:attribute><xsl:value-of select="atom:title"/></xsl:element></div></xsl:if><!-- geographic location --><xsl:choose><xsl:when test="geo:lat and geo:long"><xsl:variable name="lat" select="geo:lat"/><xsl:variable name="lng" select="geo:long"/><span class="geolocation"><a href="geo:{$lat},{$lng}">📍</a></span></xsl:when><xsl:when test="geo:Point"><xsl:variable name="lat" select="geo:Point/geo:lat"/><xsl:variable name="lng" select="geo:Point/geo:long"/><span class="geolocation"><a href="geo:{$lat},{$lng}">📍</a></span></xsl:when><xsl:when test="georss:point"><xsl:variable name="lat" select="substring-before(georss:point, " ")"/><xsl:variable name="lng" select="substring-after(georss:point, " ")"/><xsl:variable name="name" select="georss:featurename"/><span class="geolocation"><a href="geo:{$lat},{$lng}" title="{$name}">📍</a></span></xsl:when></xsl:choose><!-- entry date --><xsl:choose><xsl:when test="atom:updated"><div class="updated"><xsl:value-of select="atom:updated"/></div></xsl:when><xsl:when test="atom:published"><div class="published"><xsl:value-of select="atom:published"/></div></xsl:when><xsl:otherwise><div class="warning atom1 published"/></xsl:otherwise></xsl:choose><!-- /div --><!-- entry content --><!-- entry summary of GitLab Atom Syndication Feeds --><xsl:if test="atom:content or atom:summary"><div class="content"><xsl:choose><xsl:when test="atom:summary[contains(@type,"text")]"><xsl:attribute name="type"><xsl:value-of select="atom:summary/@type"/></xsl:attribute><xsl:value-of select="atom:summary"/></xsl:when><xsl:when test="atom:summary[contains(@type,"base64")]"><!-- TODO add xsl:template to handle inline media --></xsl:when><xsl:when test="atom:content[contains(@type,"text")]"><xsl:attribute name="type"><xsl:value-of select="atom:content/@type"/></xsl:attribute><xsl:value-of select="atom:content"/></xsl:when><xsl:when test="atom:content[contains(@type,"base64")]"><!-- TODO add xsl:template to handle inline media --></xsl:when><xsl:otherwise><xsl:choose><xsl:when test="atom:summary and not(atom:summary="")"><xsl:value-of select="atom:summary" disable-output-escaping="yes"/></xsl:when><xsl:otherwise><xsl:value-of select="atom:content" disable-output-escaping="yes"/></xsl:otherwise></xsl:choose></xsl:otherwise></xsl:choose></div></xsl:if><!-- entry enclosure --><xsl:if test="atom:link[contains(@rel,"enclosure")]"><div class="enclosure" title="Right-click and Save link as…"><xsl:for-each select="atom:link[contains(@rel,"enclosure")]"><xsl:element name="span"><xsl:attribute name="icon"><xsl:value-of select="substring-before(@type,"/")"/></xsl:attribute></xsl:element><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute><xsl:attribute name="download"/><xsl:call-template name="extract-filename"><xsl:with-param name="url" select="@href"/></xsl:call-template></xsl:element><xsl:element name="span"><xsl:attribute name="class"><xsl:value-of select="substring-before(@type,"/")"/></xsl:attribute></xsl:element><xsl:if test="@length > 0"><xsl:call-template name="transform-filesize"><xsl:with-param name="length" select="@length"/></xsl:call-template></xsl:if><xsl:element name="br"/></xsl:for-each><xsl:for-each select="media:content"><xsl:element name="span"><xsl:attribute name="icon"><xsl:value-of select="@medium"/></xsl:attribute></xsl:element><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute><xsl:attribute name="download"/><xsl:call-template name="extract-filename"><xsl:with-param name="url" select="@url"/></xsl:call-template></xsl:element><xsl:element name="span"><xsl:attribute name="class"><xsl:value-of select="@medium"/></xsl:attribute></xsl:element><xsl:if test="@fileSize > 0"><xsl:call-template name="transform-filesize"><xsl:with-param name="length" select="@fileSize"/></xsl:call-template></xsl:if><xsl:element name="br"/></xsl:for-each></div></xsl:if></div><!-- entry id --><xsl:if test="not(atom:id)"><div class="warning atom1 id"/></xsl:if></xsl:for-each></xsl:when><xsl:otherwise><div class="notice no-entry"/></xsl:otherwise></xsl:choose></section></div></body></html></xsl:template><!-- extract filename from given url string --><xsl:template name="extract-filename"><xsl:param name="url"/><xsl:choose><xsl:when test="contains($url,"/")"><xsl:call-template name="extract-filename"><xsl:with-param name="url" select="substring-after($url,"/")"/></xsl:call-template></xsl:when><xsl:otherwise><xsl:value-of select="$url"/></xsl:otherwise></xsl:choose></xsl:template><!-- set page metadata --><xsl:template name="metadata"><xsl:param name="name"/><xsl:param name="content"/><xsl:if test="$content and not($content="")"><xsl:element name="meta"><xsl:attribute name="name"><xsl:value-of select="$name"/></xsl:attribute><xsl:attribute name="content"><xsl:value-of select="$content"/></xsl:attribute></xsl:element></xsl:if></xsl:template><!-- RSS 2.0 Syndication Format --><xsl:output media-type="application/rss+xml"/><xsl:template match="/rss"><!-- index right-to-left language codes --><xsl:variable name="rtl" select="channel/language[ contains(text(),"ar") or contains(text(),"fa") or contains(text(),"he") or contains(text(),"ji") or contains(text(),"ku") or contains(text(),"ur") or contains(text(),"yi")]"/><html><head><xsl:call-template name="metadata"><xsl:with-param name="name" select=""description""/><xsl:with-param name="content" select="channel/description"/></xsl:call-template><xsl:call-template name="metadata"><xsl:with-param name="name" select=""generator""/><xsl:with-param name="content" select=""syndication4humans https://sjehuda.github.io/""/></xsl:call-template><xsl:call-template name="metadata"><xsl:with-param name="name" select=""mimetype""/><xsl:with-param name="content" select=""application/rss+xml""/></xsl:call-template><title><xsl:choose><xsl:when test="channel/title and not(channel/title="")"><xsl:value-of select="channel/title"/></xsl:when><xsl:otherwise>Falkon Feed Viewer</xsl:otherwise></xsl:choose></title><!-- TODO media="print" --><link href="syndication.css" rel="stylesheet" type="text/css" media="screen"/><!-- whether language code is of direction right-to-left --><xsl:if test="$rtl"><link id="semitic" href="syndication-rtl.css" rel="stylesheet" type="text/css"/></xsl:if></head><body><div id="feed"><header><!-- feed title --><div id="title"><xsl:choose><xsl:when test="channel/title and not(channel/title="")"><xsl:attribute name="title"><xsl:value-of select="channel/title"/></xsl:attribute><xsl:value-of select="channel/title"/></xsl:when><xsl:otherwise><div class="empty"/></xsl:otherwise></xsl:choose></div><!-- feed subtitle --><xsl:choose><xsl:when test="channel/itunes:subtitle"><div id="subtitle"><xsl:attribute name="title"><xsl:value-of select="channel/itunes:subtitle"/></xsl:attribute><xsl:value-of select="channel/itunes:subtitle"/></div></xsl:when><xsl:when test="channel/description"><div id="subtitle"><xsl:attribute name="title"><xsl:value-of select="channel/description"/></xsl:attribute><xsl:value-of select="channel/description"/></div></xsl:when></xsl:choose></header><section id="links"><a title="Click to get the latest updates and news" onclick="location.href = "feed:" + location.href"/><a title="Learn about syndication feed" onclick="document.getElementById("aboutfeed").classList.toggle("show");" class="popup"><span class="popuptext" id="aboutfeed"/></a><a href="https://falkon.org/get-reader/" title="Get a feed reader for desktop and mobile"/><a href="https://falkon.org/about-feeds/" title="Learn the benefits of using feeds for personal and corporates"/></section><xsl:choose><xsl:when test="channel/item"><div id="toc"><xsl:for-each select="channel/item"><xsl:choose><xsl:when test="itunes:subtitle"><xsl:element name="a"><xsl:attribute name="href"><xsl:text>#newspaper-oujs-</xsl:text><xsl:value-of select="position()"/></xsl:attribute><xsl:value-of select="itunes:subtitle"/></xsl:element></xsl:when><xsl:when test="title"><xsl:element name="a"><xsl:attribute name="href"><xsl:text>#newspaper-oujs-</xsl:text><xsl:value-of select="position()"/></xsl:attribute><xsl:value-of select="title"/></xsl:element></xsl:when></xsl:choose></xsl:for-each></div></xsl:when></xsl:choose><section id="articles"><!-- feed entry --><xsl:choose><xsl:when test="channel/item"><xsl:for-each select="channel/item"><div class="entry"><!-- entry title --><xsl:choose><xsl:when test="itunes:subtitle"><div class="title"><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="link"/></xsl:attribute><xsl:attribute name="title"><xsl:value-of select="itunes:subtitle"/></xsl:attribute><xsl:attribute name="id"><xsl:text>newspaper-oujs-</xsl:text><xsl:value-of select="position()"/></xsl:attribute><xsl:value-of select="itunes:subtitle"/></xsl:element></div></xsl:when><xsl:when test="title"><div class="title"><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="link"/></xsl:attribute><xsl:attribute name="title"><xsl:value-of select="title"/></xsl:attribute><xsl:attribute name="id"><xsl:text>newspaper-oujs-</xsl:text><xsl:value-of select="position()"/></xsl:attribute><xsl:value-of select="title"/></xsl:element></div></xsl:when><xsl:otherwise><div class="warning rss2 title"/></xsl:otherwise></xsl:choose><!-- geographic location --><xsl:choose><xsl:when test="geo:lat and geo:long"><xsl:variable name="lat" select="geo:lat"/><xsl:variable name="lng" select="geo:long"/><span class="geolocation"><a href="geo:{$lat},{$lng}">📍</a></span></xsl:when><xsl:when test="geo:Point"><xsl:variable name="lat" select="geo:Point/geo:lat"/><xsl:variable name="lng" select="geo:Point/geo:long"/><span class="geolocation"><a href="geo:{$lat},{$lng}">📍</a></span></xsl:when><xsl:when test="georss:point"><xsl:variable name="lat" select="substring-before(georss:point, " ")"/><xsl:variable name="lng" select="substring-after(georss:point, " ")"/><xsl:variable name="name" select="georss:featurename"/><span class="geolocation"><a href="geo:{$lat},{$lng}" title="{$name}">📍</a></span></xsl:when></xsl:choose><!-- entry date --><xsl:if test="pubDate"><div class="published"><xsl:value-of select="pubDate"/></div></xsl:if><!-- /div --><!-- entry content --><xsl:choose><!-- complete text post --><xsl:when test="content:encoded"><div class="content"><xsl:value-of select="content:encoded" disable-output-escaping="yes"/></div></xsl:when><!-- description of post --><xsl:when test="description"><div class="content"><xsl:value-of select="description" disable-output-escaping="yes"/></div></xsl:when><!-- itunes text post --><xsl:when test="itunes:summary"><div class="content"><xsl:value-of select="itunes:summary" disable-output-escaping="yes"/></div></xsl:when><xsl:otherwise><div class="warning rss2 description"/></xsl:otherwise></xsl:choose><!-- entry enclosure --><xsl:if test="enclosure or media:content"><div class="enclosure" title="Right-click and Save link as…"><xsl:for-each select="enclosure"><xsl:element name="span"><xsl:attribute name="icon"><xsl:value-of select="substring-before(@type,"/")"/></xsl:attribute></xsl:element><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute><xsl:attribute name="download"/><xsl:call-template name="extract-filename"><xsl:with-param name="url" select="@url"/></xsl:call-template></xsl:element><xsl:element name="span"><xsl:attribute name="class"><xsl:value-of select="substring-before(@type,"/")"/></xsl:attribute></xsl:element><xsl:if test="@length > 0"><xsl:call-template name="transform-filesize"><xsl:with-param name="length" select="@length"/></xsl:call-template></xsl:if><xsl:element name="br"/></xsl:for-each><xsl:for-each select="media:content"><xsl:element name="span"><xsl:attribute name="icon"><xsl:value-of select="@medium"/></xsl:attribute></xsl:element><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute><xsl:attribute name="download"/><xsl:call-template name="extract-filename"><xsl:with-param name="url" select="@url"/></xsl:call-template></xsl:element><xsl:element name="span"><xsl:attribute name="class"><xsl:value-of select="@medium"/></xsl:attribute></xsl:element><xsl:if test="@fileSize > 0"><xsl:call-template name="transform-filesize"><xsl:with-param name="length" select="@fileSize"/></xsl:call-template></xsl:if><xsl:element name="br"/></xsl:for-each></div></xsl:if></div></xsl:for-each></xsl:when><xsl:otherwise><div class="notice no-entry"/></xsl:otherwise></xsl:choose></section></div></body></html></xsl:template><!-- transform filesize from given length string --><xsl:template name="transform-filesize"><xsl:param name="length"/><!-- TODO consider xsl:decimal-format and xsl:number --><xsl:choose><!-- TODO consider removal of Byte --><xsl:when test="$length < 2"><xsl:value-of select="$length"/> Byte </xsl:when><xsl:when test="floor($length div 1024) < 1"><xsl:value-of select="$length"/> Bytes </xsl:when><xsl:when test="floor($length div (1024 * 1024)) < 1"><xsl:value-of select="floor($length div 1024)"/>.<xsl:value-of select="substring($length mod 1024,0,2)"/> KiB </xsl:when><xsl:when test="floor($length div (1024 * 1024 * 1024)) < 1"><xsl:value-of select="floor($length div (1024 * 1024))"/>.<xsl:value-of select="substring($length mod (1024 * 1024),0,2)"/> MiB </xsl:when><xsl:otherwise><!-- P2P links --><xsl:value-of select="floor($length div (1024 * 1024 * 1024))"/>.<xsl:value-of select="substring($length mod (1024 * 1024 * 1024),0,2)"/> GiB </xsl:otherwise></xsl:choose></xsl:template></xsl:stylesheet>'; domParser = new DOMParser(); xsltStylesheet = domParser.parseFromString(xslFile, "application/xml"); const errorNode = xsltStylesheet.querySelector('parsererror'); if (errorNode) { // parsing failed console.log("parsing failed") } else { // parsing succeeded console.log("parsing succeeded") }
Re: @sjehuda:
Just use
var
orlet
.... it's ES6+ syntax to useconst
... on a note if you are getting a re-declaration error that usually means your script is running in the same identifier context more than once in that particular routine.let
can help with that since it's technically ES5.1 and goes "out of scope" when it hits a bracket.Re: @sjehuda:
Well that leaves the "voodoo" for Fx as far as I can tell.
HTTP headers can (and are) spied on inside the browser... Fx may not know how to handle otters abrupt termination of the message and thus you get a default download prompt with headers that are handled internally (if at all... could just be a silently ended process) and not passed to an extension or even the Browser Console. This could be a feature this could be a bug... unfortunately diagnosing that is beyond the scope of OUJS... but that should give you some things to consider searching for. You'll need to have a decent understanding of CPP and Qt/GNU compiler languages too in order to debug this properly.
You might submit your stack trace to TM and see if he can decipher it a bit more. TM also abstracts a lot of the core JavaScript prototypes (because TM has to to work) and work your way up to bugzilla.
Yes.
I didn't realize that I've not refreshed the page.
Fx says both docs (uri and stylesheet) are valid.
I still don't know what's left to be done, other than sending a bug to bugzilla and they probably worsen the current state in favor of big business and special interest, IMHO.
Conclusion: From my study, this is a deliberate attempt to eliminate the XSLT and XPath technologies.
Boycott Mozilla and it's counterparts that cooperating with it!
This is clearly an attempt to sabotage web feeds, as this article suggests.
To prove my claim, copy and paste one of these scripts to Console and execute.
https://openuserjs.org/scripts/sjehuda/Newspaper
https://openuserjs.org/scripts/sjehuda/Newspaper_(XMLHttpRequest)
Falkon, Otter, Qutebrowser etc. WILL render the XML file into an HTML.
Firefox, however, will produce the following error:
// ==UserScript== // @name Newspaper (XMLHttpRequest) // @namespace io.github.sjehuda.syndication4human // @description Native Feed Viewer. Render syndication web feeds (supports Atom, RDF and RSS) // @homepageURL https://sjehuda.github.io/newspaper.html… undefined Uncaught Exception { name: "", message: "", result: 2153775105, filename: "debugger eval code", lineNumber: 210, columnNumber: 0, data: null, stack: "renderFeed@debugger eval code:210:4\ncheckMediaType@debugger eval code:157:13\nhttpGetAsync/xmlHTTPRequest.onreadystatechange@debugger eval code:97:15\nEventHandlerNonNull*httpGetAsync@debugger eval code:77:3\n@debugger eval code:57:13\n" } debugger eval code:210 renderFeed debugger eval code:210 checkMediaType debugger eval code:157 onreadystatechange debugger eval code:97 (Async: EventHandlerNonNull) httpGetAsync debugger eval code:77 <anonymous> debugger eval code:57 getEvalResult resource://devtools/server/actors/webconsole/eval-with-debugger.js:251 evalWithDebugger resource://devtools/server/actors/webconsole/eval-with-debugger.js:172 evaluateJS resource://devtools/server/actors/webconsole.js:974 evaluateJSAsync resource://devtools/server/actors/webconsole.js:865 makeInfallible resource://devtools/shared/ThreadSafeDevToolsUtils.js:103
A specific mistake of such is very likely intentional, not accidental.
Of note: When I began with XSLT and Javascript (i.e. XSLTProcessor) the MDM documentations were the worst of all others I've found, as if it is intentional by MDM to make people reluctant to XSLT and eventually its great usefulness.
Mozilla officers are welcome to provide an explanation to the above.
Kindly,
Schimon