IndexedDB is completely broken in latest Safari
twitter.com
twitter.com
The vast majority of the time we spend diagnosing and working around browser bugs is devoted to Safari. As an iPhone/Mac user and lover of all things Web, I really, really want Apple to get their act together with Safari. We sadly keep running into issues like this.
Here are a few more recent examples:
https://twitter.com/feross/status/1386835131780931587
I've been reporting bugs to WK for years and none have been solved.
Did you know you can't set the dimensions of an iframe in iOS?
But yeah that's not a good idea, really.
We use WebTorrent behind-the-scenes, so we need random access to the end-to-end encrypted version of the files to satisfy requests from peers. So we try to put the files on disk using Filesystem Access API or IndexedDB, falling back to in-memory if there's not enough storage.
As far as I understand Google's recommendation for web developers, of anything [0]. Their position is, avoid localStorage because it's synchronous, use indexedDB because it's asynchronous. So anything you would use localStorage for, Google suggests putting into indexedDB instead.
I don't remember whether the browser API was expected to get AsyncLocalStorage like the Node API has, or whether that would change Google's recommendations for developers.
How can they get away with this? That's like 10 times worse than what Microsoft was doing with ie in 00s and they got fined over it so many times.
[0] https://gs.statcounter.com/os-market-share/mobile/united-sta...
Hopefully the anti-trust investigations in the US, the EU and other parts of the world will change that...
So foisting the blame on webdevs by calling them lazy feels a bit out of place.
Apple has underinvested in Safari for years. It is clear that they have no intention in setting the direction for the web.
Edge 7.75%
Firefox 7.48%
Internet Explorer 5.21%
Safari 3.71 %
Why would Safari be the one that's important and not firefox?
And why would it mean that Apple gets to be an asshole about it?
Mobile Safari matters because that's where the money is.
As for why Apple gets to be an “asshole,” there’s no specific privilege granted, inconsistencies are just the nature of the web platform. They probably don’t devote enough resources to minimizing them, but that’s tangential.
A few months ago, Chrome broke all WebView-based apps. Fortunately, they fixed it within a day. The IndexedDb bug was fixed after 6 weeks.
I reported a bug in 2016 and it's still open.
Another bug I reported in early 2020 doesn't even have an answer from the team.
I suppose if they feel like they are big enough to bully websites into just working around long standing bugs, that may be intentional as well.
Well done on your viral tweet that got some personal attention from Apple. Usually when I spend days narrowing down Safari bugs to minimal reproducible test cases, finding workarounds, and writing everything up in detail on the webkit bug tracker the only public response from Apple is the radar importer bot, and then everything goes quiet.
Btw, your original twitter thread implies you were the author of the bug report. Minor annoyance, but I did spend quite a while writing that up :)
I find the Chromium team much more willing to engage directly and constructively on their bug trackers at least.
Also: Didn’t mean to imply I wrote that report. We were about to open a duplicate issue before noticing yours. Thanks!
We've definitely had the same experience of Safari introducing way more issues with new releases than Chrome, and the fact it's part of the iOS image seems to make quick patching just never really an option.
I just wish they'd engage a bit more directly on the bug tracker - find it hard to believe that twitter is a more effective means to get attention on bugs.
Then I loaded up my 2005-vintage personal wiki which has been working fine for 15 years on all the browsers I use (Chrome and Firefox).
And it has a tabindex bug in Safari!
https://stackoverflow.com/questions/1848390/safari-ignoring-...
I'm not sure but isn't this a violation of the spec? Or is there some newer thing for tabindex? Either way I switched back to Firefox and Chrome.
I kinda like the idea of a browser that doesn't implement all the Chrome crap. But I also feel like it should interpret 15 year old pages correctly!
If this were a commercial product (my wiki), there would be a bug in the tracker for it :) In the link people have given JS workarounds.
That's been my experience as well.
When reporting a bug to Chromium you get an answer in hours.
When reporting a bug to WebKit it's mostly crickets.
Then you can go to their code comparison page[2] and wonder what the hell they were on about.
> IndexedDB generally simplifies the programming model for interacting with databases, and allows for a wide number of use cases.
They can't be looking at the same code - what have they improved other than to use more Javascript?
The sooner it dies the sooner an alternative can appear… SQLite3, anyone?
[1] https://hacks.mozilla.org/2010/06/beyond-html5-database-apis...
[2] https://hacks.mozilla.org/2010/06/comparing-indexeddb-and-we...
But yeah the assertion that indexeddb is any good is hardly convincing.
Nowadays you can use sqlite3 through wasm if you want, though I don’t know how you’d handle the persistence layer.
There was a post on here in the last month or 2, atleast for reading, that used http range headers for reading the db pages.
as for writing, you're gonna hate this, but a vfs impl. for SQLite using indexedDB as the backing store is your best option (Safari stupidity not withstanding)
That was for a local SQLite doing remote loads/stores, I was thinking more local loads/stores, what websql would have provided.
> as for writing, you're gonna hate this, but a vfs impl. for SQLite using indexedDB as the backing store is your best option (Safari stupidity not withstanding)
Yeah that’s what I was figuring out but then it feels like the SQLite bits are significantly less useful, and I’m not sure how good indexeddb is at being a block device.
P.S. SQLite doesn't have a spec. Once you start really using it and bumping into version differences, extensions, etc., you'll really feel the pain caused by this.
Not after Google and Apple get their hands on it.
And no, it's not the same as mandating SQLite.
Yes, that would be the smart choice. But alas.
Like, does anybody here really think their actual complaints are about some minutae about wording in a spec about "mandates" or whatever? Their rejection is quite clearly against the spirit of the design, and again because because they don't think multiple browsers each independently reproducing a whole SQL stack with equivalent semantics is viable. It's not about technical nits or wordsmithing, little coder-logic-tricks aren't going to work.
Why would they think it’s more viable as a JavaScript spec than a SQL one? It seems to me it’s about retaining control and about giving what some web devs want - JavaScript everywhere.
If you write the spec to not be compatible with SQLite then every browser has to implement its own SQL layer which is a huge effort and frankly a waste because SQL is kinda shit.
I've built a web-app heavily relying on IDB, and storage operations are generally much faster than the native app on Android using Realm DB. IDB is backed by leveldb on Chrome, which in benchmarks is consistently faster than sqlite. I'm happy we didn't end up with websql for one.
My biggest gripes are: - The incompatibility with ES6 promises early on (but IE11 still suffers from) was unfortunate. - The auto-commit behaviour of transactions is somewhat annoying and usually has an impact on your architecture if you want to write multiple things in one transaction, but it would have been easy to have memory leaks and deadlocks without this. - Quota management and eviction is wildly inconsistent between browsers, even on Chrome you get evicted when storage gets critically low. - Safari has a history of pretty bad IDB bugs.
SQLite has a _lot_ of great features. Many of them only introduced in recent versions, and many of them are optional extensions enabled at compile-time. There is no feasible way to standardize this to get the same functionality across all browsers.
IndexedDB may not be great to work with (at least not without helper libraries), but at least the API surface is small, and much easier to ensure you get the same behaviour in all browsers.
I'd rather advocate for a proper block-level filesystem API that could be used as backing storage for a WASM SQLite library.
No it was never the right choice and it didn't need to become standardized at first place. Writing a query builder is an easy task, implementing a RDBMS on top of indexedDB, ironically implemented on top of SQlite in Firefoxis a much harder tasks.
IndexedDB is absolutely atrocious API wise, and largely useless to query structured data.
This is happening at https://web.dev/storage-foundation/ fwiw
As for SQLite, as lovely as that'd be, NOONE wanted to spend R&D on building a "SQLite clone" for the web SQL spec, and I can't blame them, how the hell can you justify that effort when SQLite exists and is crazy well tested and proven?
Let's say you need to search for age > 19 and less than 30 for a person with the name of Jane or John.
That's nothing complicated, but indexedDB CANNOT DO THIS. I suppose you could do it by iterating every single data entry, but that's a performance no-go for even relatively trivial databases.
Likewise, joins on different stores simply don't exist. Iterating every entry in this case is O(N^2).
Might as well just store a giant JSON blob instead.
Quite literally, my only use of indexedDB these days is storing a SQLite file and whatever interactions PouchDB has (I think they are mostly limited to linking an ID with a JSON blob). Adding insult to injury, despite being a simple key/val store, it's SLOWER than SQLite too.
I’m pretty sure you can do that. You can create an IDBIndex that covers multiple fields, then narrow down the search using key ranges. Though, even with key ranges, narrowing down results based on multiple independent ranges requires some manual work:
https://gist.github.com/inexorabletash/704e9688f99ac12dd336
But at least algorithmically speaking, that’s roughly the same thing that a database natively supporting such queries would be doing, so the big-O performance should be the same. Though I wouldn’t be surprised at all if it’s slower in practice.
All doable, but quite a lot of work. Once you start looking at the details, every single database has its own SQL dialect and they're not all that compatible except for the simplest queries.
Which is implemented on top of Sqlite in many browsers, what a joke.
It's easier to implement IndexedDB on top of a SQL database than the other way around, so people claiming IndexedDB is "lower level" are ignorant.
There's even recent work to add even higher performance APIs into the Filesystem Access API and the reception from Firefox and Safari has been positive. Really early work is happening here: https://github.com/WICG/storage-foundation-api-explainer and the latest proposal is here: https://docs.google.com/document/d/121OZpRk7bKSF7qU3kQLqAEUV...
Positive as in: "FileSystem Access is a significant security risk and we're not going to implement this"? https://www.chromestatus.com/feature/6284708426022912
Positive as in "No, we don't want fifteen different file access apis, and we don't think Storage Foundation API is going anywhere"? https://www.chromestatus.com/feature/5670244905385984
And even though this is a draft created and authored exclusively by Googlers, even other Googlers are confused: https://github.com/WICG/storage-foundation-api-explainer/iss...
Good. Still doesn't mean there's positive feedback.
> if they only implement the Origin Private part of the spec there’s no more risk than IndexedDB since it doesn’t interact with the real file system.
If. Or it may go the HID way: https://news.ycombinator.com/item?id=27512354
I wouldn't hold my breath for "positive feedback" on these APIs.
Right now the Mozilla position is 'defer', not 'harmful'. See https://mozilla.github.io/standards-positions/#native-file-s....
That means yes, they're not implemented today, but they're open to doing so later on, given further specification development and real-world investigation to confirm that the security implications are minimal.
> No, we don't want fifteen different file access apis
Looks like there is some ongoing work to synchronize these APIs to resolve that concern: https://docs.google.com/document/d/121OZpRk7bKSF7qU3kQLqAEUV...
---
I 100% agree Google is too aggressive at publishing and releasing these features without widespread consensus from other vendors. If they were doing so with just origin trials or behind a flag that would seem reasonable to me, but the widespread release is surely going to cause problems for these specs, when they must be aware that further development and changes is going to be required. I'm not clear how they intend to mature these standards without breaking the early adopters.
I don't agree they're not desirable features though. Honestly I desperately wish Safari & Firefox would engage more and drive these specs themselves! It would be better to get their voices in the decisions that'll define these specs, rather than letting Google define the future of the web all by themselves.
There's clearly demand for these features (read the comments of https://github.com/mozilla/standards-positions/issues/154 for some examples). It would be better to have privacy and security baked in with input from a broad group of actors (I think we can all agree that Firefox is going to be a more useful voice than Google in that sense). It's not helpful to let Google run off and write every standard themselves, with other browsers watching from the sidelines until it's sufficiently done (and unchangeable) and then having to either adopt the existing standard as-is by necessity or to refuse to support many real world web applications (for as long as that's tenable).
Make no mistake - Chromium has the market share to be a workable target, and these APIs work well for developers and are genuinely useful. They will be used. There will be (in some areas there already is) a whole world of web apps using these APIs which only work in Chromium by necessity, no matter how much they'd like to support other browsers. As those get adopted by users, that's only going to drive the web further towards Chromium, until other browsers have to die or adopt the (entirely Google-written) standards themselves too to support the next generation of webapps.
This is happening on desktop in some areas already. In IDEs, for example - if you buy any IoT based on Espruino, the primary dev tool only works in Chrome due to WebUSB/WebBluetooth (https://www.espruino.com/Web+IDE), while tools like Godot Editor are already talking about Chrome-only save/load support using these filesystem APIs (https://godotengine.org/article/godot-editor-running-web-bro...), and I'd be extremely surprised if GitHub Codespaces and other tools aren't looking at doing the same. These are popular tools - many users want to use them, and they will have to switch to a Chromium-based browser to do so.
Mobile is somewhat protected due to Safari being the only option on iPhone, but I wouldn't be surprised if the ongoing antitrust cases force them to open that up to make PWAs look like a plausible app store competitor, and the exact same thing happens there.
WebExtensions is a case study of the same effect in the past. Chromium has so much weight that once they fully design and adopt an API and build an ecosystem around it, other browsers have to follow or get cut off. If Firefox & Safari had engaged with WebExtensions much earlier, they could have been driving it themselves and building consensus. Instead, they've had to copy every Google API while just tweaking around the edges.
One exception, interestingly: Brave is doing some intriguing work on driving decentralization APIs for the web (native Web3, native IPFS). It's early days, but I'm hopeful that this might have the same effect in the opposite direction for those features!
However, Chrome simply inundates them with APIs. There are 50 to 100 new APIs that Chrome releases with each new version. And a new version comes out once every two months. So, Firefox and Safari have to be "actively engaged in discussions" on 300 to 600 new APIs a year [1].
This is not sustainable in any way, shape, or form. Hell, Microsoft gave up on developing a browser of their own, and they are definitely not lacking in resources. How is Mozilla expected to cope? Safari has decided to set their own pace, and flat out refuse APIs that breach security and privacy, because by this time Chrome teams should really know better (if only they cared).
So, no, it's not true that Mozilla and Safari are "not engaged at an early stage". They are, to the best of their abilities and resources. But they also have browsers to develop, and in the end there are only so many hours in the day.
That said, that API count is referring to individual methods & fields (see https://web-confluence.appspot.com/#!/catalog) not whole specifications. I'm mainly concerned about them reviewing and making contributions to write these specs, rather the work to fully implement them, so that at least they end up with something they might be happy implementing in future.
Either way, if every few months Chrome can genuinely churn out hundreds of APIs that developers genuinely want and use (a big caveat!) and Firefox/Safari can't keep up, then that's game over. Chromium has the market share, people will start using these APIs, serving a relatively worse and worse version for the slower browsers (if they bother), and eventually the older browsers will either have to implement them to according to these defacto standards, design & implement a sufficiently better alternative somehow, or die (for the average user, at least).
Firefox beat IE last time because it took the 2nd option: it had better alternatives to Microsoft's non-standard web technologies (primarily: consistent APIs backed by clear standards and good tools that solved the same problems) and thereby managed to capture web developers and lead the compatibility game, rather than following. I don't see how they can do the same again if they can't propose workable alternatives to new standards other than 'defer' or 'reject'.
It very much is, and has been for a while: Google completely dominates all of web-related standards bodies. And the specs that are rushed to completion in Chrome are more likely than not to be fully authored by Googlers only (sometimes with egregious disregard for standards work, see WebHID [1]).
[1] Issue https://github.com/mozilla/standards-positions/issues/459#is... and timeline https://news.ycombinator.com/item?id=27512354
Assuming that then, if we want healthy web standards then it sounds like the only option is to shut down Firefox et al ASAP (or make it another chromium wrapper) and spend that engineer time & money instead getting involved in these specs and Chromium development to try and provide non-Google input and ideas, and somehow transform Chromium itself into a community endeavour. If there's an inevitable chromium monopoly then that seems like the only choice. Unless something else blocks the chromium monopoly, e.g. Google antitrust of some sort, but that doesn't seem imminent (for Chrome specifically).
A somewhat bleak future, but if this becomes inevitable then that seems like the best option unfortunately.
Well, I could not help myself.
>> While versions of Safari, Chrome, and Opera support a technology called Web SQL Database, which uses SQL statements as string arguments passed to a JavaScript API, we think developer aesthetics are an important consideration, and that this is a particularly inelegant solution for client-side web applications.
>> We .. also spoke with Microsoft, who agree with us that IndexedDB is a good option for the web
OMG!! MS thought not doing what Apple and Google wanted was a good option. Earth shattering.
As for the code examples, both sets look horrible, but this and "_developer aesthetics_" don't go together. This is how they think their `JOIN` is "better" than SQL `JOIN`.
candyEaters = [];
function displayCandyEaters(event) {
var display = document.getElementById("purchaseList");
for (var i in candyEaters) {
display.textContent += ", " + candyEaters[i].name + "bought " +
candyEaters[i].count + "pieces";
}
};
var request = window.indexedDB.open("CandyDB",
"My candy store database");
request.onsuccess = function(event) {
var db = event.result;
var transaction = db.transaction(["kids", "candySales"]);
transaction.oncomplete = displayCandyEaters;
var kidCursor;
var saleCursor;
var salesLoaded = false;
var count;
var kidsStore = transaction.objectStore("kids");
kidsStore.openCursor().onsuccess = function(event) {
kidCursor = event.result;
count = 0;
attemptWalk();
}
var salesStore = transaction.objectStore("candySales");
var kidIndex = salesStore.index("kidId");
kidIndex.openObjectCursor().onsuccess = function(event) {
saleCursor = event.result;
salesLoaded = true;
attemptWalk();
}
function attemptWalk() {
if (!kidCursor || !salesLoaded)
return;
if (saleCursor && kidCursor.value.id == saleCursor.kidId) {
count++;
saleCursor.continue();
}
else {
candyEaters.push({ name: kidCursor.value.name, count: count });
kidCursor.continue();
}
}
}It's built on top of Sqlite in Firefox, it isn't "low level". Give me Sqlite directly instead of that horrible stuff.
Just because someone used this technique for some technical reason does not change the fact that indexedDb is an API, is not built on top of SQLite, and is lower level, because you could build SQL databases on top of it.
Why do you keep on claiming that? No it is not lower level than SQL. It's trivial to implement IndexedDB on top of of a SQL database. Good luck doing the other way around and that's the whole point of things. SQlite does everything IndexedDB does and more.... indexedDB isn't lower level, it's just more basic and limited. I have yet to see a SQL database equivalent to SQlite implemented on top of IndexedDB.
So yes it is absolutely possible to implement a SQL database on top of indexed DB, and that would be the architecturally logical thing to do.
The fact that Firefox goes the other way around is an implementation detail. What they did is called « emulation »: run a low level interface on top of a higher level one. This technique is very common and does not mean that the abstraction levels of API are suddenly magically reversed. It’s just an implementation detail of the architecture.
You can run NES code in an emulator in JavaScript on the web. Does this make NES assembly higher level than JavaScript ? No.
SQL isn't an API. It's a language. Something to query a SQL database in the browser would constitute the API (thus WebSQL). You are mixing up language and API here. That's your first mistake.
> So yes it is absolutely possible to implement a SQL database on top of indexed DB, and that would be the architecturally logical thing to do.
And it's trivial to implement indexedDB over Sqlite, in fact, that's what Firefox did.
Where is the other way around? Where are RDBMS implemented on top of indexedDB?
> The fact that Firefox goes the other way around is an implementation detail.
No it isn't. It demonstrates my point entirely, that it is trivial to implement indexedDB on top of Sqlite, which makes Mozilla developers a bunch of hypocrites for not letting developers access an Sql layer directly.
I'll let you try to reconcile yourself about why "Mozilla developers are a bunch of hypocrites". I presented to you a very straightforward explanation that does not imply bad intent from an entire group of people.
I am sorry that this explanation does not fit your world view.
To me, what you say is the equivalent of saying « assembly is higher level than JavaScript because someone implemented a virtual machine that runs assembly code, in JavaScript in the browser ».
Just because someone at Mozilla used this technique for some technical reason (it is indeed often easier to emulate low level stuff on top of high level stuff, rather than the opposite) does not change the fact that IndexedDB is an API, is not built on top of SQLite, and is lower level than any API based SQL.
https://computersciencewiki.org/index.php/Higher_level_and_l...
IndexedDB builds on top of SQLite, so it's considered "higher-level", not lower level.
So yes it is absolutely possible to implement a SQL database on top of indexed DB, and that would be the architecturally logical thing to do.
The fact that Firefox goes the other way around is an implementation detail. What they did is called « emulation »: run a low level interface on top of a higher level one. This technique is very common and does not mean that the abstraction levels of API are suddenly magically reversed. It’s just an implementation detail of the architecture.
You can run NES code in an emulator in JavaScript on the web. Does this make NES assembly higher level than JavaScript ? No.
It made me really angry at Mozilla. WebSQL was so invaluable to me.
If you need to store more data, why not do it on the server? What are the use cases for having a full-blown relational db client-side?
So is PHP according the infallible SV pundits.
> it's also unnecessary, as you can store a significant amount of data in localStorage and the API is extremely simple to use.
Either you've never actually tried to store significant amounts of data in localstorage, or you're from the era of "640k is enough".
To say nothing of having no indexing functionality with localstorage, or paying the 33% base64 tax to put anything remotely binary into it.
> If you need to store more data, why not do it on the server?
"Because there is always, ALWAYS a high speed, low latency 100% uptime connection" /s
In answer to your last question, we have developed two PWAs reliant on local databases.
1. Was a product catalogue for use in stores, letting users filter down to select a particular appliance. two key requirements were that not all stores had great wifi coverage, and they wanted to easily update the catalogue (which meant no app recompilation).
So, Dexie atop IndexedDB, with indexes on the various facets for searching, and a simple settings page to run a sync. Dexie stored the product data, and a "immutable" SW cache strategy was used to keep the images available.
2. A detailed report generation app, Key requirement, must work with patchy connectivity as reports need to be taken in the field with unknown signal availability. Reports are locally stored and synced periodically (connection permitting). Again, Dexie atop IndexedDB, this time the images stored in the db as blobs prior to upload.
Sarcasm is unnecessary but I'll admit that so is the word "cancer".
Your first example is a great one, although the catalog would have to be really huge to not fit in memory; and since it is static (the users don't update it) it can be upgraded by downloading a json file regularly?
The second example doesn't explain why you would need a relational db.
Anyway my point is not to second guess applications that run well, and even less to argue with people who have already mastered IndexedDB -- good for them!
My point is for people on the fence to take a good, hard look at what's possible with localStorage and make sure that before they embark on the IndexedDB voyage, they are absolutely, positively certain that they have no other choice.
I recently came across an app that stores a couple of user preferences on IndexedDB; the funny part is that the comments complain for paragraphs about its quirks and general unpleasantness. The time spent complaining in the source would have been better spent switching to localStorage.
Irrelevant, nobody is forced to use PHP as a server side technology. On the other hand, browser API are limited with what browser vendors implement, so there is no choice.
Easier / cheaper to host only static files.
I must admit there's a bit of schadenfreude in knowing that Firefox is almost irrelevant now, while SQLite keeps going from strength to strength.
> I have identified the regression point and assigned the bug to somebody. Thank you for the bug report. We will try and get this fixed ASAP.
I just added a section on Safari's storage related bugs, of which there are many. Amazingly, IndexedDB broke in Safari 14.1.1 after localStorage broke in Safari 14.1, released a month earlier.
Bugs.
Especially for a browser engine where you have a ridiculous number of testing permutations to cater for.
This is something that should have been caught by automated tests.
There’s basically no automated test suite even for CSS 2.1 that all vendors can rely on that matches behavior specified by the standards.
Luckily standards like that are so mature that it’s not needed as badly, but it definitely keeps incumbents safe from competition.
But for others who don't know:
https://web-platform-tests.org/
https://github.com/web-platform-tests/wpt/tree/master/css/CS...
They’re also tests that don’t actually point anything out.
Take the CSS2 tests for example, https://wpt.live/css/CSS2/, I can’t do basically anything with these. They don’t tell me whether or not a particular part of the implementation has failed. They’re all basically arbitrary tests that sort of cover the appropriate properties, sometimes, maybe.
The biggest glaring issue is that the test runners run in the browser. Well, if my user agent doesn’t have JavaScript… I can’t “run” the tests.
Further, there are some parts of the standard that can’t be automated simply because it’s up to user agents to decide how the final rasterization turns out. You can’t just compare rasterization output or even reliably look for element heights for verification based on the differences between font rasterization.
This is also why a part of the suite requires manual verification.
What I really need as an implementor is the ability to point my software at some .html files, get some failures, add more implementation, get less failures, and repeat. With, of course, the caveat being that you can only really do this for what is well-defined in the standards.
But you can’t do that easily with the wpts.
I'm not really sure I follow your complaint, so I wonder if there's a point of misunderstanding. The tests written for DOM APIs certainly require running javascript to execute the test — that's a given — but most of the rendering tests are reftests. These consist of two files, one using the feature under test and one avoiding that feature [1]. The test passes when the two renderings are identical. That does make these tests difficult to run "by hand", but in terms of implementation it's possible to automate in anything that's capable of rendering to an image. Reftests are preferred over comparing rendering to a fixed image because fixed images tend to be invalidated due to unrelated/permitted changes in the rendering (e.g. a different font or different antialiasing choices). These will typically apply to both test and reference and so are handled automatically.
Reftests obviously aren't suitable to bootstrap getting very basic things working, so there are some manual tests; I suppose one could hope to avoid that by inventing a special kind of output inspection automation just for those basic tests, but it's hard to justify.
IN general, however, the "the ability to point my software at some .html files, get some failures, add more implementation, get less failures, and repeat" is exactly what wpt offers. There is some work required to stand up the necessary infrastructure to run the tests automatically, but it's common for new implementations of the platform to make use of web-platform-tests (e.g. Servo and Flow have both made use of wpt).
In terms of coverage it's very difficult to demonstrate that all the requirements of a spec, and all its interactions with other specs, are completely covered. There have been various proposals for adding test metadata to try to measure coverage, but these have largely proved impractical. Nevertheless some CSS specs have links from the spec to the relevant test cases. And if you find cases that aren't covered by exisitng tests it would be great to get a PR to add new tests [2]
[1] https://web-platform-tests.org/writing-tests/reftests.html [2] https://github.com/web-platform-tests/wpt
It is unacceptable to me to use the software I’m testing to test itself if I can’t establish a baseline for the rest of the tests.
Otherwise, all of the tests could be invalid one day based on a regression and I wouldn’t know. But this is explicitly done with reftests.
And I don’t know what you’re talking about with the DOM API tests, there are several layout and compositor tests that require JavaScript and it’s unclear why other than the test author decided to use JavaScript to verify DOM metrics. That’s fine, I just don’t want that in my layout tests.
I’m OK with a subset of the tests just not being automated based on font rasterization and line height calculations. The standards make those expectations clear, but everything else feels like fair game to me.
I can either test for it, or I can’t. If I can’t, it’s not automated. And if it’s automated, I need information about what is failing, and much of the reftests don’t explicitly point out what they’re testing. The assert data is useful when it’s available, but even then sometimes test authors neglect to point out explicitly what they’re testing for.
Plenty of the layout tests in particular are just box model renders that should match with no explanation as to what section or text is being tested against. That’s just not acceptable. It’s not even about interactions between specs, the specs isolated are not well tested.
If you’re testing, let’s say, the width calculation of a box based on children boxes’ widths in normal flow, it needs to say that. And I think I’ve only ever see some of WebKit’s test’s help links reference actual sections.
Otherwise the WPT provide little to no value to me.
My team has been better off writing our own tests because we directly refer to the recommended or living standards texts by section, quote it and link to it, and as a result there’s no ambiguity about what property, calculation, or raster output we’re testing for.
Because a cursory glance at Chromium src tells me they do have automated tests for IndexedDB:
https://source.chromium.org/chromium/chromium/src/+/main:con...
However, if you do stumble on some tests for basic things like the box model, I'd love to know where they are! Tests like those would allow other vendors to know whether or not they're adhering to specification, programmatically.
Earlier standards are very descriptive, rather than telling you how to implement the actual web technologies. That's left as an exercise for the reader. Seriously!
I guess applications living in the browser don't align well with Apple's interest in pushing their app store.
There actually are some partial tests from the W3C regarding basic web technologies, but they're not really automated ones in the way you'd think.
I only mean to say that you don't need a whole compliance testing suite to catch a major bug like this.
Its not really a test suite, but back in the early days of CSS we had https://en.m.wikipedia.org/wiki/Acid2 It'd be easy to write a set of tests based on Acid2.
There's also https://en.m.wikipedia.org/wiki/Acid3 but that doesn't quite test things 'properly'.
In addition the specs have changed somewhat so now CSS 2.1 and the modules that existed at that point in time have matured beyond what the tests were written for, so a browser matching the spec today would fail.
They were very fun for end users to see whether or not a browser was in compliance, though!
Such an effort would probably involve a higher level of ongoing support from the vendor side of the fence (in terms of motivation and iterative discussion etc), but relative to other options might be, as I said, the path of least resistance.
</armchair_idea>
https://github.com/WebKit/WebKit/tree/main/LayoutTests/stora...
Testing browsers is a daunting task. A modern browser is 10-15 million lines of code with literally thousands of exposed APIs [2]
[1] https://www.pcgamer.com/a-google-chrome-update-breaks-the-au...
My favorite one was websites added to the home screen on an iPad would have the clock displayed above the websites if you rotate the iPad after opening a website. It wasn't fixed for years and it may still be there.
As with every race condition (cross process, too, so tools like TSAN don't help), testing for the absence of race conditions is hard.
Apple made it easy for themselves to have zero competition in browser engines.
im tempted to just x out the safari logo on mine since it likely cant be tested
It has the fastest UI, uses the least memory and uses a fraction of the battery life compared to all other browsers.
And from what we've seen in Monterey they are continuing to invest heavily in improving it.
lol, no. they're not. Safari specially on mobile is a joke and a bad one at it. Their whole strategy is to pull you into there Appstore and monetize every part of it and keep Webapps at a disadvantage
My answer would be that the landscape of the web, advertising and software ecosystems are drastically different today.
If you're on about features? Ask Apple why they shy away from them on the web? Hard to justify imposing the 30% cut on a website/app.
Hell, Apple could have lead the charge on "web app privacy", implement the specs they've "missed" for web (notifications, background sync etc), and GATE THEM TO PWA/installed web apps, no more news sites asking to notify you when you just go to an article.
Heck, add keys to the web app manifest so as a developer I need an Apple Dev account and the holy $99 entry fee as well as my personal info in Apple's hands to make sites that do these things, so they have recourse to nuke the bad actors.
Because web developers can absolutely be trusted to do the right thing.
Being able to deploy a PWA that avoided the 30% cut Apple takes for all digital content would suit many users very, very well.
Another dev and I are creating a few 3D web projects, one of which is a decentralized web gaming platform for Unreal Engine 4 indie developers to ship their projects directly to their audience without needing to go through walled gardens like the App Store.
Will DM you on Twitter as well!
> * File System Access API (https://web.dev/file-system-access)
You realise, right, that Firefox is also not keen on implementing this api? [1] And many others [2]
Yeah, Mozilla used to be the beacon of Web standards, what happened to them? They always find some silly justification to refuse implementing a spec, like WebSQL, half of the Web Component spec, and many many other things, what gives?
Chrome might be "bad" cause Monopoly, but Google is much much more pro-active in implementing useful standard proposals.
They still are. Only now Google inundates everyone with Google-designed Chrome-internal "standards", and releases them against any objections.
See WebHID as the best example of this: Issue https://github.com/mozilla/standards-positions/issues/459#is... and timeline https://news.ycombinator.com/item?id=27512354
That seems rather contradictory
That doesn't change the fact that the API we initially tried to use was completely broken.
Like, maybe the service we needed to supply with data had a REST API which turned out to be completely broken, so we ended up reverting to generating XML files and uploading that via SFTP. That the data ended up where it needed to doesn't change the fact that their REST API was broken.
A file server which claims to store files for late retrieval but saves all incoming files to /dev/null is completely broken from the user POV, while it's likely not beyond repair.
We should focus on reducing browser feature creep. There's hundreds of features and most of them are barely used or legacy
And I think the answer is that, no, it did not. And I suspect that we'll end up in a wasm-first world eventually anyway, just with a lengthy and inconvenient detour. But it's worth remembering that IndexedDB predates wasm by several years.