mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 838146 part 9. Turn on WebIDL bindings for Navigator. r=smaug
This commit is contained in:
parent
d58a939998
commit
25bd1a6122
@ -111,6 +111,7 @@ Navigator::Navigator(nsPIDOMWindow* aWindow)
|
||||
{
|
||||
NS_ASSERTION(aWindow->IsInnerWindow(),
|
||||
"Navigator must get an inner window!");
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
Navigator::~Navigator()
|
||||
@ -2178,6 +2179,12 @@ Navigator::DoNewResolve(JSContext* aCx, JS::Handle<JSObject*> aObject,
|
||||
return ok;
|
||||
}
|
||||
|
||||
JSObject*
|
||||
Navigator::WrapObject(JSContext* cx, JS::Handle<JSObject*> scope)
|
||||
{
|
||||
return NavigatorBinding::Wrap(cx, scope, this);
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool
|
||||
Navigator::HasBatterySupport(JSContext* /* unused*/, JSObject* /*unused */)
|
||||
|
@ -396,6 +396,9 @@ public:
|
||||
return GetWindow();
|
||||
}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* cx,
|
||||
JS::Handle<JSObject*> scope) MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
bool CheckPermission(const char* type);
|
||||
static bool CheckPermission(nsPIDOMWindow* aWindow, const char* aType);
|
||||
|
@ -711,10 +711,6 @@ DOMInterfaces = {
|
||||
'previousSibling', 'nextSibling' ]
|
||||
},
|
||||
|
||||
'Navigator': {
|
||||
'register': False,
|
||||
},
|
||||
|
||||
'Node': {
|
||||
'nativeType': 'nsINode',
|
||||
'concrete': False,
|
||||
|
@ -15,7 +15,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=802982
|
||||
function boom()
|
||||
{
|
||||
for (var j = 0; j < 100; ++j) {
|
||||
navigator.mozGetUserMedia({}, {}, {});
|
||||
navigator.mozGetUserMedia({}, function(){}, function(){});
|
||||
}
|
||||
finish(); // we're not waiting for success/error callbacks here
|
||||
}
|
||||
|
@ -26,26 +26,26 @@ var exceptionTests = [
|
||||
// Each test here verifies that a caller is required to have all
|
||||
// three arguments in order to call mozGetUserMedia
|
||||
{ params: undefined,
|
||||
error: Cr.NS_ERROR_XPC_NOT_ENOUGH_ARGS,
|
||||
error: "Not enough arguments to Navigator.mozGetUserMedia.",
|
||||
message: "no arguments specified" },
|
||||
{ params: [{video: true, fake: true}],
|
||||
error: Cr.NS_ERROR_XPC_NOT_ENOUGH_ARGS,
|
||||
error: "Not enough arguments to Navigator.mozGetUserMedia.",
|
||||
message: "one argument specified" },
|
||||
{ params: [{video: true, fake: true}, unexpectedCall],
|
||||
error: Cr.NS_ERROR_XPC_NOT_ENOUGH_ARGS,
|
||||
error: "Not enough arguments to Navigator.mozGetUserMedia.",
|
||||
message: "two arguments specified" },
|
||||
|
||||
// Each test here verifies that providing an incorret object
|
||||
// type to any mozGetUserMedia parameter should throw
|
||||
// the correct exception specified
|
||||
{ params: [1, unexpectedCall, unexpectedCall],
|
||||
error: Cr.NS_ERROR_XPC_BAD_CONVERT_JS,
|
||||
error: "Argument 1 of Navigator.mozGetUserMedia is not an object.",
|
||||
message: "wrong object type as first parameter" },
|
||||
{ params: [{video: true, fake: true}, 1, unexpectedCall],
|
||||
error: Cr.NS_ERROR_XPC_BAD_CONVERT_JS,
|
||||
error: "Argument 2 of Navigator.mozGetUserMedia is not an object.",
|
||||
message: "wrong object type as second parameter" },
|
||||
{ params: [{video: true, fake: true}, unexpectedCall, 1],
|
||||
error: Cr.NS_ERROR_XPC_BAD_CONVERT_JS,
|
||||
error: "Argument 3 of Navigator.mozGetUserMedia is not an object.",
|
||||
message: "wrong object type as third parameter" }
|
||||
];
|
||||
|
||||
@ -71,7 +71,7 @@ runTest(function () {
|
||||
try {
|
||||
navigator.mozGetUserMedia.apply(navigator, test.params);
|
||||
} catch (e) {
|
||||
exception = (e.result === test.error);
|
||||
exception = (e.message === test.error);
|
||||
}
|
||||
ok(exception, "Exception for " + test.message);
|
||||
});
|
||||
|
@ -16,8 +16,9 @@
|
||||
/** Test for WebSMS **/
|
||||
|
||||
function checkSmsDisabled() {
|
||||
ok('mozSms' in frames[0].navigator, "navigator.mozSms should exist");
|
||||
is(frames[0].navigator.mozSms, null, "navigator.mozSms should return null");
|
||||
ok(!('mozSms' in frames[0].navigator), "navigator.mozSms should not exist");
|
||||
ok(frames[0].navigator.mozSms === undefined,
|
||||
"navigator.mozSms should return undefined");
|
||||
}
|
||||
|
||||
function checkSmsEnabled() {
|
||||
|
@ -17,23 +17,28 @@ var idleObserver = {
|
||||
onactive: null
|
||||
};
|
||||
|
||||
function doAddIdleObserver(obs) {
|
||||
var i = document.createElement("iframe");
|
||||
document.body.appendChild(i);
|
||||
var added = false;
|
||||
try {
|
||||
i.contentWindow.navigator.addIdleObserver(obs);
|
||||
added = true;
|
||||
} catch (e) { }
|
||||
i.remove();
|
||||
return added;
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
// addIdleObserver checks whether time is > 0.
|
||||
this.idleObserver.time = 100;
|
||||
|
||||
var added = false;
|
||||
try {
|
||||
navigator.addIdleObserver(this.idleObserver);
|
||||
added = true;
|
||||
} catch (e) { }
|
||||
var added = doAddIdleObserver(this.idleObserver, false);
|
||||
ok(!added, "Should not be able to add idle observer without permission");
|
||||
|
||||
SpecialPowers.addPermission("idle", true, document);
|
||||
added = false;
|
||||
try {
|
||||
navigator.addIdleObserver(this.idleObserver);
|
||||
added = true;
|
||||
} catch (e) { }
|
||||
|
||||
added = doAddIdleObserver(this.idleObserver, true);
|
||||
ok(added, "Should be able to add idle observer with permission.");
|
||||
|
||||
SimpleTest.finish();
|
||||
|
@ -35,12 +35,12 @@ function expectSuccess(param) {
|
||||
}
|
||||
|
||||
function testFailures() {
|
||||
expectFailure(null);
|
||||
expectFailure(undefined);
|
||||
expectSuccess(null);
|
||||
expectSuccess(undefined);
|
||||
expectFailure(-1);
|
||||
expectFailure('a');
|
||||
expectSuccess('a');
|
||||
expectFailure([100, -1]);
|
||||
expectFailure([100, 'a']);
|
||||
expectSuccess([100, 'a']);
|
||||
|
||||
var maxVibrateMs = SpecialPowers.getIntPref('dom.vibrator.max_vibrate_ms');
|
||||
var maxVibrateListLen = SpecialPowers.getIntPref('dom.vibrator.max_vibrate_list_len');
|
||||
|
@ -221,13 +221,17 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=668855
|
||||
|
||||
let dummy_test_map = new WeakMap;
|
||||
|
||||
let navi_fail = false;
|
||||
let rule_fail = false;
|
||||
let got_rule = false;
|
||||
try {
|
||||
dummy_test_map.set(window.navigator, 1);
|
||||
var rule = document.styleSheets[0].cssRules[0];
|
||||
got_rule = true;
|
||||
dummy_test_map.set(rule, 1);
|
||||
} catch (e) {
|
||||
navi_fail = true;
|
||||
rule_fail = true;
|
||||
}
|
||||
ok(navi_fail, "Using window.navigator as a weak map key should produce an exception because it can't be wrapper preserved.");
|
||||
ok(got_rule, "Got the CSS rule");
|
||||
ok(rule_fail, "Using a CSS rule as a weak map key should produce an exception because it can't be wrapper preserved.");
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="data:text/css,div {}">
|
||||
<title>Test Cross-Compartment DOM WeakMaps</title>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -16,13 +16,13 @@ function setup() {
|
||||
|
||||
my_map.set(item, "success_string");
|
||||
|
||||
var navi_fail = false;
|
||||
var rule_fail = false;
|
||||
try {
|
||||
my_map.set(window.frames[0].navigator, 1);
|
||||
my_map.set(window.frames[0].document.styleSheets[0].cssRules[0], 1);
|
||||
} catch (e) {
|
||||
navi_fail = true;
|
||||
rule_fail = true;
|
||||
}
|
||||
ok(navi_fail, "Using window.navigator as a weak map key across compartments should produce an exception because it can't be wrapper preserved.");
|
||||
ok(rule_fail, "Using rule as a weak map key across compartments should produce an exception because it can't be wrapper preserved.");
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
|
Loading…
Reference in New Issue
Block a user