author Brian Grinstead <>
Tue, 16 Apr 2019 03:50:44 +0000
changeset 469640 c9c0c6f2eed54a187e124942e53c3660b4cf17d8
parent 444991 27b21e84ba9c64b4ea42711cc77f94f5f253e9be
permissions -rw-r--r--
Bug 1544322 - Part 2.1 - Remove the [type] attribute for one-liner <script> tags loading files in /tests/SimpleTest/ in everything except for dom/ r=bzbarsky This excludes dom/, otherwise the file size is too large for phabricator to handle. This is an autogenerated commit to handle scripts loading mochitest harness files, in the simple case where the script src is on the same line as the tag. This was generated with using the `--part 2` argument. Differential Revision:

<!DOCTYPE html>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>        
  <script src="/tests/SimpleTest/EventUtils.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
  <script type="text/javascript" src="NavigationUtils.js"></script>        

<script type="text/javascript">

/* We call using different URIs and make sure the triggeringPrincipal
 * loadingPrincipal are correct.
 * Test1:
 * Test2:



const NUM_TESTS = 2;
var test_counter = 0;

function checkFinish() {
  if (test_counter === NUM_TESTS) {

// ----------------------------------------------------------------------------
// Test 1:
var httpWin ="file_triggeringprincipal_window_open.html", "_blank", "width=10,height=10");
httpWin.onload = function() {
  var httpChannel = SpecialPowers.wrap(httpWin).docShell.currentDocumentChannel;
  var httpTriggeringPrincipal = httpChannel.loadInfo.triggeringPrincipal.URI.asciiSpec;
  var httpLoadingPrincipal = httpChannel.loadInfo.loadingPrincipal;

  is(httpTriggeringPrincipal, TRIGGERING_PRINCIPAL_URI,
     "TriggeringPrincipal for should be the principal of the document");

  is(httpWin.document.referrer, TRIGGERING_PRINCIPAL_URI,
     "Referrer for should be the principal of the document");

  is(httpLoadingPrincipal, null,
     "LoadingPrincipal for should be null");


// ----------------------------------------------------------------------------
// Test 2:
var jsWin ="javascript:'<html><body>js</body></html>';", "_blank", "width=10,height=10");
jsWin.onload = function() {
  var jsChannel = SpecialPowers.wrap(jsWin).docShell.currentDocumentChannel;
  var jsTriggeringPrincipal = jsChannel.loadInfo.triggeringPrincipal.URI.asciiSpec;
  var jsLoadingPrincipal = jsChannel.loadInfo.loadingPrincipal;

  is(jsTriggeringPrincipal, TRIGGERING_PRINCIPAL_URI,
     "TriggeringPrincipal for should be the principal of the document");

  is(jsWin.document.referrer, "",
     "Referrer for should be empty");

  is(jsLoadingPrincipal, null,
     "LoadingPrincipal for should be null");