Bug 184766 - Tool scripts should not use PrivilegedAPI from 'public/v3/privileged-api.js'.
Summary: Tool scripts should not use PrivilegedAPI from 'public/v3/privileged-api.js'.
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Keywords: InRadar
Depends on:
Blocks: 184419
  Show dependency treegraph
Reported: 2018-04-18 18:30 PDT by dewei_zhu
Modified: 2018-04-24 20:56 PDT (History)
3 users (show)

See Also:

Patch (9.01 KB, patch)
2018-04-18 18:39 PDT, dewei_zhu
no flags Details | Formatted Diff | Diff
Patch (9.11 KB, patch)
2018-04-19 22:30 PDT, dewei_zhu
no flags Details | Formatted Diff | Diff
Patch (10.27 KB, patch)
2018-04-20 11:41 PDT, dewei_zhu
rniwa: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description dewei_zhu 2018-04-18 18:30:27 PDT
Tool scripts should not use PrivilegedAPI from 'public/v3/privileged-api.js'.
Comment 1 dewei_zhu 2018-04-18 18:39:34 PDT
Created attachment 338293 [details]
Comment 2 Ryosuke Niwa 2018-04-18 20:44:35 PDT
Comment on attachment 338293 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=338293&action=review

> Websites/perf.webkit.org/server-tests/api-upload-root-tests.js:12
> +global.PrivilegedAPI = require('../public/v3/privileged-api.js').PrivilegedAPI;

This should probably be done in TestServer.inject so that when all these tests are ran at the same time,
we use the correct version of PrivilegedAPI instead of whichever loaded last.
Comment 3 dewei_zhu 2018-04-19 22:30:26 PDT
Created attachment 338395 [details]
Comment 4 dewei_zhu 2018-04-20 11:41:14 PDT
Created attachment 338444 [details]
Comment 5 Ryosuke Niwa 2018-04-20 16:57:06 PDT
Comment on attachment 338444 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=338444&action=review

> Websites/perf.webkit.org/tools/js/privileged-api.js:8
> +        for (let key in data)

Use const.

> Websites/perf.webkit.org/unit-tests/resources/mock-remote-api.js:63
> +    inject: function (urlPrefix, useNodePrivilegedAPI)

We should make inject either make a dictionary or the second argument should be
a string specifying the type of PrivilegedAPI we use; e.g. 'browser' (default) / 'node'.

> Websites/perf.webkit.org/unit-tests/resources/mock-remote-api.js:67
> +        const hookPrivilegedAPI = useNodePrivilegedAPI ? NodePrivilegedAPI: BrowserPrivilegedAPI;

Use call this PrivilegedAPI.
Comment 6 Ryosuke Niwa 2018-04-24 20:55:16 PDT
Comment 7 Radar WebKit Bug Importer 2018-04-24 20:56:18 PDT