UNPKG

1.96 kBJavaScriptView Raw
1// Licensed to the Software Freedom Conservancy (SFC) under one
2// or more contributor license agreements. See the NOTICE file
3// distributed with this work for additional information
4// regarding copyright ownership. The SFC licenses this file
5// to you under the Apache License, Version 2.0 (the
6// "License"); you may not use this file except in compliance
7// with the License. You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing,
12// software distributed under the License is distributed on an
13// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14// KIND, either express or implied. See the License for the
15// specific language governing permissions and limitations
16// under the License.
17
18'use strict';
19
20var assert = require('../testing/assert'),
21 test = require('../lib/test'),
22 Pages = test.Pages;
23
24
25test.suite(function(env) {
26 var browsers = env.browsers;
27
28 var driver;
29 test.before(function() {
30 driver = env.builder().build();
31 });
32
33 test.after(function() {
34 driver.quit();
35 });
36
37 describe('fingerprinting', function() {
38 test.it('it should fingerprint the navigator object', function*() {
39 yield driver.get(Pages.simpleTestPage);
40
41 let wd = yield driver.executeScript('return navigator.webdriver');
42 assert(wd).equalTo(true);
43 });
44
45 test.it('fingerprint must not be writable', function*() {
46 yield driver.get(Pages.simpleTestPage);
47
48 let wd = yield driver.executeScript(
49 'navigator.webdriver = "ohai"; return navigator.webdriver');
50 assert(wd).equalTo(true);
51 });
52
53 test.it('leaves fingerprint on svg pages', function*() {
54 yield driver.get(Pages.svgPage);
55
56 let wd = yield driver.executeScript('return navigator.webdriver');
57 assert(wd).equalTo(true);
58 });
59 });
60
61// Currently only implemented in legacy firefox.
62}, {browsers: ['legacy-firefox']});