Merge pull request #4178 from deepak1556/webview_blinkfeatures_attributes_patch
webview: add blinkfeatures attribute
This commit is contained in:
commit
bbf622187c
4 changed files with 23 additions and 1 deletions
|
@ -156,7 +156,8 @@ var attachGuest = function(embedder, elementInstanceId, guestInstanceId, params)
|
||||||
guestInstanceId: guestInstanceId,
|
guestInstanceId: guestInstanceId,
|
||||||
nodeIntegration: (ref1 = params.nodeintegration) != null ? ref1 : false,
|
nodeIntegration: (ref1 = params.nodeintegration) != null ? ref1 : false,
|
||||||
plugins: params.plugins,
|
plugins: params.plugins,
|
||||||
webSecurity: !params.disablewebsecurity
|
webSecurity: !params.disablewebsecurity,
|
||||||
|
blinkFeatures: params.blinkfeatures
|
||||||
};
|
};
|
||||||
if (params.preload) {
|
if (params.preload) {
|
||||||
webPreferences.preloadURL = params.preload;
|
webPreferences.preloadURL = params.preload;
|
||||||
|
|
|
@ -288,6 +288,13 @@ class PreloadAttribute extends WebViewAttribute {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Attribute that specifies the blink features to be enabled.
|
||||||
|
class BlinkFeaturesAttribute extends WebViewAttribute {
|
||||||
|
constructor(webViewImpl) {
|
||||||
|
super(webViewConstants.ATTRIBUTE_BLINKFEATURES, webViewImpl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Sets up all of the webview attributes.
|
// Sets up all of the webview attributes.
|
||||||
WebViewImpl.prototype.setupWebViewAttributes = function() {
|
WebViewImpl.prototype.setupWebViewAttributes = function() {
|
||||||
var attribute, autosizeAttributes, i, len, results;
|
var attribute, autosizeAttributes, i, len, results;
|
||||||
|
@ -303,6 +310,7 @@ WebViewImpl.prototype.setupWebViewAttributes = function() {
|
||||||
this.attributes[webViewConstants.ATTRIBUTE_DISABLEWEBSECURITY] = new BooleanAttribute(webViewConstants.ATTRIBUTE_DISABLEWEBSECURITY, this);
|
this.attributes[webViewConstants.ATTRIBUTE_DISABLEWEBSECURITY] = new BooleanAttribute(webViewConstants.ATTRIBUTE_DISABLEWEBSECURITY, this);
|
||||||
this.attributes[webViewConstants.ATTRIBUTE_ALLOWPOPUPS] = new BooleanAttribute(webViewConstants.ATTRIBUTE_ALLOWPOPUPS, this);
|
this.attributes[webViewConstants.ATTRIBUTE_ALLOWPOPUPS] = new BooleanAttribute(webViewConstants.ATTRIBUTE_ALLOWPOPUPS, this);
|
||||||
this.attributes[webViewConstants.ATTRIBUTE_PRELOAD] = new PreloadAttribute(this);
|
this.attributes[webViewConstants.ATTRIBUTE_PRELOAD] = new PreloadAttribute(this);
|
||||||
|
this.attributes[webViewConstants.ATTRIBUTE_BLINKFEATURES] = new BlinkFeaturesAttribute(this);
|
||||||
autosizeAttributes = [webViewConstants.ATTRIBUTE_MAXHEIGHT, webViewConstants.ATTRIBUTE_MAXWIDTH, webViewConstants.ATTRIBUTE_MINHEIGHT, webViewConstants.ATTRIBUTE_MINWIDTH];
|
autosizeAttributes = [webViewConstants.ATTRIBUTE_MAXHEIGHT, webViewConstants.ATTRIBUTE_MAXWIDTH, webViewConstants.ATTRIBUTE_MINHEIGHT, webViewConstants.ATTRIBUTE_MINWIDTH];
|
||||||
results = [];
|
results = [];
|
||||||
for (i = 0, len = autosizeAttributes.length; i < len; i++) {
|
for (i = 0, len = autosizeAttributes.length; i < len; i++) {
|
||||||
|
|
|
@ -16,6 +16,7 @@ module.exports = {
|
||||||
ATTRIBUTE_ALLOWPOPUPS: 'allowpopups',
|
ATTRIBUTE_ALLOWPOPUPS: 'allowpopups',
|
||||||
ATTRIBUTE_PRELOAD: 'preload',
|
ATTRIBUTE_PRELOAD: 'preload',
|
||||||
ATTRIBUTE_USERAGENT: 'useragent',
|
ATTRIBUTE_USERAGENT: 'useragent',
|
||||||
|
ATTRIBUTE_BLINKFEATURES: 'blinkfeatures',
|
||||||
|
|
||||||
// Internal attribute.
|
// Internal attribute.
|
||||||
ATTRIBUTE_INTERNALINSTANCEID: 'internalinstanceid',
|
ATTRIBUTE_INTERNALINSTANCEID: 'internalinstanceid',
|
||||||
|
|
|
@ -157,6 +157,16 @@ value will fail with a DOM exception.
|
||||||
|
|
||||||
If "on", the guest page will be allowed to open new windows.
|
If "on", the guest page will be allowed to open new windows.
|
||||||
|
|
||||||
|
### `blinkfeatures`
|
||||||
|
|
||||||
|
```html
|
||||||
|
<webview src="https://www.github.com/" blinkfeatures="PreciseMemoryInfo, CSSVariables"></webview>
|
||||||
|
```
|
||||||
|
|
||||||
|
A list of strings which specifies the blink features to be enabled separated by `,`.
|
||||||
|
The full list of supported feature strings can be found in the
|
||||||
|
[setFeatureEnabledFromString][blink-feature-string] function.
|
||||||
|
|
||||||
## Methods
|
## Methods
|
||||||
|
|
||||||
The `webview` tag has the following methods:
|
The `webview` tag has the following methods:
|
||||||
|
@ -725,3 +735,5 @@ Emitted when DevTools is closed.
|
||||||
### Event: 'devtools-focused'
|
### Event: 'devtools-focused'
|
||||||
|
|
||||||
Emitted when DevTools is focused / opened.
|
Emitted when DevTools is focused / opened.
|
||||||
|
|
||||||
|
[blink-feature-string]: https://code.google.com/p/chromium/codesearch#chromium/src/out/Debug/gen/blink/platform/RuntimeEnabledFeatures.cpp&sq=package:chromium&type=cs&l=527
|
||||||
|
|
Loading…
Reference in a new issue