зеркало из https://github.com/openwpm/OpenWPM.git
Clarified that instrumenting window.nonExisting object properties is not supported
This commit is contained in:
Родитель
22dd48a1a8
Коммит
29d576624e
|
@ -301,6 +301,9 @@ export function jsInstruments(event_id, sendMessagesToLogger) {
|
|||
// Rough implementations of Object.getPropertyDescriptor and Object.getPropertyNames
|
||||
// See http://wiki.ecmascript.org/doku.php?id=harmony:extended_object_api
|
||||
Object.getPropertyDescriptor = function(subject, name) {
|
||||
if (subject === undefined) {
|
||||
throw new Error("Can't get property descriptor for undefined");
|
||||
}
|
||||
let pd = Object.getOwnPropertyDescriptor(subject, name);
|
||||
let proto = Object.getPrototypeOf(subject);
|
||||
while (pd === undefined && proto !== null) {
|
||||
|
|
|
@ -45,6 +45,13 @@
|
|||
console.log("nonExistingProp1 after set - caught exception: ", e);
|
||||
}
|
||||
|
||||
// call non-existing object method
|
||||
try {
|
||||
window.nonExisting.nonExistingMethod1('hello', {'world': true});
|
||||
} catch (e) {
|
||||
console.log("call object method - caught exception: ", e);
|
||||
}
|
||||
|
||||
/*
|
||||
* Interact with partially existing object instrumented non-recursively
|
||||
*/
|
||||
|
@ -111,9 +118,18 @@
|
|||
|
||||
// Instrument non-existing object non-recursively
|
||||
console.log("Instrumenting window.nonExisting!");
|
||||
// Instrument the window.nonExisting property itself (not its object properties)
|
||||
window.instrumentObject(window, "window", {
|
||||
propertiesToInstrument: ["nonExisting"],
|
||||
});
|
||||
// Instrument window.nonExisting object properties - currently not supported
|
||||
// window.instrumentObject(window.nonExisting, "window.nonExisting", {
|
||||
// propertiesToInstrument: [
|
||||
// "existingProp",
|
||||
// "nonExistingProp1",
|
||||
// "nonExistingMethod1",
|
||||
// ],
|
||||
// });
|
||||
|
||||
// Instrument partially existing object non-recursively
|
||||
console.log("Instrumenting window.partiallyExisting!");
|
||||
|
|
Загрузка…
Ссылка в новой задаче