File: 003-manual.html

package info (click to toggle)
firefox 145.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,653,528 kB
  • sloc: cpp: 7,594,999; javascript: 6,459,658; ansic: 3,752,909; python: 1,403,455; xml: 629,809; asm: 438,679; java: 186,421; sh: 67,287; makefile: 19,169; objc: 13,086; perl: 12,982; yacc: 4,583; cs: 3,846; pascal: 3,448; lex: 1,720; ruby: 1,003; exp: 762; php: 436; lisp: 258; awk: 247; sql: 66; sed: 54; csh: 10
file content (95 lines) | stat: -rw-r--r-- 5,735 bytes parent folder | download | duplicates (33)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<!doctype html>
<html>
  <head>
    <title>allowTargetOrigin valid syntax</title>
    <style type="text/css">
div { float: left; height: 100px; width: 100px; margin-right: 10px; background: orange; }
iframe { height: 100px; width: 100px; border: none; }
.note { float: right; color: silver; }
    </style>
    <script type="text/javascript" src="../resources/crossorigin.sub.js"></script>
    <script type="text/javascript">
function addNote(el,str) {
  var par = document.createElement(el);
  par.textContent = str;
  document.body.appendChild(par);
}
function testFrame(text,frameorigin,framepath) {
  var persist = arguments;
  addNote('p',(done++)+'. '+text);
  var div = document.createElement('div');
  var frame = document.createElement('iframe');
  frame.src = frameorigin+framepath;
  div.draggable = true;
  div.ondragstart = function (e) {
    e.dataTransfer.effectAllowed = 'copy';
    e.dataTransfer.setData('text','dummy text');
    for( var i = 3; i < persist.length; i++ ) {
      e.dataTransfer.allowTargetOrigin(persist[i]);
    }
  };
  var par = document.createElement('p');
  par.className = 'note';
  par.appendChild(document.createTextNode('Target: '+frameorigin));
  par.appendChild(document.createElement('br'));
  par.appendChild(document.createTextNode('Allowing: '+([]).slice.call(persist,3).join(' and ')));
  if( framepath.match(/\?domain\b/) ) {
    par.appendChild(document.createElement('br'));
    par.appendChild(document.createTextNode('document.domain set to parent domain'));
  }
  document.body.appendChild(par);
  document.body.appendChild(div);
  document.body.appendChild(frame);
}
var done = 1;
window.onload = function () {
  var allowText = 'Drag the orange box below over the blue box the right, and release it. Fail if nothing happens in the blue box.';
  var blockText = 'Drag the orange box below over the pink box the right, and release it. Pass if nothing happens in the pink box.';
  var allowHelper = location.pathname.replace(/[^\/]*$/,'HELPER-mustallow.html');
  var blockHelper = location.pathname.replace(/[^\/]*$/,'HELPER-mustblock.html');
  if( location.hostname != httpHostMain || location.host != httpHostMain ) {
    addNote('p','This test must be loaded over http:\/\/'+httpHostMain+'\/');
  } else {
    /* 01 */ testFrame(allowText,'http://'+httpHostMain,allowHelper);
    /* 02 */ testFrame(allowText,'http://'+httpHostAlias,allowHelper);
    /* 03 */ testFrame(allowText,'http://'+httpHostMain,allowHelper,'*');
    /* 04 */ testFrame(allowText,'http://'+httpHostAlias,allowHelper,'*');
    /* 05 */ testFrame(allowText,'http://'+httpHostMain,allowHelper,'/');
    /* 06 */ testFrame(blockText,'http://'+httpHostAlias,blockHelper,'/');
    /* 07 */ testFrame(allowText,'http://'+httpHostMain,allowHelper,'http://'+httpHostMain);
    /* 08 */ testFrame(blockText,'http://'+httpHostMain+':'+httpPortAlias,blockHelper,'http://'+httpHostMain);
    /* 09 */ testFrame(blockText,'http://'+httpHostAlias,blockHelper,'http://'+httpHostMain);
    /* 10 */ testFrame(blockText,'http://'+httpHostAlias,blockHelper,'http://'+httpHostMain);
    /* 11 */ testFrame(allowText,'http://'+httpHostMain,allowHelper,'http://'+httpHostMain+':80');
    /* 12 */ testFrame(blockText,'http://'+httpHostMain+':'+httpPortAlias,blockHelper,'http://'+httpHostMain+':80');
    /* 13 */ testFrame(allowText,'http://'+httpHostMain+':'+httpPortAlias,allowHelper,'http://'+httpHostMain+':'+httpPortAlias);
    /* 14 */ testFrame(blockText,'http://'+httpHostMain,blockHelper,'http://'+httpHostMain+':'+httpPortAlias);
    /* 15 */ testFrame(blockText,'https://'+httpsHostAlias,blockHelper,'http://'+httpsHostAlias);
    /* 16 */ testFrame(allowText,'https://'+httpsHostAlias,allowHelper,'https://'+httpsHostAlias);
    /* 17 */ testFrame(allowText,'http://'+httpHostMain,allowHelper,'http://foo:bar@'+httpHostMain+'/baz');
    /* 18 */ testFrame(allowText,'http://foo:bar@'+httpHostMain,allowHelper,'http://'+httpHostMain);
    /* 19 */ testFrame(allowText,'http://'+httpHostMain,allowHelper,'http://'+httpHostAlias,'/');
    /* 20 */ testFrame(allowText,'http://'+httpHostMain,allowHelper,'/','http://'+httpHostAlias);
    /* 21 */ testFrame(allowText,'http://'+httpHostMain,allowHelper,'http://'+httpHostAlias,'*');
    /* 22 */ testFrame(allowText,'http://'+httpHostMain,allowHelper,'http://'+httpHostAlias,'http://'+httpHostMain);
    /* 23 */ testFrame(allowText,'http://'+httpHostAlias,allowHelper,'http://'+httpHostAlias,'http://'+httpHostMain);
    /* 24 */ testFrame(blockText,'http://'+httpHostAlias,blockHelper,'http://dummy','http://'+httpHostMain);
    /* 25 */ testFrame(blockText,'https://'+httpsHostAlias,blockHelper,'https://'+httpsHostAlias+':'+httpsPortAlias);
    /* 26 */ testFrame(blockText,'https://'+httpsHostAlias+':'+httpsPortAlias,blockHelper,'https://'+httpsHostAlias);
    /* 27 */ testFrame(allowText,'https://'+httpsHostAlias+':'+httpsPortAlias,allowHelper,'https://'+httpsHostAlias+':'+httpsPortAlias);
    window.xhr = new XMLHttpRequest();
    xhr.open('GET',allowHelper,false);
    xhr.send(null);
    /* 28 */ testFrame(allowText,'data:text/html,',escape(xhr.responseText),'http://'+httpHostMain);
    /* 29 */ testFrame(allowText,'javascript:','parent.xhr.responseText','http://'+httpHostMain);
    /* 30 */ testFrame(blockText,'http://'+httpHostAlias,blockHelper,'http://'+httpHostAlias.replace(/^[^.]+\./,''));
    /* 31 */ testFrame(allowText,'http://'+httpHostAlias,allowHelper+'?domain','http://'+httpHostAlias);
    /* 32 */ testFrame(blockText,'http://'+httpHostAlias,blockHelper+'?domain','http://'+httpHostAlias.replace(/^[^.]+\./,''));
  }
};
    </script>
  </head>
  <body>
    <noscript><p>Enable JavaScript and reload</p></noscript>
  </body>
</html>