dom/base/test/test_bug1499169.html
author Makoto Kato <m_kato@ga2.so-net.ne.jp>
Mon, 14 Jul 2025 05:41:12 +0000 (4 hours ago)
changeset 796406 1e02bb4c2af2efa34f8335befa373d2b39383b02
parent 469641 ba6f655fd68963530c866d0d4a48c3db3d307777
permissions -rw-r--r--
Bug 1973726 - Set DOM file path for webkitRelativePath. r=sefeng,geckoview-reviewers,webidl,smaug,ohall Actually, there is no way to set webkitRelativePath from JavaScript. Since GeckoView's folder picker handles virtual file data, we need to set relative path from JavaScript directly. A content URI of System storage document provider only allow file data access from file/folder picker, so there is no way to test it on geckoivew-junit. Also, after landing bug 1591640, GVE always crash when using folder picker. So this includes a fix for it. Differential Revision: https://phabricator.services.mozilla.com/D255615
<!DOCTYPE HTML>
<html>
  <!--
       https://bugzilla.mozilla.org/show_bug.cgi?id=1499139
  -->
  <head>
    <meta charset="utf-8">
    <title>Test for Bug 1499169</title>
    <script src="/tests/SimpleTest/SimpleTest.js"></script>
    <script src="/tests/SimpleTest/SpecialPowers.js"></script>
    <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    <script type="application/javascript">
     SimpleTest.waitForExplicitFinish();

     function test() {
       const OBJLC = SpecialPowers.Ci.nsIObjectLoadingContent;
       let obj = document.getElementById("pdftest");

       obj instanceof OBJLC;
       obj = SpecialPowers.wrap(obj);

       // Make sure we've set our type correctly even though the mime type isn't quite as expected.
       ok(obj.displayedType == OBJLC.TYPE_DOCUMENT, "expected document type");
       SimpleTest.finish();
     }
    </script>
  </head>
  <body>
    <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1499169">Mozilla Bug 1499169</a>
    <object id="pdftest" onload="test()" data="file_pdfjs_test.pdf" type="application/pdf;charset=UTF-8" width="90%" height="600"></object>
  </body>
</html>