mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 21:18:35 +00:00
Bug 1603673 - Signal that we support web manifest processing in Fenix r=snorp,agi,ladybenko
When enabled, `link.relList.supports("manifest")` will return `true`. Differential Revision: https://phabricator.services.mozilla.com/D58181 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
d782507dc9
commit
65ea85a94c
@ -4,6 +4,7 @@ support-files =
|
||||
test_page.html
|
||||
empty_page.html
|
||||
prefs =
|
||||
dom.manfiest.enabled=true
|
||||
browser.ssb.enabled=true
|
||||
browser.ssb.osintegration=false
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Enable web manifest processing.
|
||||
Services.prefs.setBoolPref("dom.manifest.enabled", true);
|
||||
|
||||
// Check that a site's manifest affects the scope of a ssb.
|
||||
|
||||
function build_task(page, linkId, external, preload) {
|
||||
|
@ -44,6 +44,9 @@ async function enableApplicationPanel() {
|
||||
// Enable all preferences related to service worker debugging.
|
||||
await enableServiceWorkerDebugging();
|
||||
|
||||
// Enable web manifest processing.
|
||||
Services.prefs.setBoolPref("dom.manifest.enabled", true);
|
||||
|
||||
// Enable application panel in DevTools.
|
||||
await pushPref("devtools.application.enabled", true);
|
||||
}
|
||||
|
@ -3,6 +3,9 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
// Enable web manifest processing.
|
||||
Services.prefs.setBoolPref("dom.manifest.enabled", true);
|
||||
|
||||
add_task(async function() {
|
||||
info("Testing fetching a valid manifest");
|
||||
const response = await fetchManifest("application-manifest-basic.html");
|
||||
|
@ -25,6 +25,8 @@
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const { PromiseMessage } = ChromeUtils.import(
|
||||
"resource://gre/modules/PromiseMessage.jsm"
|
||||
);
|
||||
@ -72,6 +74,11 @@ var ManifestObtainer = {
|
||||
aContent,
|
||||
aOptions = { checkConformance: false }
|
||||
) {
|
||||
if (!Services.prefs.getBoolPref("dom.manifest.enabled")) {
|
||||
throw new Error(
|
||||
"Obtaining manifest is disabled by pref: dom.manifest.enabled"
|
||||
);
|
||||
}
|
||||
if (!aContent || isXULBrowser(aContent)) {
|
||||
const err = new TypeError("Invalid input. Expected a DOM Window.");
|
||||
return Promise.reject(err);
|
||||
|
@ -1,6 +1,9 @@
|
||||
// Used by JSHint:
|
||||
/* global Cu, BrowserTestUtils, ok, add_task, gBrowser */
|
||||
"use strict";
|
||||
|
||||
Services.prefs.setBoolPref("dom.manifest.enabled", true);
|
||||
|
||||
const { ManifestIcons } = ChromeUtils.import(
|
||||
"resource://gre/modules/ManifestIcons.jsm"
|
||||
);
|
||||
|
@ -1,6 +1,9 @@
|
||||
// Used by JSHint:
|
||||
/* global ok, is, Cu, BrowserTestUtils, add_task, gBrowser, makeTestURL, requestLongerTimeout*/
|
||||
"use strict";
|
||||
|
||||
Services.prefs.setBoolPref("dom.manifest.enabled", true);
|
||||
|
||||
const { ManifestObtainer } = ChromeUtils.import(
|
||||
"resource://gre/modules/ManifestObtainer.jsm"
|
||||
);
|
||||
|
@ -2,6 +2,8 @@
|
||||
/* global ok, is, Cu, BrowserTestUtils, add_task, gBrowser, requestLongerTimeout*/
|
||||
"use strict";
|
||||
|
||||
Services.prefs.setBoolPref("dom.manifest.enabled", true);
|
||||
|
||||
const { ManifestObtainer } = ChromeUtils.import(
|
||||
"resource://gre/modules/ManifestObtainer.jsm"
|
||||
);
|
||||
|
@ -13,6 +13,10 @@ const mixedContentFile = `${path}file_web_manifest_mixed_content.html`;
|
||||
const server = `${path}file_testserver.sjs`;
|
||||
const defaultURL = new URL(`http://example.org${server}`);
|
||||
const mixedURL = new URL(`http://mochi.test:8888${server}`);
|
||||
|
||||
// Enable web manifest processing.
|
||||
Services.prefs.setBoolPref("dom.manifest.enabled", true);
|
||||
|
||||
const tests = [
|
||||
// Check interaction with default-src and another origin,
|
||||
// CSP allows fetching from example.org, so manifest should load.
|
||||
|
@ -17,6 +17,10 @@ const httpsManifest = `${path}file_web_manifest_https.html`;
|
||||
const server = `${path}file_testserver.sjs`;
|
||||
const defaultURL = new URL(`http://example.org${server}`);
|
||||
const secureURL = new URL(`https://example.com:443${server}`);
|
||||
|
||||
// Enable web manifest processing.
|
||||
Services.prefs.setBoolPref("dom.manifest.enabled", true);
|
||||
|
||||
const tests = [
|
||||
// CSP block everything, so trying to load a manifest
|
||||
// will result in a policy violation.
|
||||
|
@ -521,6 +521,7 @@ package org.mozilla.geckoview {
|
||||
method public boolean getUseMaxScreenDepth();
|
||||
method public boolean getUseMultiprocess();
|
||||
method public boolean getWebFontsEnabled();
|
||||
method public boolean getWebManifestEnabled();
|
||||
method @NonNull public GeckoRuntimeSettings setAboutConfigEnabled(boolean);
|
||||
method @NonNull public GeckoRuntimeSettings setAutomaticFontSizeAdjustment(boolean);
|
||||
method @NonNull public GeckoRuntimeSettings setConsoleOutputEnabled(boolean);
|
||||
@ -535,6 +536,7 @@ package org.mozilla.geckoview {
|
||||
method @NonNull public GeckoRuntimeSettings setPreferredColorScheme(int);
|
||||
method @NonNull public GeckoRuntimeSettings setRemoteDebuggingEnabled(boolean);
|
||||
method @NonNull public GeckoRuntimeSettings setWebFontsEnabled(boolean);
|
||||
method @NonNull public GeckoRuntimeSettings setWebManifestEnabled(boolean);
|
||||
field public static final int COLOR_SCHEME_DARK = 1;
|
||||
field public static final int COLOR_SCHEME_LIGHT = 0;
|
||||
field public static final int COLOR_SCHEME_SYSTEM = -1;
|
||||
@ -570,6 +572,7 @@ package org.mozilla.geckoview {
|
||||
method @NonNull public GeckoRuntimeSettings.Builder useMaxScreenDepth(boolean);
|
||||
method @NonNull public GeckoRuntimeSettings.Builder useMultiprocess(boolean);
|
||||
method @NonNull public GeckoRuntimeSettings.Builder webFontsEnabled(boolean);
|
||||
method @NonNull public GeckoRuntimeSettings.Builder webManifest(boolean);
|
||||
method @NonNull protected GeckoRuntimeSettings newSettings(@Nullable GeckoRuntimeSettings);
|
||||
}
|
||||
|
||||
|
@ -296,6 +296,30 @@ class ContentDelegateTest : BaseSessionTest() {
|
||||
})
|
||||
}
|
||||
|
||||
@Test fun webAppManifestPref() {
|
||||
val initialState = sessionRule.runtime.settings.getWebManifestEnabled()
|
||||
val jsToRun = "document.querySelector('link[rel=manifest]').relList.supports('manifest');"
|
||||
|
||||
// Check pref'ed off
|
||||
sessionRule.runtime.settings.setWebManifestEnabled(false)
|
||||
mainSession.loadTestPath(HELLO_HTML_PATH)
|
||||
sessionRule.waitForPageStop(mainSession)
|
||||
|
||||
var result = equalTo(mainSession.evaluateJS(jsToRun) as Boolean)
|
||||
|
||||
assertThat("Disabling pref makes relList.supports('manifest') return false", false, result)
|
||||
|
||||
// Check pref'ed on
|
||||
sessionRule.runtime.settings.setWebManifestEnabled(true)
|
||||
mainSession.loadTestPath(HELLO_HTML_PATH)
|
||||
sessionRule.waitForPageStop(mainSession)
|
||||
|
||||
result = equalTo(mainSession.evaluateJS(jsToRun) as Boolean)
|
||||
assertThat("Enabling pref makes relList.supports('manifest') return true", true, result)
|
||||
|
||||
sessionRule.runtime.settings.setWebManifestEnabled(initialState)
|
||||
}
|
||||
|
||||
@Test fun webAppManifest() {
|
||||
mainSession.loadTestPath(HELLO_HTML_PATH)
|
||||
mainSession.waitUntilCalled(object : Callbacks.All {
|
||||
|
@ -156,6 +156,22 @@ public final class GeckoRuntimeSettings extends RuntimeSettings {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether web manifest support is enabled.
|
||||
*
|
||||
* This controls if Gecko actually downloads, or "obtains", web
|
||||
* manifests and processes them. Without setting this pref, trying
|
||||
* to obtain a manifest throws.
|
||||
*
|
||||
* @param enabled A flag determining whether Web Manifest processing support is
|
||||
* enabled.
|
||||
* @return The builder instance.
|
||||
*/
|
||||
public @NonNull Builder webManifest(final boolean enabled) {
|
||||
getSettings().mWebManifest.set(enabled);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether or not web console messages should go to logcat.
|
||||
*
|
||||
@ -431,6 +447,8 @@ public final class GeckoRuntimeSettings extends RuntimeSettings {
|
||||
return mContentBlocking;
|
||||
}
|
||||
|
||||
/* package */ final Pref<Boolean> mWebManifest = new Pref<Boolean>(
|
||||
"dom.manifest.enabled", true);
|
||||
/* package */ final Pref<Boolean> mJavaScript = new Pref<Boolean>(
|
||||
"javascript.enabled", true);
|
||||
/* package */ final Pref<Boolean> mRemoteDebugging = new Pref<Boolean>(
|
||||
@ -772,6 +790,28 @@ public final class GeckoRuntimeSettings extends RuntimeSettings {
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether Web Manifest processing support is enabled.
|
||||
*
|
||||
* @param enabled A flag determining whether Web Manifest processing support is
|
||||
* enabled.
|
||||
*
|
||||
* @return This GeckoRuntimeSettings instance.
|
||||
*/
|
||||
public @NonNull GeckoRuntimeSettings setWebManifestEnabled(final boolean enabled) {
|
||||
mWebManifest.commit(enabled);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get whether or not Web Manifest processing support is enabled.
|
||||
*
|
||||
* @return True if web manifest processing support is enabled.
|
||||
*/
|
||||
public boolean getWebManifestEnabled() {
|
||||
return mWebManifest.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether or not web console messages should go to logcat.
|
||||
*
|
||||
|
@ -44,7 +44,10 @@ exclude: true
|
||||
object which contains additional information about the newly created tab
|
||||
(including the `url` which used to be passed in directly).
|
||||
([bug 1616625]({{bugzilla}}1616625))
|
||||
|
||||
- Added [`GeckoRuntimeSettings.setWebManifestEnabled`][75.15],
|
||||
[`GeckoRuntimeSettings.webManifest`][75.16], and
|
||||
[`GeckoRuntimeSettings.getWebManifestEnabled`][75.17]
|
||||
([bug 1614894]({{bugzilla}}1603673)), to enable or check Web Manifest support.
|
||||
|
||||
[75.1]: {{javadoc_uri}}/GeckoRuntimeSettings.Builder.html#useMultiprocess-boolean-
|
||||
[75.2]: {{javadoc_uri}}/WebExtensionController.DebuggerDelegate.html#onExtensionListUpdated--
|
||||
@ -60,6 +63,9 @@ exclude: true
|
||||
[75.12]: {{javadoc_uri}}/WebExtension.SessionTabDelegate.html#onUpdateTab-org.mozilla.geckoview.WebExtension-org.mozilla.geckoview.GeckoSession-org.mozilla.geckoview.WebExtension.UpdateTabDetails-
|
||||
[75.13]: {{javadoc_uri}}/WebExtension.TabDelegate.html#onNewTab-org.mozilla.geckoview.WebExtension-org.mozilla.geckoview.WebExtension.CreateTabDetails-
|
||||
[75.14]: {{javadoc_uri}}/WebExtension.CreateTabDetails.html
|
||||
[75.15]: {{javadoc_uri}}/GeckoRuntimeSettings.Builder.html#setWebManifestEnabled-boolean-
|
||||
[75.16]: {{javadoc_uri}}/GeckoRuntimeSettings.Builder.html#webManifest-boolean-
|
||||
[75.17]: {{javadoc_uri}}/GeckoRuntimeSettings.Builder.html#getWebManifestEnabled--
|
||||
|
||||
## v74
|
||||
- Added [`WebExtensionController.enable`][74.1] and [`disable`][74.2] to
|
||||
@ -623,4 +629,4 @@ exclude: true
|
||||
[65.24]: {{javadoc_uri}}/CrashReporter.html#sendCrashReport-android.content.Context-android.os.Bundle-java.lang.String-
|
||||
[65.25]: {{javadoc_uri}}/GeckoResult.html
|
||||
|
||||
[api-version]: 8b880533b33a0ad178f88ade00aaae5897625ef9
|
||||
[api-version]: b293a94c5f74d3f660959dadd2b48732b2b1ecd1
|
||||
|
Loading…
x
Reference in New Issue
Block a user