Bug 1187357 - rename referrer attribute to referrerpolicy in tests. r=hsivonen
authorFranziskus Kiefer <franziskuskiefer@gmail.com>
Mon, 30 Nov 2015 16:13:07 -0800
changeset 308940 64bb552ce03ac84f4a7ac3bf9012f71c673ad976
parent 308939 e7614d8b30828e263a000529e69a73e2b1ba83f2
child 308941 a7a1efdcec6ed4b572bcd4b5eadc0700cde879e4
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershsivonen
bugs1187357
milestone45.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1187357 - rename referrer attribute to referrerpolicy in tests. r=hsivonen
dom/base/test/img_referrer_testserver.sjs
dom/base/test/referrer_testserver.sjs
--- a/dom/base/test/img_referrer_testserver.sjs
+++ b/dom/base/test/img_referrer_testserver.sjs
@@ -9,17 +9,17 @@ function createTestUrl(aPolicy, aAction,
 
 function createTestPage(aHead, aImgPolicy, aName) {
   var _createTestUrl = createTestUrl.bind(null, aImgPolicy, 'test', aName);
 
   return '<!DOCTYPE HTML>\n\
          <html>'+
             aHead +
            '<body>\n\
-             <img src="' + _createTestUrl('img') + '" referrer="' + aImgPolicy + '" id="image"></img>\n\
+             <img src="' + _createTestUrl('img') + '" referrerpolicy="' + aImgPolicy + '" id="image"></img>\n\
              <script>' +
 
                // LOAD EVENT (of the test)
                // fires when the img resource for the page is loaded
                'window.addEventListener("load", function() {\n\
                  parent.postMessage("childLoadComplete", "http://mochi.test:8888");\n\
                }.bind(window), false);' +
 
@@ -47,19 +47,19 @@ function createTest(aPolicy, aImgPolicy,
 function createTest2(aImgPolicy, name) {
   return createTestPage('', aImgPolicy, name);
 }
 
 function createTest3(aImgPolicy1, aImgPolicy2, aImgPolicy3, aName) {
   return '<!DOCTYPE HTML>\n\
          <html>\n\
            <body>\n\
-             <img src="' + createTestUrl(aImgPolicy1, 'test', aName + aImgPolicy1) + '" referrer="' + aImgPolicy1 + '" id="image"></img>\n\
-             <img src="' + createTestUrl(aImgPolicy2, 'test', aName + aImgPolicy2) + '" referrer="' + aImgPolicy2 + '" id="image"></img>\n\
-             <img src="' + createTestUrl(aImgPolicy3, 'test', aName + aImgPolicy3) + '" referrer="' + aImgPolicy3 + '" id="image"></img>\n\
+             <img src="' + createTestUrl(aImgPolicy1, 'test', aName + aImgPolicy1) + '" referrerpolicy="' + aImgPolicy1 + '" id="image"></img>\n\
+             <img src="' + createTestUrl(aImgPolicy2, 'test', aName + aImgPolicy2) + '" referrerpolicy="' + aImgPolicy2 + '" id="image"></img>\n\
+             <img src="' + createTestUrl(aImgPolicy3, 'test', aName + aImgPolicy3) + '" referrerpolicy="' + aImgPolicy3 + '" id="image"></img>\n\
              <script>\n\
                var _numLoads = 0;' +
 
                // LOAD EVENT (of the test)
                // fires when the img resource for the page is loaded
                'window.addEventListener("load", function() {\n\
                   parent.postMessage("childLoadComplete", "http://mochi.test:8888");\n\
                }.bind(window), false);' +
--- a/dom/base/test/referrer_testserver.sjs
+++ b/dom/base/test/referrer_testserver.sjs
@@ -28,21 +28,21 @@ function createTestUrl(aPolicy, aAction,
 // if aParams are set this creates a test where the iframe url is a redirect
 function createIframeTestPageUsingRefferer(aMetaPolicy, aAttributePolicy, aNewAttributePolicy, aName, aParams, aChangingMethod) {
   var metaString = "";
   if (aMetaPolicy) {
     metaString = `<meta name="referrer" content="${aMetaPolicy}">`;
   }
   var changeString = "";
   if (aChangingMethod === "setAttribute") {
-    changeString = `document.getElementById("myframe").setAttribute("referrer", "${aNewAttributePolicy}")`;
+    changeString = `document.getElementById("myframe").setAttribute("referrerpolicy", "${aNewAttributePolicy}")`;
   } else if (aChangingMethod === "property") {
-    changeString = `document.getElementById("myframe").referrer = "${aNewAttributePolicy}"`;
+    changeString = `document.getElementById("myframe").referrerPolicy = "${aNewAttributePolicy}"`;
   }
-  var iFrameString = `<iframe src="" id="myframe" ${aAttributePolicy ? ` referrer="${aAttributePolicy}"` : ""}>iframe</iframe>`;
+  var iFrameString = `<iframe src="" id="myframe" ${aAttributePolicy ? ` referrerpolicy="${aAttributePolicy}"` : ""}>iframe</iframe>`;
   var iframeUrl = "";
   if (aParams) {
     aParams.delete("ACTION");
     aParams.append("ACTION", "redirectIframe");
     iframeUrl = "http://" + CROSS_ORIGIN + aParams.toString();
   } else {
     iframeUrl = createTestUrl(aAttributePolicy, "test", aName, "iframe");
   }
@@ -64,45 +64,45 @@ function createIframeTestPageUsingReffer
                  }.bind(window), false);
                </script>
              </body>
            </html>`;
 }
 
 function buildAnchorString(aMetaPolicy, aReferrerPolicy, aName, aRelString){
   if (aReferrerPolicy) {
-    return `<a href="${createTestUrl(aReferrerPolicy, 'test', aName, 'link')}" referrer="${aReferrerPolicy}" id="link" ${aRelString}>${aReferrerPolicy}</a>`;
+    return `<a href="${createTestUrl(aReferrerPolicy, 'test', aName, 'link')}" referrerpolicy="${aReferrerPolicy}" id="link" ${aRelString}>${aReferrerPolicy}</a>`;
   }
   return `<a href="${createTestUrl(aMetaPolicy, 'test', aName, 'link')}" id="link" ${aRelString}>link</a>`;
 }
 
 function buildAreaString(aMetaPolicy, aReferrerPolicy, aName, aRelString){
   var result = `<img src="file_mozfiledataurl_img.jpg" alt="image" usemap="#imageMap">`;
   result += `<map name="imageMap">`;
   if (aReferrerPolicy) {
-    result += `<area shape="circle" coords="1,1,1" href="${createTestUrl(aReferrerPolicy, 'test', aName, 'link')}" alt="theArea" referrer="${aReferrerPolicy}" id="link" ${aRelString}>`;
+    result += `<area shape="circle" coords="1,1,1" href="${createTestUrl(aReferrerPolicy, 'test', aName, 'link')}" alt="theArea" referrerpolicy="${aReferrerPolicy}" id="link" ${aRelString}>`;
   } else {
     result += `<area shape="circle" coords="1,1,1" href="${createTestUrl(aMetaPolicy, 'test', aName, 'link')}" alt="theArea" id="link" ${aRelString}>`;
   }
   result += `</map>`;
 
   return result;
 }
 
 // test page using anchor or area referrer attribute
 function createAETestPageUsingRefferer(aMetaPolicy, aAttributePolicy, aNewAttributePolicy, aName, aRel, aStringBuilder, aChangingMethod) {
   var metaString = "";
   if (aMetaPolicy) {
     metaString = `<head><meta name="referrer" content="${aMetaPolicy}"></head>`;
   }
   var changeString = "";
   if (aChangingMethod === "setAttribute") {
-    changeString = `document.getElementById("link").setAttribute("referrer", "${aNewAttributePolicy}")`;
+    changeString = `document.getElementById("link").setAttribute("referrerpolicy", "${aNewAttributePolicy}")`;
   } else if (aChangingMethod === "property") {
-    changeString = `document.getElementById("link").referrer = "${aNewAttributePolicy}"`;
+    changeString = `document.getElementById("link").referrerPolicy = "${aNewAttributePolicy}"`;
   }
   var relString = "";
   if (aRel) {
     relString = `rel="noreferrer"`;
   }
   var elementString = aStringBuilder(aMetaPolicy, aAttributePolicy, aName, relString);
 
   return `<!DOCTYPE HTML>
@@ -133,17 +133,17 @@ function createRedirectImgTestCase(aPara
   return `<!DOCTYPE HTML>
           <html>
           <head>
           <meta charset="utf-8">
           ${metaString}
           <title>Test referrer policies on redirect (img)</title>
           </head>
           <body>
-          <img id="testImg" src="${imgUrl}" ${aAttributePolicy ? ` referrer="${aAttributePolicy}"` : ""}>
+          <img id="testImg" src="${imgUrl}" ${aAttributePolicy ? ` referrerpolicy="${aAttributePolicy}"` : ""}>
           <script>
             window.addEventListener("load", function() {
               parent.postMessage("childLoadComplete", "http://mochi.test:8888");
             }.bind(window), false);
           </script>
           </body>
           </html>`;
 }