devtools/client/inspector/rules/test/doc_blob_stylesheet.html
author Nicolas Chevobbe <chevobbe.nicolas@gmail.com>
Sun, 10 Apr 2016 15:02:48 +0200
changeset 292961 d6a124bce6703f44b28e538510202c42a117d9b2
permissions -rw-r--r--
Bug 1263439 - Remove "blob:" from stylesheet URLs created with URL.createObjectURL; r=pbro There was an error thrown in the stylesheet.js `dirname` function because of `this.safeURL` being like "blob:XXX", and thus not being valid for `Services.io.newURI`. Removing the "blob:" part of the safeUrl before calling the `dirname` function resolves the bug. MozReview-Commit-ID: 9uth6vyAR2u

<!-- Any copyright is dedicated to the Public Domain.
     http://creativecommons.org/publicdomain/zero/1.0/ -->
<!doctype html>
</html>
<html>
<head>
  <meta charset="utf-8">
  <title>Blob stylesheet sourcemap</title>
</head>
<body>
<h1>Test</h1>
<script>
var cssContent = `body {
  background-color: black;
}
body > h1 {
  color: white;
}
/*# sourceMappingURL=data:application/json;base64,ewoidmVyc2lvbiI6IDMsCiJtYXBwaW5ncyI6ICJBQUFBLElBQUs7RUFDSCxnQkFBZ0IsRUFBRSxLQUFLOztBQUN2QixTQUFPO0VBQ0wsS0FBSyxFQUFFLEtBQUsiLAoic291cmNlcyI6IFsidGVzdC5zY3NzIl0sCiJzb3VyY2VzQ29udGVudCI6IFsiYm9keSB7XG4gIGJhY2tncm91bmQtY29sb3I6IGJsYWNrO1xuICAmID4gaDEge1xuICAgIGNvbG9yOiB3aGl0ZTsgIFxuICB9XG59XG4iXSwKIm5hbWVzIjogW10sCiJmaWxlIjogInRlc3QuY3NzIgp9Cg== */`;
var cssBlob = new Blob([cssContent], {type: 'text/css'});
var url = URL.createObjectURL(cssBlob);

var head  = document.querySelector('head');
var link  = document.createElement('link');
link.rel  = 'stylesheet';
link.type = 'text/css';
link.href = url;
head.appendChild(link);
</script>
</body>
</html>