<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
test(function() {
// The property descriptor of location[Symbol.toPrimitive] must be
// {configurable: false, enumerable: false, writable: false,
// value: undefined}.
assert_own_property(location, Symbol.toPrimitive,
"location does not have Symbol.toPrimitive property.");
var pd = Object.getOwnPropertyDescriptor(location, Symbol.toPrimitive);
assert_false(pd.configurable,
"location's Symbol.toPrimitive is configurable.");
assert_false(pd.enumerable, "location's Symbol.toPrimitive is enumerable.");
assert_false(pd.writable, "location's Symbol.toPrimitive is writable.");
assert_true('value' in pd,
"location's Symbol.toPrimitive is not a data property.");
assert_equals(pd.value, undefined,
"The value of location's Symbol.toPrimitive is not undefined.");
// location's Symbol.toPrimitive supersedes Object.prototype's one.
// https://crbug.com/680409
Object.prototype[Symbol.toPrimitive] = function() { return "hacked"; };
assert_equals(String({}), "hacked",
"Object.prototype doesn't have a hacked Symbol.toPrimitive " +
"property.");
assert_not_equals(String(location), "hacked",
"location's Symbol.toPrimitive gets hacked.");
}, "Location objects must have Symbol.toPrimitive property defined.");
done();
</script>