зеркало из https://github.com/openwpm/OpenWPM.git
Made the js instrument tests related to non-existing properties easier to understand at a glance by repeating the symbol prefix in the expected-definitions
This commit is contained in:
Родитель
a67dfe6bde
Коммит
23e3ef2af4
|
@ -7,23 +7,24 @@ from . import utilities as util
|
|||
from .openwpmtest import OpenWPMTest
|
||||
|
||||
GETS_AND_SETS = {
|
||||
("", "get", "{\"existingProp\":\"foo\"}"),
|
||||
("", "get", "{\"existingProp\":\"foo\"}"),
|
||||
("", "get", "{\"existingProp\":\"foo\"}"),
|
||||
("", "get", "{\"existingProp\":\"foo\"}"),
|
||||
(".existingProp", "get", "foo"),
|
||||
("", "get", "{\"existingProp\":\"foo\"}"),
|
||||
(".existingProp", "set", "blah1"),
|
||||
("", "get", "{\"existingProp\":\"blah1\"}"),
|
||||
(".existingProp", "get", "blah1"),
|
||||
("", "get", "{\"existingProp\":\"blah1\"}"),
|
||||
(".nonExistingProp1", "get", "undefined"),
|
||||
("", "get", "{\"existingProp\":\"blah1\"}"),
|
||||
(".nonExistingProp1", "set", "blah1"),
|
||||
("", "get", "{\"existingProp\":\"blah1\"}"),
|
||||
(".nonExistingProp1", "get", "blah1"),
|
||||
("", "get", "{\"existingProp\":\"blah1\"}"), # Note 1
|
||||
(".nonExistingMethod1", "get", "undefined"), # Note 2
|
||||
("window.partiallyExisting", "get", "{\"existingProp\":\"foo\"}"),
|
||||
("window.partiallyExisting", "get", "{\"existingProp\":\"foo\"}"),
|
||||
("window.partiallyExisting", "get", "{\"existingProp\":\"foo\"}"),
|
||||
("window.partiallyExisting", "get", "{\"existingProp\":\"foo\"}"),
|
||||
("window.partiallyExisting.existingProp", "get", "foo"),
|
||||
("window.partiallyExisting", "get", "{\"existingProp\":\"foo\"}"),
|
||||
("window.partiallyExisting.existingProp", "set", "blah1"),
|
||||
("window.partiallyExisting", "get", "{\"existingProp\":\"blah1\"}"),
|
||||
("window.partiallyExisting.existingProp", "get", "blah1"),
|
||||
("window.partiallyExisting", "get", "{\"existingProp\":\"blah1\"}"),
|
||||
("window.partiallyExisting.nonExistingProp1", "get", "undefined"),
|
||||
("window.partiallyExisting", "get", "{\"existingProp\":\"blah1\"}"),
|
||||
("window.partiallyExisting.nonExistingProp1", "set", "blah1"),
|
||||
("window.partiallyExisting", "get", "{\"existingProp\":\"blah1\"}"),
|
||||
("window.partiallyExisting.nonExistingProp1", "get", "blah1"),
|
||||
("window.partiallyExisting", "get",
|
||||
"{\"existingProp\":\"blah1\"}"), # Note 1
|
||||
("window.partiallyExisting.nonExistingMethod1", "get", "undefined"), # Note 2
|
||||
}
|
||||
|
||||
# Note 1: nonExistingProp1 is not enumerable even after being set
|
||||
|
@ -72,4 +73,4 @@ class TestJSInstrumentExistingWindowProperty(OpenWPMTest):
|
|||
rows = db_utils.get_javascript_entries(db, all_columns=True)
|
||||
|
||||
# Check calls of non-recursive instrumentation
|
||||
self._check_calls(rows, 'window.partiallyExisting', TOP_URL, TOP_URL)
|
||||
self._check_calls(rows, '', TOP_URL, TOP_URL)
|
||||
|
|
|
@ -7,33 +7,33 @@ from . import utilities as util
|
|||
from .openwpmtest import OpenWPMTest
|
||||
|
||||
GETS_AND_SETS = {
|
||||
("alreadyInstantiatedMockClassInstance", "get", "{}"),
|
||||
("alreadyInstantiatedMockClassInstance", "get", "{}"),
|
||||
("alreadyInstantiatedMockClassInstance", "get", "{}"),
|
||||
("alreadyInstantiatedMockClassInstance", "get", "{}"),
|
||||
("MockClass.nonExistingProp1", "get", "undefined"),
|
||||
("alreadyInstantiatedMockClassInstance.nonExistingProp1",
|
||||
("window.alreadyInstantiatedMockClassInstance", "get", "{}"),
|
||||
("window.alreadyInstantiatedMockClassInstance", "get", "{}"),
|
||||
("window.alreadyInstantiatedMockClassInstance", "get", "{}"),
|
||||
("window.alreadyInstantiatedMockClassInstance", "get", "{}"),
|
||||
("window.MockClass.nonExistingProp1", "get", "undefined"),
|
||||
("window.alreadyInstantiatedMockClassInstance.nonExistingProp1",
|
||||
"get", "undefined"),
|
||||
("alreadyInstantiatedMockClassInstance", "get", "{}"),
|
||||
("MockClass.nonExistingProp1", "set", "blah1"),
|
||||
("alreadyInstantiatedMockClassInstance.nonExistingProp1", "set", "blah1"),
|
||||
("alreadyInstantiatedMockClassInstance", "get", "{}"),
|
||||
("MockClass.nonExistingProp1", "get", "blah1"),
|
||||
("alreadyInstantiatedMockClassInstance.nonExistingProp1", "get", "blah1"),
|
||||
("alreadyInstantiatedMockClassInstance", "get", "{}"),
|
||||
("MockClass.nonExistingMethod1", "get", "undefined"), # Note 1
|
||||
("alreadyInstantiatedMockClassInstance.nonExistingMethod1",
|
||||
("window.alreadyInstantiatedMockClassInstance", "get", "{}"),
|
||||
("window.MockClass.nonExistingProp1", "set", "blah1"),
|
||||
("window.alreadyInstantiatedMockClassInstance.nonExistingProp1", "set", "blah1"),
|
||||
("window.alreadyInstantiatedMockClassInstance", "get", "{}"),
|
||||
("window.MockClass.nonExistingProp1", "get", "blah1"),
|
||||
("window.alreadyInstantiatedMockClassInstance.nonExistingProp1", "get", "blah1"),
|
||||
("window.alreadyInstantiatedMockClassInstance", "get", "{}"),
|
||||
("window.MockClass.nonExistingMethod1", "get", "undefined"), # Note 1
|
||||
("window.alreadyInstantiatedMockClassInstance.nonExistingMethod1",
|
||||
"get", "undefined"), # Note 1
|
||||
("newMockClassInstance", "get", "{}"),
|
||||
("newMockClassInstance", "get", "{}"),
|
||||
("newMockClassInstance", "get", "{}"),
|
||||
("MockClass.nonExistingProp1", "get", "blah1"), # Note 2
|
||||
("newMockClassInstance", "get", "{}"),
|
||||
("MockClass.nonExistingProp1", "set", "blah1"),
|
||||
("newMockClassInstance", "get", "{}"),
|
||||
("MockClass.nonExistingProp1", "get", "blah1"),
|
||||
("newMockClassInstance", "get", "{}"),
|
||||
("MockClass.nonExistingMethod1", "get", "undefined"), # Note 1
|
||||
("window.newMockClassInstance", "get", "{}"),
|
||||
("window.newMockClassInstance", "get", "{}"),
|
||||
("window.newMockClassInstance", "get", "{}"),
|
||||
("window.MockClass.nonExistingProp1", "get", "blah1"), # Note 2
|
||||
("window.newMockClassInstance", "get", "{}"),
|
||||
("window.MockClass.nonExistingProp1", "set", "blah1"),
|
||||
("window.newMockClassInstance", "get", "{}"),
|
||||
("window.MockClass.nonExistingProp1", "get", "blah1"),
|
||||
("window.newMockClassInstance", "get", "{}"),
|
||||
("window.MockClass.nonExistingMethod1", "get", "undefined"), # Note 1
|
||||
}
|
||||
|
||||
# Note 1: nonExistingMethod1 shows up as a get rather than call
|
||||
|
@ -41,7 +41,7 @@ GETS_AND_SETS = {
|
|||
# should not have a value here yet
|
||||
|
||||
METHOD_CALLS = {
|
||||
("MockClass", "call", None),
|
||||
("window.MockClass", "call", None),
|
||||
}
|
||||
|
||||
TEST_PAGE = "instrument_mock_window_property.html"
|
||||
|
@ -85,4 +85,4 @@ class TestJSInstrumentMockWindowProperty(OpenWPMTest):
|
|||
rows = db_utils.get_javascript_entries(db, all_columns=True)
|
||||
|
||||
# Check calls of non-recursive instrumentation
|
||||
self._check_calls(rows, 'window.', TOP_URL, TOP_URL)
|
||||
self._check_calls(rows, '', TOP_URL, TOP_URL)
|
||||
|
|
|
@ -10,14 +10,16 @@ from .openwpmtest import OpenWPMTest
|
|||
# access the window property's attributes first fails when evaluating
|
||||
# the non-existing window property, thus preventing us from receiving
|
||||
# events about the attributes that were attempted to be accessed
|
||||
# This is why we don't see any gets to window.nonExisting.nonExistingProp1
|
||||
# etc below
|
||||
|
||||
GETS_AND_SETS = {
|
||||
("", "get", "undefined"),
|
||||
("", "get", "undefined"),
|
||||
("", "get", "undefined"),
|
||||
("", "get", "undefined"),
|
||||
("", "get", "undefined"),
|
||||
("", "get", "undefined"),
|
||||
("window.nonExisting", "get", "undefined"),
|
||||
("window.nonExisting", "get", "undefined"),
|
||||
("window.nonExisting", "get", "undefined"),
|
||||
("window.nonExisting", "get", "undefined"),
|
||||
("window.nonExisting", "get", "undefined"),
|
||||
("window.nonExisting", "get", "undefined"),
|
||||
}
|
||||
|
||||
METHOD_CALLS = set()
|
||||
|
@ -63,4 +65,4 @@ class TestJSInstrumentNonExistingWindowProperty(OpenWPMTest):
|
|||
rows = db_utils.get_javascript_entries(db, all_columns=True)
|
||||
|
||||
# Check calls of non-recursive instrumentation
|
||||
self._check_calls(rows, 'window.nonExisting', TOP_URL, TOP_URL)
|
||||
self._check_calls(rows, '', TOP_URL, TOP_URL)
|
||||
|
|
Загрузка…
Ссылка в новой задаче