Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1416151 - Moving websocket code and tests in dom/websocket, r=qdot
Browse files Browse the repository at this point in the history
  • Loading branch information
bakulf committed Nov 10, 2017
1 parent d0307c6 commit 0eff564
Show file tree
Hide file tree
Showing 67 changed files with 182 additions and 175 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ dom/vr/**
dom/webauthn/**
dom/webbrowserpersist/**
dom/webidl/**
dom/websocket/**
dom/workers/**
dom/worklet/**
dom/xbl/**
Expand Down
2 changes: 0 additions & 2 deletions dom/base/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ EXPORTS.mozilla.dom += [
'TimeoutManager.h',
'TreeWalker.h',
'WebKitCSSMatrix.h',
'WebSocket.h',
'WindowOrientationObserver.h',
]

Expand Down Expand Up @@ -364,7 +363,6 @@ UNIFIED_SOURCES += [
'TimeoutManager.cpp',
'TreeWalker.cpp',
'WebKitCSSMatrix.cpp',
'WebSocket.cpp',
'WindowNamedPropertiesHandler.cpp',
'WindowOrientationObserver.cpp',
'XPathGenerator.cpp',
Expand Down
1 change: 0 additions & 1 deletion dom/base/test/chrome.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@ support-files = file_navigator_resolve_identity_xrays.xul
[test_sandboxed_blob_uri.html]
[test_sendQueryContentAndSelectionSetEvent.html]
[test_urgent_start.html]
[test_websocket_frame.html]
39 changes: 0 additions & 39 deletions dom/base/test/mochitest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ support-files =
file_bug1091883_frame.html
file_bug1091883_subframe.html
file_bug1091883_target.html
file_bug1384658.html
file_bug28293.sjs
file_bug326337.xml
file_bug326337_inner.html
Expand Down Expand Up @@ -156,15 +155,6 @@ support-files =
file_timer_flood.html
file_viewport_scroll_quirks.html
file_viewport_scroll_xml.xml
file_websocket_basic_wsh.py
file_websocket_bigBlob_wsh.py
file_websocket_hello_wsh.py
file_websocket_http_resource.txt
file_websocket_permessage_deflate_wsh.py
file_websocket_permessage_deflate_disabled_wsh.py
file_websocket_permessage_deflate_rejected_wsh.py
file_websocket_permessage_deflate_params_wsh.py
file_websocket_wsh.py
file_x-frame-options_main.html
file_x-frame-options_page.sjs
file_xhtmlserializer_1.xhtml
Expand Down Expand Up @@ -224,8 +214,6 @@ support-files =
file_bug1250148.sjs
file_bug1268962.sjs
mozbrowser_api_utils.js
websocket_helpers.js
websocket_tests.js
!/dom/security/test/cors/file_CrossSiteXHR_server.sjs
!/image/test/mochitest/blue.png
script_bug1238440.js
Expand All @@ -250,8 +238,6 @@ support-files =
file4_setting_opener.html
PASS.html
FAIL.html
window_bug1384658.html
frame_bug1384658.html

[test_anchor_area_referrer.html]
[test_anchor_area_referrer_changing.html]
Expand Down Expand Up @@ -599,8 +585,6 @@ skip-if = stylo # bug 1293844
[test_bug1064481.html]
[test_bug1070015.html]
[test_bug1075702.html]
[test_bug1081686.html]
skip-if = toolkit == 'android'
[test_bug1091883.html]
[test_bug1101364.html]
skip-if = toolkit == 'android'
Expand All @@ -625,8 +609,6 @@ skip-if = toolkit == 'android'
[test_bug1318303.html]
[test_bug1375050.html]
[test_bug1381710.html]
[test_bug1384658.html]
skip-if = toolkit == 'android'
[test_bug1384661.html]
[test_bug1399603.html]
[test_bug1399605.html]
Expand Down Expand Up @@ -805,27 +787,6 @@ skip-if = toolkit == 'android'
tags = audiochannel
[test_webaudioNotificationStopOnNavigation.html]
tags = audiochannel
[test_websocket_basic.html]
skip-if = toolkit == 'android'
[test_websocket_hello.html]
skip-if = toolkit == 'android'
[test_websocket_permessage_deflate.html]
skip-if = toolkit == 'android'
[test_webSocket_sandbox.html]
skip-if = toolkit == 'android'
support-files = iframe_webSocket_sandbox.html
[test_websocket1.html]
skip-if = toolkit == 'android'
[test_websocket2.html]
skip-if = toolkit == 'android'
[test_websocket3.html]
skip-if = toolkit == 'android'
[test_websocket4.html]
skip-if = toolkit == 'android'
[test_websocket5.html]
skip-if = toolkit == 'android'
[test_websocket_bigBlob.html]
skip-if = toolkit == 'android'
[test_window_constructor.html]
[test_window_content.html]
[test_window_cross_origin_props.html]
Expand Down
1 change: 0 additions & 1 deletion dom/base/test/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ XPCSHELL_TESTS_MANIFESTS += [

MOCHITEST_MANIFESTS += [
'mochitest.ini',
'websocket_hybi/mochitest.ini',
]

MOCHITEST_CHROME_MANIFESTS += [
Expand Down
1 change: 1 addition & 0 deletions dom/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ DIRS += [
'worklet',
'script',
'payments',
'websocket',
]

if CONFIG['OS_ARCH'] == 'WINNT':
Expand Down
File renamed without changes.
File renamed without changes.
34 changes: 34 additions & 0 deletions dom/websocket/moz.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

with Files("**"):
BUG_COMPONENT = ("Core", "DOM")

EXPORTS.mozilla.dom += [
'WebSocket.h',
]

UNIFIED_SOURCES += [
'WebSocket.cpp',
]

LOCAL_INCLUDES += [
'/dom/base',
'/dom/workers',
]

MOCHITEST_CHROME_MANIFESTS += [
'tests/chrome.ini',
]

MOCHITEST_MANIFESTS += [
'tests/mochitest.ini',
'tests/websocket_hybi/mochitest.ini',
]

include('/ipc/chromium/chromium-config.mozbuild')

FINAL_LIBRARY = 'xul'
4 changes: 4 additions & 0 deletions dom/websocket/tests/chrome.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[DEFAULT]
skip-if = os == 'android'

[test_websocket_frame.html]
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
bc.close();
}
try {
new WebSocket("ws://mochi.test:8888/tests/dom/base/test/file_websocket_basic");
new WebSocket("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_basic");
done(true); // no hang!
} catch (e) {
done(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"</scr" + "ipt></html>";
} else if (location.search == '?opener') {
try{
var socket = new WebSocket('ws://mochi.test:8888/tests/dom/base/test/file_websocket_basic');
var socket = new WebSocket('ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_basic');
socket.onerror = function(e) {
opener.postMessage('WS onerror', '*');
close();
Expand All @@ -44,7 +44,7 @@
ifr.srcdoc = `
<html><script>
try{
var socket = new WebSocket('ws://mochi.test:8888/tests/dom/base/test/file_websocket_basic');
var socket = new WebSocket('ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_basic');
socket.onerror = function(e) {
parent.postMessage('WS onerror', '*');
};
Expand Down
48 changes: 48 additions & 0 deletions dom/websocket/tests/mochitest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[DEFAULT]
skip-if = toolkit == 'android' # bug 982828
support-files =
file_websocket_basic_wsh.py
file_websocket_hello_wsh.py
file_websocket_http_resource.txt
file_websocket_permessage_deflate_wsh.py
file_websocket_permessage_deflate_disabled_wsh.py
file_websocket_permessage_deflate_rejected_wsh.py
file_websocket_permessage_deflate_params_wsh.py
file_websocket_wsh.py
websocket_helpers.js
websocket_tests.js
websocket_worker_helpers.js

[test_bug1081686.html]
[test_bug1384658.html]
support-files = window_bug1384658.html frame_bug1384658.html file_bug1384658.html
[test_websocket1.html]
[test_websocket2.html]
[test_websocket3.html]
[test_websocket4.html]
[test_websocket5.html]
[test_websocket_basic.html]
[test_websocket_hello.html]
[test_websocket_permessage_deflate.html]
[test_webSocket_sandbox.html]
support-files = iframe_webSocket_sandbox.html
[test_worker_websocket1.html]
support-files = websocket_worker1.js
[test_worker_websocket2.html]
support-files = websocket_worker2.js
[test_worker_websocket3.html]
support-files = websocket_worker3.js
[test_worker_websocket4.html]
support-files = websocket_worker4.js
[test_worker_websocket5.html]
support-files = websocket_worker5.js
[test_worker_websocket_basic.html]
support-files = websocket_basic_worker.js
[test_worker_websocket_https.html]
support-files = websocket_worker_https.html websocket_https_worker.js
[test_worker_websocket_loadgroup.html]
support-files = websocket_loadgroup_worker.js
[test_webSocket_sharedWorker.html]
support-files = webSocket_sharedWorker.js
[test_websocket_bigBlob.html]
support-files = file_websocket_bigBlob_wsh.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
}

function testWebSocket () {
ws = new WebSocket("ws://mochi.test:8888/tests/dom/base/test/file_websocket_hello");
ws = new WebSocket("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_hello");
ws.onopen = function(e) {
ws.send("data");
}
Expand All @@ -39,7 +39,7 @@
is(ws.binaryType, 'blob', 'WebSocket.binaryType is blob');
ws.binaryType = 'arraybuffer';
is(ws.binaryType, 'arraybuffer', 'WebSocket.binaryType is arraybuffer');
is(ws.url, 'ws://mochi.test:8888/tests/dom/base/test/file_websocket_hello', 'WebSocket.url is correct');
is(ws.url, 'ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_hello', 'WebSocket.url is correct');
ws.close();
ws.send('foobar');
SimpleTest.finish();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
}

function test_window() {
var win = window.open("http://example.com/tests/dom/base/test/window_bug1384658.html",
var win = window.open("http://example.com/tests/dom/websocket/tests/window_bug1384658.html",
"_blank", "width=100,height=100");
var bc = new BroadcastChannel("test_channel");
bc.onmessage = ev => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
<div id="container"></div>
<iframe id="frame"></iframe>
<script type="application/javascript;version=1.8">
var urls = [ "https://example.com/tests/dom/base/test/iframe_webSocket_sandbox.html",
"https://example.com/tests/dom/base/test/iframe_webSocket_sandbox.html?nested",
"https://example.com/tests/dom/base/test/iframe_webSocket_sandbox.html?popup" ];
var urls = [ "https://example.com/tests/dom/websocket/tests/iframe_webSocket_sandbox.html",
"https://example.com/tests/dom/websocket/tests/iframe_webSocket_sandbox.html?nested",
"https://example.com/tests/dom/websocket/tests/iframe_webSocket_sandbox.html?popup" ];

onmessage = function(e) {
is(e.data, "WS Throws!", "ws://URI cannot be used by a https iframe");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<pre id="test">
<script class="testbody" type="text/javascript">

const kUrl = "ws://mochi.test:8888/tests/dom/base/test/file_websocket_basic";
const kUrl = "ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_basic";

var gTestElement;
var ws;
Expand All @@ -37,7 +37,7 @@
gTestElement.textContent = "Running testWebSocket1()";

var results = ["test",
"/tests/dom/base/test/file_websocket_basic",
"/tests/dom/websocket/tests/file_websocket_basic",
"http://mochi.test:8888",
"end"];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<body>
<script class="testbody" type="text/javascript">

var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket_bigBlob");
var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_bigBlob");
is(ws.readyState, 0, "Initial readyState is 0");
ws.binaryType = "blob";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

const { classes: Cc, interfaces: Ci, utils: Cu } = Components;

const URI = "ws://mochi.test:8888/tests/dom/base/test/file_websocket_basic";
const URI = "ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_basic";

var frameReceivedCounter = 0;
var frameSentCounter = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
var ws;

function testWebSocket () {
ws = new WebSocket("ws://mochi.test:8888/tests/dom/base/test/file_websocket_hello");
ws = new WebSocket("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_hello");
ws.onopen = function(e) {
ws.send("data");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@

tests = [
// enable PMCE
[ true, true, "ws://mochi.test:8888/tests/dom/base/test/file_websocket_permessage_deflate" ],
[ true, true, "ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_permessage_deflate" ],
// disable PMCE
[ false, false, "ws://mochi.test:8888/tests/dom/base/test/file_websocket_permessage_deflate_disabled" ],
[ false, false, "ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_permessage_deflate_disabled" ],
// server rejects offered PMCE
[ true, false, "ws://mochi.test:8888/tests/dom/base/test/file_websocket_permessage_deflate_rejected" ],
[ true, false, "ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_permessage_deflate_rejected" ],
// server returns parameters in the handshake
[ true, true, "ws://mochi.test:8888/tests/dom/base/test/file_websocket_permessage_deflate_params" ]
[ true, true, "ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_permessage_deflate_params" ]
]

function ab2str(buf) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@

</script>
</pre>
<iframe src="https://example.com/tests/dom/workers/test/websocket_https.html"></iframe>
<iframe src="https://example.com/tests/dom/websocket/tests/websocket_worker_https.html"></iframe>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
onconnect = function(evt) {
var ws = new WebSocket("ws://mochi.test:8888/tests/dom/base/test/file_websocket_hello");
var ws = new WebSocket("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_hello");

ws.onopen = function(e) {
evt.ports[0].postMessage({type: 'status', status: true, msg: 'OnOpen called' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ onmessage = function(event) {

postMessage({type: 'status', status: status, msg: 'WebSocket object:' + WebSocket});

var ws = new WebSocket("ws://mochi.test:8888/tests/dom/base/test/file_websocket_hello");
var ws = new WebSocket("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_hello");
ws.onopen = function(e) {
postMessage({type: 'status', status: true, msg: 'OnOpen called' });
ws.send("data");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
onmessage = function() {
var wsCreated = true;
try {
new WebSocket("ws://mochi.test:8888/tests/dom/base/test/file_websocket_hello");
new WebSocket("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_hello");
} catch(e) {
wsCreated = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
return array.buffer;
}

var ws = new WebSocket("ws://mochi.test:8888/tests/dom/base/test/websocket_hybi/file_binary-frames");
var ws = new WebSocket("ws://mochi.test:8888/tests/dom/websocket/tests/websocket_hybi/file_binary-frames");
ws.binaryType = "arraybuffer";
is(ws.binaryType, "arraybuffer", "should be equal to 'arraybuffer'");

Expand Down
Loading

0 comments on commit 0eff564

Please sign in to comment.