There is a HTML5 conformance test suite with a test for prototype for HTMLCanvasElement.
This test fails for Safari, Firefox but passes for Opera on Windows 7.
The test has a script which tries to delete the getContext property of the HTMLCanvasElement, and further trying to read getContext should give undefined.
delete window.HTMLCanvasElement.prototype.getContext;
_assertSame(window.HTMLCanvasElement.prototype.getContext, undefined, "window.HTMLCanvasElement.prototype.getContext", "undefined");
This test fails for WebKit (Safari) because the getContext property has DontDelete attribute and so it does not allow the script to delete this property.
Is there any description in the HTML5 specification which says deletion of getContext property by script is valid?
From what I understand, the configurability ([[DontDelete]] in ES3, [[Configurable]] in ES5) of
getContextmethod is described in WebIDL — as any otherCanvasRenderingContext2Dmethods.Take a look at "Interface Prototype Object" section, which says:
And in 4.5.6, you can see:
Note the "[[Configurable]]: true" bit (emphasis mine).