<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: [v1.25]</li>
<li>Operating System: [All, Windows]</li>
<li>Browser: [All,]</li>
<li>Other info:</li>
</ul>
<h3 dir="auto">Source code</h3>
<p dir="auto">for (const page of context.pages())<br>
await page.close();<br>
await context.tracing.stop({ path: 'trace.zip' });<br>
await context.close();</p>




<p dir="auto"><strong>Link to the GitHub repository with the repro</strong></p>
<p dir="auto">[https://github.com/<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1711833267" data-permission-text="Title is private" data-url="https://github.com/microsoft/playwright/issues/23045" data-hovercard-type="issue" data-hovercard-url="/microsoft/playwright/issues/23045/hovercard" href="https://github.com/microsoft/playwright/issues/23045">/issues/23045</a>]</p>
<p dir="auto"><strong>Test file (self-contained)</strong></p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="for (const page of context.pages())
  await page.close();
await context.tracing.stop({ path: 'trace.zip' });
await context.close();"><pre class="notranslate"><span class="pl-k">for</span> <span class="pl-kos">(</span><span class="pl-k">const</span> <span class="pl-s1">page</span> <span class="pl-k">of</span> <span class="pl-s1">context</span><span class="pl-kos">.</span><span class="pl-en">pages</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">)</span>
  <span class="pl-k">await</span> <span class="pl-s1">page</span><span class="pl-kos">.</span><span class="pl-en">close</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-k">await</span> <span class="pl-s1">context</span><span class="pl-kos">.</span><span class="pl-c1">tracing</span><span class="pl-kos">.</span><span class="pl-en">stop</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">path</span>: <span class="pl-s">'trace.zip'</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-k">await</span> <span class="pl-s1">context</span><span class="pl-kos">.</span><span class="pl-en">close</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto"><strong>Steps</strong></p>
<ul dir="auto">
<li>[Run the test]</li>
</ul>
<p dir="auto"><strong>Expected</strong></p>
<p dir="auto">[Describe expected behavior]<br>
Based on previous answers.I closes all pages,  all network request should be aborted, and then saves the trace:</p>
<p dir="auto"><strong>Actual</strong></p>
<p dir="auto">[Describe actual behavior]<br>
But the actual situation is not like this<br>
I still cannot collect requests that are still pending when the page is closed in the trace<br>
Perhaps this is a bug</p>
<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: v1.32.3</li>
<li>Operating System: macOS 13.2</li>
<li>Browser: Firefox</li>
<li>Other info:</li>
</ul>
<h3 dir="auto">Source code</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I provided exact source code that allows reproducing the issue locally.</li>
</ul>




<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const playwright = require(&quot;playwright&quot;);

(async () =&gt; {
  const browser = await playwright.firefox.launch({
    headless: false,
    permissions: [&quot;geolocation&quot;],
  });
  const context = await browser.newContext({
    ignoreHTTPSErrors: true,
  });
  // Open new page
  const page = await context.newPage();
  await page.goto(
    &quot;https://chrisdavidmills.github.io/location-finder-permissions-api/&quot;
  );
  
  await browser.close();
})();"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-s1">playwright</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">"playwright"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-kos">(</span><span class="pl-k">async</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-k">const</span> <span class="pl-s1">browser</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-s1">playwright</span><span class="pl-kos">.</span><span class="pl-c1">firefox</span><span class="pl-kos">.</span><span class="pl-en">launch</span><span class="pl-kos">(</span><span class="pl-kos">{</span>
    <span class="pl-c1">headless</span>: <span class="pl-c1">false</span><span class="pl-kos">,</span>
    <span class="pl-c1">permissions</span>: <span class="pl-kos">[</span><span class="pl-s">"geolocation"</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
  <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-k">const</span> <span class="pl-s1">context</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-s1">browser</span><span class="pl-kos">.</span><span class="pl-en">newContext</span><span class="pl-kos">(</span><span class="pl-kos">{</span>
    <span class="pl-c1">ignoreHTTPSErrors</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span>
  <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-c">// Open new page</span>
  <span class="pl-k">const</span> <span class="pl-s1">page</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-s1">context</span><span class="pl-kos">.</span><span class="pl-en">newPage</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-k">await</span> <span class="pl-s1">page</span><span class="pl-kos">.</span><span class="pl-en">goto</span><span class="pl-kos">(</span>
    <span class="pl-s">"https://chrisdavidmills.github.io/location-finder-permissions-api/"</span>
  <span class="pl-kos">)</span><span class="pl-kos">;</span>
  
  <span class="pl-k">await</span> <span class="pl-s1">browser</span><span class="pl-kos">.</span><span class="pl-en">close</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto"><strong>Steps</strong></p>
<ul dir="auto">
<li>Execute the script</li>
</ul>
<p dir="auto"><strong>Expected</strong></p>
<p dir="auto">Firefox shouldn't prompt for geolocation permissions</p>
<p dir="auto"><strong>Actual</strong></p>
<p dir="auto">I get the geolocation message</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/2198466/231526746-3d519912-d20c-495e-b8b9-2fca238d9fbb.png"><img width="659" alt="image" src="https://user-images.githubusercontent.com/2198466/231526746-3d519912-d20c-495e-b8b9-2fca238d9fbb.png" style="max-width: 100%;"></a></p>
<p dir="auto">Geolocation should be available in Firefox. At least it is mentioned <a href="https://github.com/microsoft/playwright/issues/13037#issuecomment-1184698467" data-hovercard-type="issue" data-hovercard-url="/microsoft/playwright/issues/13037/hovercard">here</a>.</p>
<h2 dir="auto">Update</h2>
<p dir="auto">I found that the <code class="notranslate">permissions</code> option in the <code class="notranslate">newContext</code> does work. Shouldn't <code class="notranslate">newContext</code> inherit that option?</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="const browser = await playwright.firefox.launch({
  headless: false,
});
const context = await browser.newContext({
  permissions: [&quot;geolocation&quot;],
  ignoreHTTPSErrors: true,
});"><pre class="notranslate"><code class="notranslate">const browser = await playwright.firefox.launch({
  headless: false,
});
const context = await browser.newContext({
  permissions: ["geolocation"],
  ignoreHTTPSErrors: true,
});
</code></pre></div>