Closed Bug 951997 Opened 6 years ago Closed 6 years ago

Create content sandbox permission prompt test

Categories

(Core :: Permission Manager, defect)

ARM
Gonk (Firefox OS)
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla29

People

(Reporter: ayang, Assigned: ayang)

References

Details

Attachments

(1 file, 3 obsolete files)

Create test for sandbox permission prompt test [1], including geolocation, audio-capture, and desktop-notification. That's for bug 935291.

[1] https://wiki.mozilla.org/Apps/Security#Sandboxed_Permissions
Attached patch test (obsolete) — Splinter Review
It'd be better to move this test to b2g/components/test.
Attached patch sanbox_permission_test (obsolete) — Splinter Review
Attachment #8349888 - Attachment is obsolete: true
Attachment #8349958 - Flags: review?(jsmith)
Attachment #8349958 - Attachment is patch: true
Comment on attachment 8349958 [details] [diff] [review]
sanbox_permission_test

Let me redirect this to baku, as he's done reviews on permission-based tests before.
Attachment #8349958 - Flags: review?(jsmith) → review?(amarchesini)
Comment on attachment 8349958 [details] [diff] [review]
sanbox_permission_test

Review of attachment 8349958 [details] [diff] [review]:
-----------------------------------------------------------------

looks good.

::: b2g/components/test/mochitest/permission_handler_chrome.js
@@ +16,5 @@
> +
> +let browser = Services.wm.getMostRecentWindow("navigator:browser");
> +
> +if (!browser) {
> +  debug("no browser");

return;

@@ +43,5 @@
> +
> +function checkPromptEvent(prompt_evt) {
> +  let detail = prompt_evt.detail;
> +
> +  if (detail.permission) {

you can remove this if.

::: b2g/components/test/mochitest/test_sandbox_permission.html
@@ +1,4 @@
> +<!DOCTYPE HTML>
> +<html>
> +<!--
> +https://bugzilla.mozilla.org/show_bug.cgi?id=

id?

@@ +10,5 @@
> +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
> +  <script type="application/javascript" src="head.js"></script>
> +</head>
> +<body>
> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Permission prompt web content test</a>

id.. ?

@@ +15,5 @@
> +<script type="application/javascript">
> +
> +"use strict";
> +
> +function debug(str) {

you don't use this. remove it.
Attachment #8349958 - Flags: review?(amarchesini) → review+
Attached patch sanbox_permission_test (obsolete) — Splinter Review
I add a mochitest under b2g/components but testing/mochites/b2g.json doesn't include b2g folder.
Is it ok to include this folder?
Attachment #8350571 - Flags: review?(Ms2ger)
Comment on attachment 8350571 [details] [diff] [review]
sanbox_permission_test

Adding jgriffin to the review list for reviewing a new addition to run tests list in b2g.json.

Note - you should kick off a try run to validate that these tests are okay to turn on.
Attachment #8350571 - Flags: review?(jgriffin)
Comment on attachment 8350571 [details] [diff] [review]
sanbox_permission_test

Review of attachment 8350571 [details] [diff] [review]:
-----------------------------------------------------------------

r+ just for the b2g*.json changes; I don't have any particular knowledge about what these tests are doing.

Like Jason said, please do a try run (-b do -p linux32_gecko,linux64_gecko,emulator -u mochitests -t none) before landing.
Attachment #8350571 - Flags: review?(jgriffin) → review+
(In reply to Jonathan Griffin (:jgriffin) from comment #8)
> Comment on attachment 8350571 [details] [diff] [review]
> sanbox_permission_test
> 
> Review of attachment 8350571 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> r+ just for the b2g*.json changes; I don't have any particular knowledge
> about what these tests are doing.
> 
> Like Jason said, please do a try run (-b do -p
> linux32_gecko,linux64_gecko,emulator -u mochitests -t none) before landing.

I had a try today and got following error.

18:51:58     INFO -  2 INFO TEST-START | /tests/b2g/components/test/mochitest/test_sandbox_permission.html
18:52:00     INFO -  System JS : ERROR chrome://specialpowers/content/SpecialPowersObserverAPI.js:298 - ReferenceError: Cc is not defined

It looks like SpecialPowers.loadChromeScript doesn't work on b2g-desktop [1]. Is it supposed to be it or a bug?


[1] https://tbpl.mozilla.org/?tree=Try&rev=d9224934c017
Attachment #8350571 - Flags: review?(Ms2ger)
That should be B2G-desktop dones't support OOP. I'll disable this test on B2G-desktop.
Check-in patch for this testcase, carry r+ from above comments.

https://tbpl.mozilla.org/?tree=Try&rev=41d2112f2651
Attachment #8351288 - Flags: review+
Hi Sheriff, please check-in patch check_in_sandbox_permission_test, thanks.
Keywords: checkin-needed
Attachment #8349958 - Attachment is obsolete: true
Attachment #8350571 - Attachment is obsolete: true
Assignee: nobody → ayang
https://hg.mozilla.org/mozilla-central/rev/adf55196426d
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
You need to log in before you can comment on or make changes to this bug.