chore: address TODO for WebContents.prototype.setSize / reportRemovedAttribute removal (#14517)
* chore: remove WebContents.prototype.setSize * chore: remove reportRemovedAttribute * chore: remove unused fixtures
This commit is contained in:
parent
f5aac36421
commit
38419e3a6a
4 changed files with 0 additions and 71 deletions
|
@ -269,12 +269,6 @@ WebContents.prototype.getZoomFactor = function (callback) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(zcbenz): Remove the stub in 4.0.
|
|
||||||
WebContents.prototype.setSize = function () {
|
|
||||||
console.error('The WebContents.setSize method has been removed, see',
|
|
||||||
'https://github.com/electron/electron/issues/14120 for more.')
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add JavaScript wrappers for WebContents class.
|
// Add JavaScript wrappers for WebContents class.
|
||||||
WebContents.prototype._init = function () {
|
WebContents.prototype._init = function () {
|
||||||
// The navigation controller.
|
// The navigation controller.
|
||||||
|
|
|
@ -16,13 +16,6 @@ const getNextId = function () {
|
||||||
return ++nextId
|
return ++nextId
|
||||||
}
|
}
|
||||||
|
|
||||||
// A list of removed attributes from 3.0.
|
|
||||||
const removedAttributes = [
|
|
||||||
'autoresize',
|
|
||||||
'disableguestresize',
|
|
||||||
'guestinstance'
|
|
||||||
]
|
|
||||||
|
|
||||||
// Represents the internal state of the WebView node.
|
// Represents the internal state of the WebView node.
|
||||||
class WebViewImpl {
|
class WebViewImpl {
|
||||||
constructor (webviewNode) {
|
constructor (webviewNode) {
|
||||||
|
@ -32,13 +25,6 @@ class WebViewImpl {
|
||||||
this.beforeFirstNavigation = true
|
this.beforeFirstNavigation = true
|
||||||
this.hasFocus = false
|
this.hasFocus = false
|
||||||
|
|
||||||
// Check for removed attributes.
|
|
||||||
for (const attributeName of removedAttributes) {
|
|
||||||
if (this.webviewNode.hasAttribute(attributeName)) {
|
|
||||||
this.reportRemovedAttribute(attributeName)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// on* Event handlers.
|
// on* Event handlers.
|
||||||
this.on = {}
|
this.on = {}
|
||||||
|
|
||||||
|
@ -106,11 +92,6 @@ class WebViewImpl {
|
||||||
// attribute, if necessary. See BrowserPlugin::UpdateDOMAttribute for more
|
// attribute, if necessary. See BrowserPlugin::UpdateDOMAttribute for more
|
||||||
// details.
|
// details.
|
||||||
handleWebviewAttributeMutation (attributeName, oldValue, newValue) {
|
handleWebviewAttributeMutation (attributeName, oldValue, newValue) {
|
||||||
if (removedAttributes.includes(attributeName)) {
|
|
||||||
this.reportRemovedAttribute(attributeName)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.attributes[attributeName] || this.attributes[attributeName].ignoreMutation) {
|
if (!this.attributes[attributeName] || this.attributes[attributeName].ignoreMutation) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -215,12 +196,6 @@ class WebViewImpl {
|
||||||
// even documented.
|
// even documented.
|
||||||
this.resizeObserver = new ResizeObserver(this.onElementResize.bind(this)).observe(this.internalElement)
|
this.resizeObserver = new ResizeObserver(this.onElementResize.bind(this)).observe(this.internalElement)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(zcbenz): Remove the warning in 4.0.
|
|
||||||
reportRemovedAttribute (attributeName) {
|
|
||||||
console.error(`The "${attributeName}" attribute has been removed from the <webview> tag,`,
|
|
||||||
'see https://github.com/electron/electron/issues/14120 for more.')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Registers <webview> custom element.
|
// Registers <webview> custom element.
|
||||||
|
|
17
spec/fixtures/pages/webview-move-to-window.html
vendored
17
spec/fixtures/pages/webview-move-to-window.html
vendored
|
@ -1,17 +0,0 @@
|
||||||
<html>
|
|
||||||
<body>
|
|
||||||
<script type="text/javascript" charset="utf-8">
|
|
||||||
var ipcRenderer = require('electron').ipcRenderer
|
|
||||||
|
|
||||||
ipcRenderer.on('guestinstance', function(event, instance) {
|
|
||||||
var webview = new WebView()
|
|
||||||
webview.setAttribute('guestinstance', instance)
|
|
||||||
document.body.appendChild(webview)
|
|
||||||
|
|
||||||
webview.addEventListener('did-attach', function (){
|
|
||||||
ipcRenderer.send('pong')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
23
spec/fixtures/pages/webview-no-guest-resize.html
vendored
23
spec/fixtures/pages/webview-no-guest-resize.html
vendored
|
@ -1,23 +0,0 @@
|
||||||
<html>
|
|
||||||
<style>
|
|
||||||
* {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<body>
|
|
||||||
<webview id="webview" nodeintegration disableguestresize src="resize.html"/>
|
|
||||||
</body>
|
|
||||||
<script type="text/javascript" charset="utf-8">
|
|
||||||
const {ipcRenderer} = require('electron')
|
|
||||||
|
|
||||||
const webview = document.getElementById('webview')
|
|
||||||
webview.addEventListener('did-finish-load', () => {
|
|
||||||
ipcRenderer.send('webview-loaded')
|
|
||||||
}, {once: true})
|
|
||||||
webview.addEventListener('resize', event => {
|
|
||||||
ipcRenderer.send('webview-element-resize', event.newWidth, event.newHeight)
|
|
||||||
}, false)
|
|
||||||
</script>
|
|
||||||
</html>
|
|
Loading…
Add table
Add a link
Reference in a new issue