haikuwebkit/LayoutTests/resources/js-test-pre.js

848 lines
25 KiB
JavaScript
Raw Permalink Normal View History

// svg/dynamic-updates tests set enablePixelTesting=true, as we want to dump text + pixel results
if (self.testRunner)
testRunner.dumpAsText(self.enablePixelTesting);
var description, debug, successfullyParsed, errorMessage, silentTestPass, didPassSomeTestsSilently, didFailSomeTests;
silentTestPass = false;
didPassSomeTestsSilently = false;
didFailSomeTests = false;
(function() {
Move focus management API from HTMLDocument to Document https://bugs.webkit.org/show_bug.cgi?id=131079 <rdar://problem/16220103> Reviewed by Timothy Hatcher. Source/WebCore: Merged from Blink (patch by Christophe Dumez): https://src.chromium.org/viewvc/blink?view=rev&revision=165515 Move hasFocus() and attribute activeElement from interface HTMLDocument to DOMDocument as per section Focus management APIs of the HTML5 standard: <http://www.whatwg.org/specs/web-apps/current-work/#focus-management-apis> (1 April 2014). Test: fast/dom/Document/xml-document-focus.xml * bindings/objc/PublicDOMInterfaces.h: Moved hasFocus() and property activeElement from interface DOMHTMLDocument to DOMDocument. * dom/Document.cpp: (WebCore::Document::activeElement): Added. (WebCore::Document::hasFocus): Added. * dom/Document.h: * dom/Document.idl: * html/HTMLDocument.cpp: (WebCore::HTMLDocument::activeElement): Deleted. (WebCore::HTMLDocument::hasFocus): Deleted. * html/HTMLDocument.h: * html/HTMLDocument.idl: LayoutTests: Derived from a Blink patch by Christophe Dumez: https://src.chromium.org/viewvc/blink?view=rev&revision=165515 Made the test in <https://src.chromium.org/viewvc/blink?view=rev&revision=165515> a valid XHTML document. Additionally taught LayoutTests/resources/{js-test, js-test-pre}.js to create actual HTML elements so that these scripts can be used to write DRT tests in XML documents. * fast/dom/Document/xml-document-focus-expected.txt: Added. * fast/dom/Document/xml-document-focus.xml: Added. * resources/js-test-pre.js: Added function createHTMLElement() and modified code to use it instead of document.createElement() so as to work around <https://bugs.webkit.org/show_bug.cgi?id=131074>. * resources/js-test.js: Ditto. Canonical link: https://commits.webkit.org/149172@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166668 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:40:26 +00:00
function createHTMLElement(tagName)
{
// FIXME: In an XML document, document.createElement() creates an element with a null namespace URI.
// So, we need use document.createElementNS() to explicitly create an element with the specified
// tag name in the HTML namespace. We can remove this function and use document.createElement()
// directly once we fix <https://bugs.webkit.org/show_bug.cgi?id=131074>.
if (document.createElementNS)
return document.createElementNS("http://www.w3.org/1999/xhtml", tagName);
return document.createElement(tagName);
}
function getOrCreate(id, tagName)
{
var element = document.getElementById(id);
if (element)
return element;
Move focus management API from HTMLDocument to Document https://bugs.webkit.org/show_bug.cgi?id=131079 <rdar://problem/16220103> Reviewed by Timothy Hatcher. Source/WebCore: Merged from Blink (patch by Christophe Dumez): https://src.chromium.org/viewvc/blink?view=rev&revision=165515 Move hasFocus() and attribute activeElement from interface HTMLDocument to DOMDocument as per section Focus management APIs of the HTML5 standard: <http://www.whatwg.org/specs/web-apps/current-work/#focus-management-apis> (1 April 2014). Test: fast/dom/Document/xml-document-focus.xml * bindings/objc/PublicDOMInterfaces.h: Moved hasFocus() and property activeElement from interface DOMHTMLDocument to DOMDocument. * dom/Document.cpp: (WebCore::Document::activeElement): Added. (WebCore::Document::hasFocus): Added. * dom/Document.h: * dom/Document.idl: * html/HTMLDocument.cpp: (WebCore::HTMLDocument::activeElement): Deleted. (WebCore::HTMLDocument::hasFocus): Deleted. * html/HTMLDocument.h: * html/HTMLDocument.idl: LayoutTests: Derived from a Blink patch by Christophe Dumez: https://src.chromium.org/viewvc/blink?view=rev&revision=165515 Made the test in <https://src.chromium.org/viewvc/blink?view=rev&revision=165515> a valid XHTML document. Additionally taught LayoutTests/resources/{js-test, js-test-pre}.js to create actual HTML elements so that these scripts can be used to write DRT tests in XML documents. * fast/dom/Document/xml-document-focus-expected.txt: Added. * fast/dom/Document/xml-document-focus.xml: Added. * resources/js-test-pre.js: Added function createHTMLElement() and modified code to use it instead of document.createElement() so as to work around <https://bugs.webkit.org/show_bug.cgi?id=131074>. * resources/js-test.js: Ditto. Canonical link: https://commits.webkit.org/149172@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166668 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:40:26 +00:00
element = createHTMLElement(tagName);
element.id = id;
var refNode;
var parent = document.body || document.documentElement;
if (id == "description")
refNode = getOrCreate("console", "div");
else
refNode = parent.firstChild;
parent.insertBefore(element, refNode);
return element;
}
description = function description(msg, quiet)
{
// For MSIE 6 compatibility
Move focus management API from HTMLDocument to Document https://bugs.webkit.org/show_bug.cgi?id=131079 <rdar://problem/16220103> Reviewed by Timothy Hatcher. Source/WebCore: Merged from Blink (patch by Christophe Dumez): https://src.chromium.org/viewvc/blink?view=rev&revision=165515 Move hasFocus() and attribute activeElement from interface HTMLDocument to DOMDocument as per section Focus management APIs of the HTML5 standard: <http://www.whatwg.org/specs/web-apps/current-work/#focus-management-apis> (1 April 2014). Test: fast/dom/Document/xml-document-focus.xml * bindings/objc/PublicDOMInterfaces.h: Moved hasFocus() and property activeElement from interface DOMHTMLDocument to DOMDocument. * dom/Document.cpp: (WebCore::Document::activeElement): Added. (WebCore::Document::hasFocus): Added. * dom/Document.h: * dom/Document.idl: * html/HTMLDocument.cpp: (WebCore::HTMLDocument::activeElement): Deleted. (WebCore::HTMLDocument::hasFocus): Deleted. * html/HTMLDocument.h: * html/HTMLDocument.idl: LayoutTests: Derived from a Blink patch by Christophe Dumez: https://src.chromium.org/viewvc/blink?view=rev&revision=165515 Made the test in <https://src.chromium.org/viewvc/blink?view=rev&revision=165515> a valid XHTML document. Additionally taught LayoutTests/resources/{js-test, js-test-pre}.js to create actual HTML elements so that these scripts can be used to write DRT tests in XML documents. * fast/dom/Document/xml-document-focus-expected.txt: Added. * fast/dom/Document/xml-document-focus.xml: Added. * resources/js-test-pre.js: Added function createHTMLElement() and modified code to use it instead of document.createElement() so as to work around <https://bugs.webkit.org/show_bug.cgi?id=131074>. * resources/js-test.js: Ditto. Canonical link: https://commits.webkit.org/149172@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166668 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:40:26 +00:00
var span = createHTMLElement("span");
if (quiet)
span.innerHTML = '<p>' + msg + '</p><p>On success, you will see no "<span class="fail">FAIL</span>" messages, followed by "<span class="pass">TEST COMPLETE</span>".</p>';
else
span.innerHTML = '<p>' + msg + '</p><p>On success, you will see a series of "<span class="pass">PASS</span>" messages, followed by "<span class="pass">TEST COMPLETE</span>".</p>';
var description = getOrCreate("description", "p");
if (description.firstChild)
description.replaceChild(span, description.firstChild);
else
description.appendChild(span);
};
debug = function debug(msg)
{
Move focus management API from HTMLDocument to Document https://bugs.webkit.org/show_bug.cgi?id=131079 <rdar://problem/16220103> Reviewed by Timothy Hatcher. Source/WebCore: Merged from Blink (patch by Christophe Dumez): https://src.chromium.org/viewvc/blink?view=rev&revision=165515 Move hasFocus() and attribute activeElement from interface HTMLDocument to DOMDocument as per section Focus management APIs of the HTML5 standard: <http://www.whatwg.org/specs/web-apps/current-work/#focus-management-apis> (1 April 2014). Test: fast/dom/Document/xml-document-focus.xml * bindings/objc/PublicDOMInterfaces.h: Moved hasFocus() and property activeElement from interface DOMHTMLDocument to DOMDocument. * dom/Document.cpp: (WebCore::Document::activeElement): Added. (WebCore::Document::hasFocus): Added. * dom/Document.h: * dom/Document.idl: * html/HTMLDocument.cpp: (WebCore::HTMLDocument::activeElement): Deleted. (WebCore::HTMLDocument::hasFocus): Deleted. * html/HTMLDocument.h: * html/HTMLDocument.idl: LayoutTests: Derived from a Blink patch by Christophe Dumez: https://src.chromium.org/viewvc/blink?view=rev&revision=165515 Made the test in <https://src.chromium.org/viewvc/blink?view=rev&revision=165515> a valid XHTML document. Additionally taught LayoutTests/resources/{js-test, js-test-pre}.js to create actual HTML elements so that these scripts can be used to write DRT tests in XML documents. * fast/dom/Document/xml-document-focus-expected.txt: Added. * fast/dom/Document/xml-document-focus.xml: Added. * resources/js-test-pre.js: Added function createHTMLElement() and modified code to use it instead of document.createElement() so as to work around <https://bugs.webkit.org/show_bug.cgi?id=131074>. * resources/js-test.js: Ditto. Canonical link: https://commits.webkit.org/149172@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166668 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:40:26 +00:00
var span = createHTMLElement("span");
getOrCreate("console", "div").appendChild(span); // insert it first so XHTML knows the namespace
span.innerHTML = msg + '<br />';
};
var css =
".pass {" +
"font-weight: bold;" +
"color: green;" +
"}" +
".fail {" +
"font-weight: bold;" +
"color: red;" +
"}" +
"#console {" +
"white-space: pre-wrap;" +
"font-family: monospace;" +
"}";
function insertStyleSheet()
{
Move focus management API from HTMLDocument to Document https://bugs.webkit.org/show_bug.cgi?id=131079 <rdar://problem/16220103> Reviewed by Timothy Hatcher. Source/WebCore: Merged from Blink (patch by Christophe Dumez): https://src.chromium.org/viewvc/blink?view=rev&revision=165515 Move hasFocus() and attribute activeElement from interface HTMLDocument to DOMDocument as per section Focus management APIs of the HTML5 standard: <http://www.whatwg.org/specs/web-apps/current-work/#focus-management-apis> (1 April 2014). Test: fast/dom/Document/xml-document-focus.xml * bindings/objc/PublicDOMInterfaces.h: Moved hasFocus() and property activeElement from interface DOMHTMLDocument to DOMDocument. * dom/Document.cpp: (WebCore::Document::activeElement): Added. (WebCore::Document::hasFocus): Added. * dom/Document.h: * dom/Document.idl: * html/HTMLDocument.cpp: (WebCore::HTMLDocument::activeElement): Deleted. (WebCore::HTMLDocument::hasFocus): Deleted. * html/HTMLDocument.h: * html/HTMLDocument.idl: LayoutTests: Derived from a Blink patch by Christophe Dumez: https://src.chromium.org/viewvc/blink?view=rev&revision=165515 Made the test in <https://src.chromium.org/viewvc/blink?view=rev&revision=165515> a valid XHTML document. Additionally taught LayoutTests/resources/{js-test, js-test-pre}.js to create actual HTML elements so that these scripts can be used to write DRT tests in XML documents. * fast/dom/Document/xml-document-focus-expected.txt: Added. * fast/dom/Document/xml-document-focus.xml: Added. * resources/js-test-pre.js: Added function createHTMLElement() and modified code to use it instead of document.createElement() so as to work around <https://bugs.webkit.org/show_bug.cgi?id=131074>. * resources/js-test.js: Ditto. Canonical link: https://commits.webkit.org/149172@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166668 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:40:26 +00:00
var styleElement = createHTMLElement("style");
styleElement.textContent = css;
(document.head || document.documentElement).appendChild(styleElement);
}
if (!isWorker())
insertStyleSheet();
self.onerror = function(message)
{
errorMessage = message;
};
})();
function isWorker()
{
// It's conceivable that someone would stub out 'document' in a worker so
// also check for childNodes, an arbitrary DOM-related object that is
// meaningless in a WorkerContext.
return (typeof document === 'undefined' || typeof document.childNodes === 'undefined') && !!self.importScripts;
}
function descriptionQuiet(msg) { description(msg, true); }
function escapeHTML(text)
{
return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\0/g, "\\0");
}
Clean up SourceProvider and add caller relative load script to jsc.cpp https://bugs.webkit.org/show_bug.cgi?id=214205 Reviewed by Yusuke Suzuki. JSTests: There are two main changes here. The first is converting most invocations of load to also pass "caller relative" as the second parameter. This lets those tests be run from any working directory rather than only the same directory as the test script. The second change is to prohibit "bare-name" specifiers in our CLI's module loader. This matches pretty much all other module loaders, including WebCore and our Obj-C API. * modules/aliased-names.js: * modules/aliasing/drink.js: * modules/caching-should-not-make-ambiguous.js: * modules/default-error/main.js: * modules/execution-order-cyclic/5.js: * modules/execution-order-dag/5.js: * modules/execution-order-tree/5.js: * modules/indirect-export-error/indirect-export-default-2.js: * modules/namespace-ambiguous/ambiguous-2.js: * modules/namespace-ambiguous/ambiguous.js: * modules/namespace-re-export.js: * modules/uncacheable-when-see-star.js: * stress/global-const-redeclaration-setting-2.js: * stress/global-const-redeclaration-setting-3.js: * stress/global-const-redeclaration-setting-4.js: * stress/global-const-redeclaration-setting-5.js: * stress/global-const-redeclaration-setting.js: * stress/global-lexical-redeclare-variable.js: * stress/global-lexical-redefine-const.js: * stress/global-lexical-variable-tdz.js: * stress/global-lexical-variable-unresolved-property.js: * stress/global-property-into-variable-get-from-scope.js: * stress/import-with-empty-string.js: * stress/jsonp-literal-parser-semicolon-is-not-assignment.js: * stress/op_add.js: * stress/op_bitand.js: * stress/op_bitor.js: * stress/op_bitxor.js: * stress/op_div-ConstVar.js: * stress/op_div-VarConst.js: * stress/op_div-VarVar.js: * stress/op_lshift-ConstVar.js: * stress/op_lshift-VarConst.js: * stress/op_lshift-VarVar.js: * stress/op_mod-ConstVar.js: * stress/op_mod-VarConst.js: * stress/op_mod-VarVar.js: * stress/op_mul-ConstVar.js: * stress/op_mul-VarConst.js: * stress/op_mul-VarVar.js: * stress/op_negate.js: * stress/op_postdec.js: * stress/op_postinc.js: * stress/op_predec.js: * stress/op_preinc.js: * stress/op_rshift-ConstVar.js: * stress/op_rshift-VarConst.js: * stress/op_rshift-VarVar.js: * stress/op_sub-ConstVar.js: * stress/op_sub-VarConst.js: * stress/op_sub-VarVar.js: * stress/op_urshift-ConstVar.js: * stress/op_urshift-VarConst.js: * stress/op_urshift-VarVar.js: * stress/regress-159779-1.js: (makeUseRegressionTest): * stress/regress-159779-2.js: (makeUseRegressionTest): * stress/resources/typedarray-constructor-helper-functions.js: * stress/resources/typedarray-test-helper-functions.js: * stress/sampling-profiler-anonymous-function.js: * stress/sampling-profiler-basic.js: * stress/sampling-profiler-bound-function-name.js: * stress/sampling-profiler-deep-stack.js: * stress/sampling-profiler-display-name.js: * stress/sampling-profiler-internal-function-name.js: * stress/sampling-profiler-microtasks.js: * stress/sampling-profiler-wasm-name-section.js: * stress/sampling-profiler-wasm.js: * stress/shadow-chicken-disabled.js: * stress/shadow-chicken-enabled.js: * stress/typedarray-constructor.js: * stress/typedarray-copyWithin.js: * stress/typedarray-every.js: * stress/typedarray-fill.js: * stress/typedarray-filter.js: * stress/typedarray-find.js: * stress/typedarray-findIndex.js: * stress/typedarray-forEach.js: * stress/typedarray-from.js: * stress/typedarray-includes.js: * stress/typedarray-indexOf.js: * stress/typedarray-lastIndexOf.js: * stress/typedarray-map.js: * stress/typedarray-of.js: * stress/typedarray-reduce.js: * stress/typedarray-reduceRight.js: * stress/typedarray-set.js: * stress/typedarray-slice.js: * stress/typedarray-some.js: * stress/typedarray-sort.js: * stress/typedarray-subarray.js: * wasm/Builder.js: * wasm/Builder_WebAssemblyBinary.js: * wasm/LowLevelBinary.js: * wasm/README.md: * wasm/WASM.js: * wasm/regress/selectf64.js: * wasm/spec-harness.js: (import.string_appeared_here.then): LayoutTests/imported/w3c: Rebaseline module loader error messages against the new string. * web-platform-tests/html/semantics/scripting-1/the-script-element/module/specifier-error-expected.txt: Source/JavaScriptCore: This patch originally was just to add an optional parameter to our load function so that any relative path is computed with respect to calling script. Rather than computing the path relative to the current working directory. The main advantage of this is now you can run all the JSTests/stress scripts from anywhere rather than only from the stress directory. This also matches jsc.cpp's module loader implementation. To make this possible a surprising number of changes were needed. Specifically, it was much easier to get this to work if we converted SourceOrigin's url to a WTF::URL rather than just a WTF::String. At the same time it became clear that SourceProvider's m_sourceURL is really not a URL but more of a file name, which can sometimes be a URL. It's possible that we don't need m_sourceURL at all but we should do that in a different patch. Additionally, jsc.cpp now uses WTF::URL for handling file paths. This is cleaner than managing trying to do it ourselves and should work across all the ports. Lastly, the JSC CLI no longer accepts "bare-name" specifiers. i.e. all specifiers must start with "/", "./", or "../". This matches what we do in our Obj-C API and in WebCore. While fixing tests I also noticed that the error message was almost useless since it didn't tell you what the specifier or referrer in question so that information is now part of the user visible error. * API/JSAPIGlobalObject.mm: (JSC::computeValidImportSpecifier): (JSC::JSAPIGlobalObject::moduleLoaderImportModule): * API/JSBase.cpp: (JSEvaluateScript): (JSCheckScriptSyntax): * API/JSObjectRef.cpp: (JSObjectMakeFunction): * API/JSScript.mm: (-[JSScript sourceCode]): * API/JSScriptRef.cpp: * API/glib/JSCContext.cpp: (jsc_context_check_syntax): * builtins/BuiltinExecutables.cpp: (JSC::BuiltinExecutables::BuiltinExecutables): * debugger/DebuggerLocation.cpp: (JSC::DebuggerLocation::DebuggerLocation): * debugger/DebuggerLocation.h: (JSC::DebuggerLocation::DebuggerLocation): * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::sourceParsed): * jsc.cpp: (currentWorkingDirectory): (absolutePath): (GlobalObject::moduleLoaderImportModule): (GlobalObject::moduleLoaderResolve): (jscSource): (fetchModuleFromLocalFileSystem): (GlobalObject::moduleLoaderFetch): (functionLoad): (functionCallerSourceOrigin): (functionDollarAgentStart): (functionCheckModuleSyntax): (runWithOptions): (runInteractive): (ModuleName::startsWithRoot const): Deleted. (ModuleName::ModuleName): Deleted. (extractDirectoryName): Deleted. (resolvePath): Deleted. * parser/Nodes.h: (JSC::ScopeNode::source const): (JSC::ScopeNode::sourceURL const): Deleted. * parser/SourceCode.h: (JSC::makeSource): * parser/SourceCodeKey.h: (JSC::SourceCodeKey::host const): * parser/SourceProvider.cpp: (JSC::SourceProvider::SourceProvider): * parser/SourceProvider.h: (JSC::SourceProvider::sourceURL const): (JSC::StringSourceProvider::create): (JSC::StringSourceProvider::StringSourceProvider): (JSC::SourceProvider::url const): Deleted. * runtime/CachedTypes.cpp: (JSC::CachedSourceOrigin::encode): (JSC::CachedSourceOrigin::decode const): (JSC::CachedSourceProviderShape::encode): (JSC::CachedStringSourceProvider::decode const): (JSC::CachedWebAssemblySourceProvider::decode const): * runtime/Error.cpp: (JSC::addErrorInfo): * runtime/FunctionConstructor.cpp: (JSC::constructFunctionSkippingEvalEnabledCheck): * runtime/ScriptExecutable.h: (JSC::ScriptExecutable::sourceURL const): * runtime/SourceOrigin.h: (JSC::SourceOrigin::SourceOrigin): (JSC::SourceOrigin::url const): (JSC::SourceOrigin::string const): (JSC::SourceOrigin::isNull const): * runtime/ThrowScope.cpp: (JSC::ThrowScope::throwException): * runtime/ThrowScope.h: (JSC::ThrowScope::throwException): (JSC::throwVMException): * tools/FunctionOverrides.cpp: (JSC::initializeOverrideInfo): * tools/JSDollarVM.cpp: (JSC::doPrint): (JSC::functionCrash): Source/WebCore: Refactor WebCore <-> JSC binding layer now that JSC uses WTF::URLs for SourceOrigins. Also, improve module loading error messages to include the specifier and referrer when producing errors around bare-name specifiers. New error message behavior is already tested so existing tests have been updated. * bindings/js/CachedScriptSourceProvider.h: (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider): * bindings/js/JSEventListener.cpp: (WebCore::JSEventListener::handleEvent): * bindings/js/JSEventListener.h: (WebCore::JSEventListener::sourceURL const): * bindings/js/JSLazyEventListener.cpp: (WebCore::JSLazyEventListener::JSLazyEventListener): (WebCore::JSLazyEventListener::initializeJSFunction const): (WebCore::JSLazyEventListener::create): * bindings/js/JSLazyEventListener.h: * bindings/js/ScriptController.cpp: (WebCore::ScriptController::evaluateInWorld): (WebCore::ScriptController::evaluateModule): (WebCore::ScriptController::callInWorld): * bindings/js/ScriptController.h: (WebCore::ScriptController::sourceURL const): * bindings/js/ScriptModuleLoader.cpp: (WebCore::resolveModuleSpecifier): (WebCore::rejectPromise): * bindings/js/ScriptSourceCode.h: (WebCore::ScriptSourceCode::ScriptSourceCode): (WebCore::ScriptSourceCode::url const): Source/WebKitLegacy/mac: Use the source origin's URL for the debugger since it's the true URL for the script. * WebView/WebScriptDebugger.mm: (WebScriptDebugger::sourceParsed): Source/WTF: Using a URL as a boolean in a conditional should be a compile error. Currently, it "works" because it actually calls `operator NSURL*()`... which is likely NOT what you wanted. Until we decide what it means to have a URL in a conditional it will be a compile error. * wtf/URL.cpp: (WTF::URL::fileSystemPath const): * wtf/URL.h: LayoutTests: js-test-pre needs to strip the parts of file urls between file:/// and LayoutTests because that is dependent on the system running the tests. Tests using these harnesses may not be using a server to host the test files. Rebaseline module loader error messages against the new string. * http/tests/resources/js-test-pre.js: (escapeHTMLAndStripFileURLs): (testFailed): (escapeHTML): Deleted. (testPassed): Deleted. * js/dom/modules/import-incorrect-relative-specifier-expected.txt: * js/dom/modules/module-incorrect-relative-specifier-expected.txt: * resources/js-test-pre.js: (escapeHTMLAndStripFileURLs): (testFailed): (escapeHTML): Deleted. (testPassed): Deleted. Canonical link: https://commits.webkit.org/227069@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@264304 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-07-13 17:35:35 +00:00
function escapeHTMLAndStripFileURLs(text)
{
return escapeHTML(text).replace(/file:\/\/.*LayoutTests/g, "file:///LayoutTests");
}
function testPassed(msg)
{
if (silentTestPass)
didPassSomeTestsSilently = true;
else
Clean up SourceProvider and add caller relative load script to jsc.cpp https://bugs.webkit.org/show_bug.cgi?id=214205 Reviewed by Yusuke Suzuki. JSTests: There are two main changes here. The first is converting most invocations of load to also pass "caller relative" as the second parameter. This lets those tests be run from any working directory rather than only the same directory as the test script. The second change is to prohibit "bare-name" specifiers in our CLI's module loader. This matches pretty much all other module loaders, including WebCore and our Obj-C API. * modules/aliased-names.js: * modules/aliasing/drink.js: * modules/caching-should-not-make-ambiguous.js: * modules/default-error/main.js: * modules/execution-order-cyclic/5.js: * modules/execution-order-dag/5.js: * modules/execution-order-tree/5.js: * modules/indirect-export-error/indirect-export-default-2.js: * modules/namespace-ambiguous/ambiguous-2.js: * modules/namespace-ambiguous/ambiguous.js: * modules/namespace-re-export.js: * modules/uncacheable-when-see-star.js: * stress/global-const-redeclaration-setting-2.js: * stress/global-const-redeclaration-setting-3.js: * stress/global-const-redeclaration-setting-4.js: * stress/global-const-redeclaration-setting-5.js: * stress/global-const-redeclaration-setting.js: * stress/global-lexical-redeclare-variable.js: * stress/global-lexical-redefine-const.js: * stress/global-lexical-variable-tdz.js: * stress/global-lexical-variable-unresolved-property.js: * stress/global-property-into-variable-get-from-scope.js: * stress/import-with-empty-string.js: * stress/jsonp-literal-parser-semicolon-is-not-assignment.js: * stress/op_add.js: * stress/op_bitand.js: * stress/op_bitor.js: * stress/op_bitxor.js: * stress/op_div-ConstVar.js: * stress/op_div-VarConst.js: * stress/op_div-VarVar.js: * stress/op_lshift-ConstVar.js: * stress/op_lshift-VarConst.js: * stress/op_lshift-VarVar.js: * stress/op_mod-ConstVar.js: * stress/op_mod-VarConst.js: * stress/op_mod-VarVar.js: * stress/op_mul-ConstVar.js: * stress/op_mul-VarConst.js: * stress/op_mul-VarVar.js: * stress/op_negate.js: * stress/op_postdec.js: * stress/op_postinc.js: * stress/op_predec.js: * stress/op_preinc.js: * stress/op_rshift-ConstVar.js: * stress/op_rshift-VarConst.js: * stress/op_rshift-VarVar.js: * stress/op_sub-ConstVar.js: * stress/op_sub-VarConst.js: * stress/op_sub-VarVar.js: * stress/op_urshift-ConstVar.js: * stress/op_urshift-VarConst.js: * stress/op_urshift-VarVar.js: * stress/regress-159779-1.js: (makeUseRegressionTest): * stress/regress-159779-2.js: (makeUseRegressionTest): * stress/resources/typedarray-constructor-helper-functions.js: * stress/resources/typedarray-test-helper-functions.js: * stress/sampling-profiler-anonymous-function.js: * stress/sampling-profiler-basic.js: * stress/sampling-profiler-bound-function-name.js: * stress/sampling-profiler-deep-stack.js: * stress/sampling-profiler-display-name.js: * stress/sampling-profiler-internal-function-name.js: * stress/sampling-profiler-microtasks.js: * stress/sampling-profiler-wasm-name-section.js: * stress/sampling-profiler-wasm.js: * stress/shadow-chicken-disabled.js: * stress/shadow-chicken-enabled.js: * stress/typedarray-constructor.js: * stress/typedarray-copyWithin.js: * stress/typedarray-every.js: * stress/typedarray-fill.js: * stress/typedarray-filter.js: * stress/typedarray-find.js: * stress/typedarray-findIndex.js: * stress/typedarray-forEach.js: * stress/typedarray-from.js: * stress/typedarray-includes.js: * stress/typedarray-indexOf.js: * stress/typedarray-lastIndexOf.js: * stress/typedarray-map.js: * stress/typedarray-of.js: * stress/typedarray-reduce.js: * stress/typedarray-reduceRight.js: * stress/typedarray-set.js: * stress/typedarray-slice.js: * stress/typedarray-some.js: * stress/typedarray-sort.js: * stress/typedarray-subarray.js: * wasm/Builder.js: * wasm/Builder_WebAssemblyBinary.js: * wasm/LowLevelBinary.js: * wasm/README.md: * wasm/WASM.js: * wasm/regress/selectf64.js: * wasm/spec-harness.js: (import.string_appeared_here.then): LayoutTests/imported/w3c: Rebaseline module loader error messages against the new string. * web-platform-tests/html/semantics/scripting-1/the-script-element/module/specifier-error-expected.txt: Source/JavaScriptCore: This patch originally was just to add an optional parameter to our load function so that any relative path is computed with respect to calling script. Rather than computing the path relative to the current working directory. The main advantage of this is now you can run all the JSTests/stress scripts from anywhere rather than only from the stress directory. This also matches jsc.cpp's module loader implementation. To make this possible a surprising number of changes were needed. Specifically, it was much easier to get this to work if we converted SourceOrigin's url to a WTF::URL rather than just a WTF::String. At the same time it became clear that SourceProvider's m_sourceURL is really not a URL but more of a file name, which can sometimes be a URL. It's possible that we don't need m_sourceURL at all but we should do that in a different patch. Additionally, jsc.cpp now uses WTF::URL for handling file paths. This is cleaner than managing trying to do it ourselves and should work across all the ports. Lastly, the JSC CLI no longer accepts "bare-name" specifiers. i.e. all specifiers must start with "/", "./", or "../". This matches what we do in our Obj-C API and in WebCore. While fixing tests I also noticed that the error message was almost useless since it didn't tell you what the specifier or referrer in question so that information is now part of the user visible error. * API/JSAPIGlobalObject.mm: (JSC::computeValidImportSpecifier): (JSC::JSAPIGlobalObject::moduleLoaderImportModule): * API/JSBase.cpp: (JSEvaluateScript): (JSCheckScriptSyntax): * API/JSObjectRef.cpp: (JSObjectMakeFunction): * API/JSScript.mm: (-[JSScript sourceCode]): * API/JSScriptRef.cpp: * API/glib/JSCContext.cpp: (jsc_context_check_syntax): * builtins/BuiltinExecutables.cpp: (JSC::BuiltinExecutables::BuiltinExecutables): * debugger/DebuggerLocation.cpp: (JSC::DebuggerLocation::DebuggerLocation): * debugger/DebuggerLocation.h: (JSC::DebuggerLocation::DebuggerLocation): * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::sourceParsed): * jsc.cpp: (currentWorkingDirectory): (absolutePath): (GlobalObject::moduleLoaderImportModule): (GlobalObject::moduleLoaderResolve): (jscSource): (fetchModuleFromLocalFileSystem): (GlobalObject::moduleLoaderFetch): (functionLoad): (functionCallerSourceOrigin): (functionDollarAgentStart): (functionCheckModuleSyntax): (runWithOptions): (runInteractive): (ModuleName::startsWithRoot const): Deleted. (ModuleName::ModuleName): Deleted. (extractDirectoryName): Deleted. (resolvePath): Deleted. * parser/Nodes.h: (JSC::ScopeNode::source const): (JSC::ScopeNode::sourceURL const): Deleted. * parser/SourceCode.h: (JSC::makeSource): * parser/SourceCodeKey.h: (JSC::SourceCodeKey::host const): * parser/SourceProvider.cpp: (JSC::SourceProvider::SourceProvider): * parser/SourceProvider.h: (JSC::SourceProvider::sourceURL const): (JSC::StringSourceProvider::create): (JSC::StringSourceProvider::StringSourceProvider): (JSC::SourceProvider::url const): Deleted. * runtime/CachedTypes.cpp: (JSC::CachedSourceOrigin::encode): (JSC::CachedSourceOrigin::decode const): (JSC::CachedSourceProviderShape::encode): (JSC::CachedStringSourceProvider::decode const): (JSC::CachedWebAssemblySourceProvider::decode const): * runtime/Error.cpp: (JSC::addErrorInfo): * runtime/FunctionConstructor.cpp: (JSC::constructFunctionSkippingEvalEnabledCheck): * runtime/ScriptExecutable.h: (JSC::ScriptExecutable::sourceURL const): * runtime/SourceOrigin.h: (JSC::SourceOrigin::SourceOrigin): (JSC::SourceOrigin::url const): (JSC::SourceOrigin::string const): (JSC::SourceOrigin::isNull const): * runtime/ThrowScope.cpp: (JSC::ThrowScope::throwException): * runtime/ThrowScope.h: (JSC::ThrowScope::throwException): (JSC::throwVMException): * tools/FunctionOverrides.cpp: (JSC::initializeOverrideInfo): * tools/JSDollarVM.cpp: (JSC::doPrint): (JSC::functionCrash): Source/WebCore: Refactor WebCore <-> JSC binding layer now that JSC uses WTF::URLs for SourceOrigins. Also, improve module loading error messages to include the specifier and referrer when producing errors around bare-name specifiers. New error message behavior is already tested so existing tests have been updated. * bindings/js/CachedScriptSourceProvider.h: (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider): * bindings/js/JSEventListener.cpp: (WebCore::JSEventListener::handleEvent): * bindings/js/JSEventListener.h: (WebCore::JSEventListener::sourceURL const): * bindings/js/JSLazyEventListener.cpp: (WebCore::JSLazyEventListener::JSLazyEventListener): (WebCore::JSLazyEventListener::initializeJSFunction const): (WebCore::JSLazyEventListener::create): * bindings/js/JSLazyEventListener.h: * bindings/js/ScriptController.cpp: (WebCore::ScriptController::evaluateInWorld): (WebCore::ScriptController::evaluateModule): (WebCore::ScriptController::callInWorld): * bindings/js/ScriptController.h: (WebCore::ScriptController::sourceURL const): * bindings/js/ScriptModuleLoader.cpp: (WebCore::resolveModuleSpecifier): (WebCore::rejectPromise): * bindings/js/ScriptSourceCode.h: (WebCore::ScriptSourceCode::ScriptSourceCode): (WebCore::ScriptSourceCode::url const): Source/WebKitLegacy/mac: Use the source origin's URL for the debugger since it's the true URL for the script. * WebView/WebScriptDebugger.mm: (WebScriptDebugger::sourceParsed): Source/WTF: Using a URL as a boolean in a conditional should be a compile error. Currently, it "works" because it actually calls `operator NSURL*()`... which is likely NOT what you wanted. Until we decide what it means to have a URL in a conditional it will be a compile error. * wtf/URL.cpp: (WTF::URL::fileSystemPath const): * wtf/URL.h: LayoutTests: js-test-pre needs to strip the parts of file urls between file:/// and LayoutTests because that is dependent on the system running the tests. Tests using these harnesses may not be using a server to host the test files. Rebaseline module loader error messages against the new string. * http/tests/resources/js-test-pre.js: (escapeHTMLAndStripFileURLs): (testFailed): (escapeHTML): Deleted. (testPassed): Deleted. * js/dom/modules/import-incorrect-relative-specifier-expected.txt: * js/dom/modules/module-incorrect-relative-specifier-expected.txt: * resources/js-test-pre.js: (escapeHTMLAndStripFileURLs): (testFailed): (escapeHTML): Deleted. (testPassed): Deleted. Canonical link: https://commits.webkit.org/227069@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@264304 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-07-13 17:35:35 +00:00
debug('<span><span class="pass">PASS</span> ' + escapeHTMLAndStripFileURLs(msg) + '</span>');
}
function testFailed(msg)
{
didFailSomeTests = true;
Clean up SourceProvider and add caller relative load script to jsc.cpp https://bugs.webkit.org/show_bug.cgi?id=214205 Reviewed by Yusuke Suzuki. JSTests: There are two main changes here. The first is converting most invocations of load to also pass "caller relative" as the second parameter. This lets those tests be run from any working directory rather than only the same directory as the test script. The second change is to prohibit "bare-name" specifiers in our CLI's module loader. This matches pretty much all other module loaders, including WebCore and our Obj-C API. * modules/aliased-names.js: * modules/aliasing/drink.js: * modules/caching-should-not-make-ambiguous.js: * modules/default-error/main.js: * modules/execution-order-cyclic/5.js: * modules/execution-order-dag/5.js: * modules/execution-order-tree/5.js: * modules/indirect-export-error/indirect-export-default-2.js: * modules/namespace-ambiguous/ambiguous-2.js: * modules/namespace-ambiguous/ambiguous.js: * modules/namespace-re-export.js: * modules/uncacheable-when-see-star.js: * stress/global-const-redeclaration-setting-2.js: * stress/global-const-redeclaration-setting-3.js: * stress/global-const-redeclaration-setting-4.js: * stress/global-const-redeclaration-setting-5.js: * stress/global-const-redeclaration-setting.js: * stress/global-lexical-redeclare-variable.js: * stress/global-lexical-redefine-const.js: * stress/global-lexical-variable-tdz.js: * stress/global-lexical-variable-unresolved-property.js: * stress/global-property-into-variable-get-from-scope.js: * stress/import-with-empty-string.js: * stress/jsonp-literal-parser-semicolon-is-not-assignment.js: * stress/op_add.js: * stress/op_bitand.js: * stress/op_bitor.js: * stress/op_bitxor.js: * stress/op_div-ConstVar.js: * stress/op_div-VarConst.js: * stress/op_div-VarVar.js: * stress/op_lshift-ConstVar.js: * stress/op_lshift-VarConst.js: * stress/op_lshift-VarVar.js: * stress/op_mod-ConstVar.js: * stress/op_mod-VarConst.js: * stress/op_mod-VarVar.js: * stress/op_mul-ConstVar.js: * stress/op_mul-VarConst.js: * stress/op_mul-VarVar.js: * stress/op_negate.js: * stress/op_postdec.js: * stress/op_postinc.js: * stress/op_predec.js: * stress/op_preinc.js: * stress/op_rshift-ConstVar.js: * stress/op_rshift-VarConst.js: * stress/op_rshift-VarVar.js: * stress/op_sub-ConstVar.js: * stress/op_sub-VarConst.js: * stress/op_sub-VarVar.js: * stress/op_urshift-ConstVar.js: * stress/op_urshift-VarConst.js: * stress/op_urshift-VarVar.js: * stress/regress-159779-1.js: (makeUseRegressionTest): * stress/regress-159779-2.js: (makeUseRegressionTest): * stress/resources/typedarray-constructor-helper-functions.js: * stress/resources/typedarray-test-helper-functions.js: * stress/sampling-profiler-anonymous-function.js: * stress/sampling-profiler-basic.js: * stress/sampling-profiler-bound-function-name.js: * stress/sampling-profiler-deep-stack.js: * stress/sampling-profiler-display-name.js: * stress/sampling-profiler-internal-function-name.js: * stress/sampling-profiler-microtasks.js: * stress/sampling-profiler-wasm-name-section.js: * stress/sampling-profiler-wasm.js: * stress/shadow-chicken-disabled.js: * stress/shadow-chicken-enabled.js: * stress/typedarray-constructor.js: * stress/typedarray-copyWithin.js: * stress/typedarray-every.js: * stress/typedarray-fill.js: * stress/typedarray-filter.js: * stress/typedarray-find.js: * stress/typedarray-findIndex.js: * stress/typedarray-forEach.js: * stress/typedarray-from.js: * stress/typedarray-includes.js: * stress/typedarray-indexOf.js: * stress/typedarray-lastIndexOf.js: * stress/typedarray-map.js: * stress/typedarray-of.js: * stress/typedarray-reduce.js: * stress/typedarray-reduceRight.js: * stress/typedarray-set.js: * stress/typedarray-slice.js: * stress/typedarray-some.js: * stress/typedarray-sort.js: * stress/typedarray-subarray.js: * wasm/Builder.js: * wasm/Builder_WebAssemblyBinary.js: * wasm/LowLevelBinary.js: * wasm/README.md: * wasm/WASM.js: * wasm/regress/selectf64.js: * wasm/spec-harness.js: (import.string_appeared_here.then): LayoutTests/imported/w3c: Rebaseline module loader error messages against the new string. * web-platform-tests/html/semantics/scripting-1/the-script-element/module/specifier-error-expected.txt: Source/JavaScriptCore: This patch originally was just to add an optional parameter to our load function so that any relative path is computed with respect to calling script. Rather than computing the path relative to the current working directory. The main advantage of this is now you can run all the JSTests/stress scripts from anywhere rather than only from the stress directory. This also matches jsc.cpp's module loader implementation. To make this possible a surprising number of changes were needed. Specifically, it was much easier to get this to work if we converted SourceOrigin's url to a WTF::URL rather than just a WTF::String. At the same time it became clear that SourceProvider's m_sourceURL is really not a URL but more of a file name, which can sometimes be a URL. It's possible that we don't need m_sourceURL at all but we should do that in a different patch. Additionally, jsc.cpp now uses WTF::URL for handling file paths. This is cleaner than managing trying to do it ourselves and should work across all the ports. Lastly, the JSC CLI no longer accepts "bare-name" specifiers. i.e. all specifiers must start with "/", "./", or "../". This matches what we do in our Obj-C API and in WebCore. While fixing tests I also noticed that the error message was almost useless since it didn't tell you what the specifier or referrer in question so that information is now part of the user visible error. * API/JSAPIGlobalObject.mm: (JSC::computeValidImportSpecifier): (JSC::JSAPIGlobalObject::moduleLoaderImportModule): * API/JSBase.cpp: (JSEvaluateScript): (JSCheckScriptSyntax): * API/JSObjectRef.cpp: (JSObjectMakeFunction): * API/JSScript.mm: (-[JSScript sourceCode]): * API/JSScriptRef.cpp: * API/glib/JSCContext.cpp: (jsc_context_check_syntax): * builtins/BuiltinExecutables.cpp: (JSC::BuiltinExecutables::BuiltinExecutables): * debugger/DebuggerLocation.cpp: (JSC::DebuggerLocation::DebuggerLocation): * debugger/DebuggerLocation.h: (JSC::DebuggerLocation::DebuggerLocation): * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::sourceParsed): * jsc.cpp: (currentWorkingDirectory): (absolutePath): (GlobalObject::moduleLoaderImportModule): (GlobalObject::moduleLoaderResolve): (jscSource): (fetchModuleFromLocalFileSystem): (GlobalObject::moduleLoaderFetch): (functionLoad): (functionCallerSourceOrigin): (functionDollarAgentStart): (functionCheckModuleSyntax): (runWithOptions): (runInteractive): (ModuleName::startsWithRoot const): Deleted. (ModuleName::ModuleName): Deleted. (extractDirectoryName): Deleted. (resolvePath): Deleted. * parser/Nodes.h: (JSC::ScopeNode::source const): (JSC::ScopeNode::sourceURL const): Deleted. * parser/SourceCode.h: (JSC::makeSource): * parser/SourceCodeKey.h: (JSC::SourceCodeKey::host const): * parser/SourceProvider.cpp: (JSC::SourceProvider::SourceProvider): * parser/SourceProvider.h: (JSC::SourceProvider::sourceURL const): (JSC::StringSourceProvider::create): (JSC::StringSourceProvider::StringSourceProvider): (JSC::SourceProvider::url const): Deleted. * runtime/CachedTypes.cpp: (JSC::CachedSourceOrigin::encode): (JSC::CachedSourceOrigin::decode const): (JSC::CachedSourceProviderShape::encode): (JSC::CachedStringSourceProvider::decode const): (JSC::CachedWebAssemblySourceProvider::decode const): * runtime/Error.cpp: (JSC::addErrorInfo): * runtime/FunctionConstructor.cpp: (JSC::constructFunctionSkippingEvalEnabledCheck): * runtime/ScriptExecutable.h: (JSC::ScriptExecutable::sourceURL const): * runtime/SourceOrigin.h: (JSC::SourceOrigin::SourceOrigin): (JSC::SourceOrigin::url const): (JSC::SourceOrigin::string const): (JSC::SourceOrigin::isNull const): * runtime/ThrowScope.cpp: (JSC::ThrowScope::throwException): * runtime/ThrowScope.h: (JSC::ThrowScope::throwException): (JSC::throwVMException): * tools/FunctionOverrides.cpp: (JSC::initializeOverrideInfo): * tools/JSDollarVM.cpp: (JSC::doPrint): (JSC::functionCrash): Source/WebCore: Refactor WebCore <-> JSC binding layer now that JSC uses WTF::URLs for SourceOrigins. Also, improve module loading error messages to include the specifier and referrer when producing errors around bare-name specifiers. New error message behavior is already tested so existing tests have been updated. * bindings/js/CachedScriptSourceProvider.h: (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider): * bindings/js/JSEventListener.cpp: (WebCore::JSEventListener::handleEvent): * bindings/js/JSEventListener.h: (WebCore::JSEventListener::sourceURL const): * bindings/js/JSLazyEventListener.cpp: (WebCore::JSLazyEventListener::JSLazyEventListener): (WebCore::JSLazyEventListener::initializeJSFunction const): (WebCore::JSLazyEventListener::create): * bindings/js/JSLazyEventListener.h: * bindings/js/ScriptController.cpp: (WebCore::ScriptController::evaluateInWorld): (WebCore::ScriptController::evaluateModule): (WebCore::ScriptController::callInWorld): * bindings/js/ScriptController.h: (WebCore::ScriptController::sourceURL const): * bindings/js/ScriptModuleLoader.cpp: (WebCore::resolveModuleSpecifier): (WebCore::rejectPromise): * bindings/js/ScriptSourceCode.h: (WebCore::ScriptSourceCode::ScriptSourceCode): (WebCore::ScriptSourceCode::url const): Source/WebKitLegacy/mac: Use the source origin's URL for the debugger since it's the true URL for the script. * WebView/WebScriptDebugger.mm: (WebScriptDebugger::sourceParsed): Source/WTF: Using a URL as a boolean in a conditional should be a compile error. Currently, it "works" because it actually calls `operator NSURL*()`... which is likely NOT what you wanted. Until we decide what it means to have a URL in a conditional it will be a compile error. * wtf/URL.cpp: (WTF::URL::fileSystemPath const): * wtf/URL.h: LayoutTests: js-test-pre needs to strip the parts of file urls between file:/// and LayoutTests because that is dependent on the system running the tests. Tests using these harnesses may not be using a server to host the test files. Rebaseline module loader error messages against the new string. * http/tests/resources/js-test-pre.js: (escapeHTMLAndStripFileURLs): (testFailed): (escapeHTML): Deleted. (testPassed): Deleted. * js/dom/modules/import-incorrect-relative-specifier-expected.txt: * js/dom/modules/module-incorrect-relative-specifier-expected.txt: * resources/js-test-pre.js: (escapeHTMLAndStripFileURLs): (testFailed): (escapeHTML): Deleted. (testPassed): Deleted. Canonical link: https://commits.webkit.org/227069@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@264304 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-07-13 17:35:35 +00:00
debug('<span><span class="fail">FAIL</span> ' + escapeHTMLAndStripFileURLs(msg) + '</span>');
}
function areNumbersEqual(_actual, _expected)
{
if (_expected === 0)
return _actual === _expected && (1/_actual) === (1/_expected);
if (_actual === _expected)
return true;
if (typeof(_expected) == "number" && isNaN(_expected))
return typeof(_actual) == "number" && isNaN(_actual);
return false;
}
function areArraysEqual(_a, _b)
{
try {
if (_a.length !== _b.length)
return false;
for (var i = 0; i < _a.length; i++)
if (!areNumbersEqual(_a[i], _b[i]))
return false;
} catch (ex) {
return false;
}
return true;
}
function isMinusZero(n)
{
// the only way to tell 0 from -0 in JS is the fact that 1/-0 is
// -Infinity instead of Infinity
return n === 0 && 1/n < 0;
}
function isTypedArray(array)
{
return array instanceof Int8Array
|| array instanceof Int16Array
|| array instanceof Int32Array
|| array instanceof Uint8Array
|| array instanceof Uint8ClampedArray
|| array instanceof Uint16Array
|| array instanceof Uint32Array
|| array instanceof Float32Array
|| array instanceof Float64Array;
}
function isResultCorrect(_actual, _expected)
{
if (areNumbersEqual(_actual, _expected))
return true;
if (_expected
&& (Object.prototype.toString.call(_expected) ==
Object.prototype.toString.call([])
|| isTypedArray(_expected)))
return areArraysEqual(_actual, _expected);
return false;
}
function stringify(v)
{
if (v === 0 && 1/v < 0)
return "-0";
else if (isTypedArray(v))
return v.__proto__.constructor.name + ":[" + Array.prototype.join.call(v, ",") + "]";
else
return "" + v;
}
function evalAndLog(_a, _quiet)
{
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
if (typeof _a != "string")
debug("WARN: evalAndLog() expects a string argument");
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
// Log first in case things go horribly wrong or this causes a sync event.
if (!_quiet)
debug(_a);
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
var _av;
try {
_av = eval(_a);
} catch (e) {
testFailed(_a + " threw exception " + e);
}
return _av;
}
Add basic visual/layout viewport support for fixed position layout https://bugs.webkit.org/show_bug.cgi?id=164261 Reviewed by Dean Jackson. Source/WebCore: This patch adds a new behavior for position:fixed objects on zooming. Instead of interpolating between two implicit viewports as we do now, have explicit and distinct layout and visual viewports. The layout viewport is always the size of the initial containing block (i.e. the RenderView). Position:fixed and sticky elements are laid out relative to the layout viewport. The visual viewport is the visible part of the view, in content coordinates. When the user pans and zooms, the visual viewport changes. If it hits the edge of the layout viepwort, it pushes the layout viewport in that direction; it's as if the user is dragging the layout viewport around. The layout viewport is maintained on FrameView, and has to be recomputed when the scroll position changes, when the view size changes, and when the content size (which affets min/max scroll position) changes. Layout viewport size and position are computed in unzoomed coordinates, requiring some new functions on FrameView to return these. Updated the TileCoverageMap to show the layout viewport visually. Subsequent patches will plumb the layout and visual viewports through the scrolling tree. Tests: fast/visual-viewport/nonzoomed-rects.html fast/visual-viewport/zoomed-fixed-scroll-down-then-up.html fast/visual-viewport/zoomed-fixed.html fast/visual-viewport/zoomed-rects.html * page/FrameView.cpp: (WebCore::FrameView::fixedScrollableAreaBoundsInflatedForScrolling): (WebCore::FrameView::scrollPositionRespectingCustomFixedPosition): (WebCore::FrameView::computeLayoutViewportOrigin): (WebCore::FrameView::setLayoutViewportOrigin): (WebCore::FrameView::updateLayoutViewport): (WebCore::FrameView::minStableLayoutViewportOrigin): (WebCore::FrameView::maxStableLayoutViewportOrigin): (WebCore::FrameView::layoutViewportRect): (WebCore::FrameView::visualViewportRect): (WebCore::FrameView::viewportConstrainedVisibleContentRect): (WebCore::FrameView::rectForFixedPositionLayout): (WebCore::FrameView::scrollPositionForFixedPosition): (WebCore::FrameView::unscaledMinimumScrollPosition): (WebCore::FrameView::unscaledMaximumScrollPosition): (WebCore::FrameView::scrollPositionChanged): (WebCore::FrameView::availableContentSizeChanged): (WebCore::FrameView::performPostLayoutTasks): (WebCore::FrameView::scrollTo): (WebCore::FrameView::useCustomFixedPositionLayoutRect): * page/FrameView.h: * page/Settings.in: * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): * platform/graphics/TiledBacking.h: * platform/graphics/ca/TileController.cpp: (WebCore::TileController::setLayoutViewportRect): * platform/graphics/ca/TileController.h: * platform/graphics/ca/TileCoverageMap.cpp: (WebCore::TileCoverageMap::TileCoverageMap): (WebCore::TileCoverageMap::update): * platform/graphics/ca/TileCoverageMap.h: * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::constrainingRectForStickyPosition): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateCompositedBounds): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::requiresCompositingForPosition): (WebCore::RenderLayerCompositor::computeFixedViewportConstraints): * rendering/RenderTreeAsText.cpp: (WebCore::externalRepresentation): Logging here is useful when debugging tests. * testing/Internals.cpp: (WebCore::Internals::layoutViewportRect): Expose these rects so tests can dump them. (WebCore::Internals::visualViewportRect): * testing/Internals.h: * testing/Internals.idl: Source/WebKit2: Don't make visualViewportEnabled an experimental feature, because I don't want it enabled by default in WebKitTestRunner (and therefore mismatching DumpRenderTree). * Shared/WebPreferencesDefinitions.h: Tools: Don't give tests in the "visual-viewport" directory a flexible viewport. * DumpRenderTree/mac/DumpRenderTree.mm: (shouldMakeViewportFlexible): * WebKitTestRunner/TestOptions.cpp: (WTR::shouldMakeViewportFlexible): LayoutTests: * fast/visual-viewport/nonzoomed-rects-expected.txt: Added. * fast/visual-viewport/nonzoomed-rects.html: Added. * fast/visual-viewport/zoomed-fixed-expected.txt: Added. * fast/visual-viewport/zoomed-fixed-scroll-down-then-up-expected.txt: Added. * fast/visual-viewport/zoomed-fixed-scroll-down-then-up.html: Added. * fast/visual-viewport/zoomed-fixed.html: Added. * fast/visual-viewport/zoomed-rects-expected.txt: Added. * fast/visual-viewport/zoomed-rects.html: Added. * platform/ios-simulator/fast/visual-viewport/nonzoomed-rects-expected.txt: Added. * platform/ios-simulator/fast/visual-viewport/zoomed-fixed-scroll-down-then-up-expected.txt: Added. * platform/ios-simulator/fast/visual-viewport/zoomed-rects-expected.txt: Added. * resources/js-test-pre.js: (evalAndLog): (evalAndLogResult): (shouldEvaluateTo): Canonical link: https://commits.webkit.org/181988@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208213 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-01 05:32:35 +00:00
function evalAndLogResult(_a)
{
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
if (typeof _a != "string")
debug("WARN: evalAndLogResult() expects a string argument");
Add basic visual/layout viewport support for fixed position layout https://bugs.webkit.org/show_bug.cgi?id=164261 Reviewed by Dean Jackson. Source/WebCore: This patch adds a new behavior for position:fixed objects on zooming. Instead of interpolating between two implicit viewports as we do now, have explicit and distinct layout and visual viewports. The layout viewport is always the size of the initial containing block (i.e. the RenderView). Position:fixed and sticky elements are laid out relative to the layout viewport. The visual viewport is the visible part of the view, in content coordinates. When the user pans and zooms, the visual viewport changes. If it hits the edge of the layout viepwort, it pushes the layout viewport in that direction; it's as if the user is dragging the layout viewport around. The layout viewport is maintained on FrameView, and has to be recomputed when the scroll position changes, when the view size changes, and when the content size (which affets min/max scroll position) changes. Layout viewport size and position are computed in unzoomed coordinates, requiring some new functions on FrameView to return these. Updated the TileCoverageMap to show the layout viewport visually. Subsequent patches will plumb the layout and visual viewports through the scrolling tree. Tests: fast/visual-viewport/nonzoomed-rects.html fast/visual-viewport/zoomed-fixed-scroll-down-then-up.html fast/visual-viewport/zoomed-fixed.html fast/visual-viewport/zoomed-rects.html * page/FrameView.cpp: (WebCore::FrameView::fixedScrollableAreaBoundsInflatedForScrolling): (WebCore::FrameView::scrollPositionRespectingCustomFixedPosition): (WebCore::FrameView::computeLayoutViewportOrigin): (WebCore::FrameView::setLayoutViewportOrigin): (WebCore::FrameView::updateLayoutViewport): (WebCore::FrameView::minStableLayoutViewportOrigin): (WebCore::FrameView::maxStableLayoutViewportOrigin): (WebCore::FrameView::layoutViewportRect): (WebCore::FrameView::visualViewportRect): (WebCore::FrameView::viewportConstrainedVisibleContentRect): (WebCore::FrameView::rectForFixedPositionLayout): (WebCore::FrameView::scrollPositionForFixedPosition): (WebCore::FrameView::unscaledMinimumScrollPosition): (WebCore::FrameView::unscaledMaximumScrollPosition): (WebCore::FrameView::scrollPositionChanged): (WebCore::FrameView::availableContentSizeChanged): (WebCore::FrameView::performPostLayoutTasks): (WebCore::FrameView::scrollTo): (WebCore::FrameView::useCustomFixedPositionLayoutRect): * page/FrameView.h: * page/Settings.in: * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): * platform/graphics/TiledBacking.h: * platform/graphics/ca/TileController.cpp: (WebCore::TileController::setLayoutViewportRect): * platform/graphics/ca/TileController.h: * platform/graphics/ca/TileCoverageMap.cpp: (WebCore::TileCoverageMap::TileCoverageMap): (WebCore::TileCoverageMap::update): * platform/graphics/ca/TileCoverageMap.h: * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::constrainingRectForStickyPosition): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateCompositedBounds): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::requiresCompositingForPosition): (WebCore::RenderLayerCompositor::computeFixedViewportConstraints): * rendering/RenderTreeAsText.cpp: (WebCore::externalRepresentation): Logging here is useful when debugging tests. * testing/Internals.cpp: (WebCore::Internals::layoutViewportRect): Expose these rects so tests can dump them. (WebCore::Internals::visualViewportRect): * testing/Internals.h: * testing/Internals.idl: Source/WebKit2: Don't make visualViewportEnabled an experimental feature, because I don't want it enabled by default in WebKitTestRunner (and therefore mismatching DumpRenderTree). * Shared/WebPreferencesDefinitions.h: Tools: Don't give tests in the "visual-viewport" directory a flexible viewport. * DumpRenderTree/mac/DumpRenderTree.mm: (shouldMakeViewportFlexible): * WebKitTestRunner/TestOptions.cpp: (WTR::shouldMakeViewportFlexible): LayoutTests: * fast/visual-viewport/nonzoomed-rects-expected.txt: Added. * fast/visual-viewport/nonzoomed-rects.html: Added. * fast/visual-viewport/zoomed-fixed-expected.txt: Added. * fast/visual-viewport/zoomed-fixed-scroll-down-then-up-expected.txt: Added. * fast/visual-viewport/zoomed-fixed-scroll-down-then-up.html: Added. * fast/visual-viewport/zoomed-fixed.html: Added. * fast/visual-viewport/zoomed-rects-expected.txt: Added. * fast/visual-viewport/zoomed-rects.html: Added. * platform/ios-simulator/fast/visual-viewport/nonzoomed-rects-expected.txt: Added. * platform/ios-simulator/fast/visual-viewport/zoomed-fixed-scroll-down-then-up-expected.txt: Added. * platform/ios-simulator/fast/visual-viewport/zoomed-rects-expected.txt: Added. * resources/js-test-pre.js: (evalAndLog): (evalAndLogResult): (shouldEvaluateTo): Canonical link: https://commits.webkit.org/181988@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208213 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-01 05:32:35 +00:00
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
var _av;
try {
_av = eval(_a);
} catch (e) {
testFailed(_a + " threw exception " + e);
}
Add basic visual/layout viewport support for fixed position layout https://bugs.webkit.org/show_bug.cgi?id=164261 Reviewed by Dean Jackson. Source/WebCore: This patch adds a new behavior for position:fixed objects on zooming. Instead of interpolating between two implicit viewports as we do now, have explicit and distinct layout and visual viewports. The layout viewport is always the size of the initial containing block (i.e. the RenderView). Position:fixed and sticky elements are laid out relative to the layout viewport. The visual viewport is the visible part of the view, in content coordinates. When the user pans and zooms, the visual viewport changes. If it hits the edge of the layout viepwort, it pushes the layout viewport in that direction; it's as if the user is dragging the layout viewport around. The layout viewport is maintained on FrameView, and has to be recomputed when the scroll position changes, when the view size changes, and when the content size (which affets min/max scroll position) changes. Layout viewport size and position are computed in unzoomed coordinates, requiring some new functions on FrameView to return these. Updated the TileCoverageMap to show the layout viewport visually. Subsequent patches will plumb the layout and visual viewports through the scrolling tree. Tests: fast/visual-viewport/nonzoomed-rects.html fast/visual-viewport/zoomed-fixed-scroll-down-then-up.html fast/visual-viewport/zoomed-fixed.html fast/visual-viewport/zoomed-rects.html * page/FrameView.cpp: (WebCore::FrameView::fixedScrollableAreaBoundsInflatedForScrolling): (WebCore::FrameView::scrollPositionRespectingCustomFixedPosition): (WebCore::FrameView::computeLayoutViewportOrigin): (WebCore::FrameView::setLayoutViewportOrigin): (WebCore::FrameView::updateLayoutViewport): (WebCore::FrameView::minStableLayoutViewportOrigin): (WebCore::FrameView::maxStableLayoutViewportOrigin): (WebCore::FrameView::layoutViewportRect): (WebCore::FrameView::visualViewportRect): (WebCore::FrameView::viewportConstrainedVisibleContentRect): (WebCore::FrameView::rectForFixedPositionLayout): (WebCore::FrameView::scrollPositionForFixedPosition): (WebCore::FrameView::unscaledMinimumScrollPosition): (WebCore::FrameView::unscaledMaximumScrollPosition): (WebCore::FrameView::scrollPositionChanged): (WebCore::FrameView::availableContentSizeChanged): (WebCore::FrameView::performPostLayoutTasks): (WebCore::FrameView::scrollTo): (WebCore::FrameView::useCustomFixedPositionLayoutRect): * page/FrameView.h: * page/Settings.in: * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): * platform/graphics/TiledBacking.h: * platform/graphics/ca/TileController.cpp: (WebCore::TileController::setLayoutViewportRect): * platform/graphics/ca/TileController.h: * platform/graphics/ca/TileCoverageMap.cpp: (WebCore::TileCoverageMap::TileCoverageMap): (WebCore::TileCoverageMap::update): * platform/graphics/ca/TileCoverageMap.h: * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::constrainingRectForStickyPosition): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateCompositedBounds): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::requiresCompositingForPosition): (WebCore::RenderLayerCompositor::computeFixedViewportConstraints): * rendering/RenderTreeAsText.cpp: (WebCore::externalRepresentation): Logging here is useful when debugging tests. * testing/Internals.cpp: (WebCore::Internals::layoutViewportRect): Expose these rects so tests can dump them. (WebCore::Internals::visualViewportRect): * testing/Internals.h: * testing/Internals.idl: Source/WebKit2: Don't make visualViewportEnabled an experimental feature, because I don't want it enabled by default in WebKitTestRunner (and therefore mismatching DumpRenderTree). * Shared/WebPreferencesDefinitions.h: Tools: Don't give tests in the "visual-viewport" directory a flexible viewport. * DumpRenderTree/mac/DumpRenderTree.mm: (shouldMakeViewportFlexible): * WebKitTestRunner/TestOptions.cpp: (WTR::shouldMakeViewportFlexible): LayoutTests: * fast/visual-viewport/nonzoomed-rects-expected.txt: Added. * fast/visual-viewport/nonzoomed-rects.html: Added. * fast/visual-viewport/zoomed-fixed-expected.txt: Added. * fast/visual-viewport/zoomed-fixed-scroll-down-then-up-expected.txt: Added. * fast/visual-viewport/zoomed-fixed-scroll-down-then-up.html: Added. * fast/visual-viewport/zoomed-fixed.html: Added. * fast/visual-viewport/zoomed-rects-expected.txt: Added. * fast/visual-viewport/zoomed-rects.html: Added. * platform/ios-simulator/fast/visual-viewport/nonzoomed-rects-expected.txt: Added. * platform/ios-simulator/fast/visual-viewport/zoomed-fixed-scroll-down-then-up-expected.txt: Added. * platform/ios-simulator/fast/visual-viewport/zoomed-rects-expected.txt: Added. * resources/js-test-pre.js: (evalAndLog): (evalAndLogResult): (shouldEvaluateTo): Canonical link: https://commits.webkit.org/181988@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208213 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-01 05:32:35 +00:00
Clean up SourceProvider and add caller relative load script to jsc.cpp https://bugs.webkit.org/show_bug.cgi?id=214205 Reviewed by Yusuke Suzuki. JSTests: There are two main changes here. The first is converting most invocations of load to also pass "caller relative" as the second parameter. This lets those tests be run from any working directory rather than only the same directory as the test script. The second change is to prohibit "bare-name" specifiers in our CLI's module loader. This matches pretty much all other module loaders, including WebCore and our Obj-C API. * modules/aliased-names.js: * modules/aliasing/drink.js: * modules/caching-should-not-make-ambiguous.js: * modules/default-error/main.js: * modules/execution-order-cyclic/5.js: * modules/execution-order-dag/5.js: * modules/execution-order-tree/5.js: * modules/indirect-export-error/indirect-export-default-2.js: * modules/namespace-ambiguous/ambiguous-2.js: * modules/namespace-ambiguous/ambiguous.js: * modules/namespace-re-export.js: * modules/uncacheable-when-see-star.js: * stress/global-const-redeclaration-setting-2.js: * stress/global-const-redeclaration-setting-3.js: * stress/global-const-redeclaration-setting-4.js: * stress/global-const-redeclaration-setting-5.js: * stress/global-const-redeclaration-setting.js: * stress/global-lexical-redeclare-variable.js: * stress/global-lexical-redefine-const.js: * stress/global-lexical-variable-tdz.js: * stress/global-lexical-variable-unresolved-property.js: * stress/global-property-into-variable-get-from-scope.js: * stress/import-with-empty-string.js: * stress/jsonp-literal-parser-semicolon-is-not-assignment.js: * stress/op_add.js: * stress/op_bitand.js: * stress/op_bitor.js: * stress/op_bitxor.js: * stress/op_div-ConstVar.js: * stress/op_div-VarConst.js: * stress/op_div-VarVar.js: * stress/op_lshift-ConstVar.js: * stress/op_lshift-VarConst.js: * stress/op_lshift-VarVar.js: * stress/op_mod-ConstVar.js: * stress/op_mod-VarConst.js: * stress/op_mod-VarVar.js: * stress/op_mul-ConstVar.js: * stress/op_mul-VarConst.js: * stress/op_mul-VarVar.js: * stress/op_negate.js: * stress/op_postdec.js: * stress/op_postinc.js: * stress/op_predec.js: * stress/op_preinc.js: * stress/op_rshift-ConstVar.js: * stress/op_rshift-VarConst.js: * stress/op_rshift-VarVar.js: * stress/op_sub-ConstVar.js: * stress/op_sub-VarConst.js: * stress/op_sub-VarVar.js: * stress/op_urshift-ConstVar.js: * stress/op_urshift-VarConst.js: * stress/op_urshift-VarVar.js: * stress/regress-159779-1.js: (makeUseRegressionTest): * stress/regress-159779-2.js: (makeUseRegressionTest): * stress/resources/typedarray-constructor-helper-functions.js: * stress/resources/typedarray-test-helper-functions.js: * stress/sampling-profiler-anonymous-function.js: * stress/sampling-profiler-basic.js: * stress/sampling-profiler-bound-function-name.js: * stress/sampling-profiler-deep-stack.js: * stress/sampling-profiler-display-name.js: * stress/sampling-profiler-internal-function-name.js: * stress/sampling-profiler-microtasks.js: * stress/sampling-profiler-wasm-name-section.js: * stress/sampling-profiler-wasm.js: * stress/shadow-chicken-disabled.js: * stress/shadow-chicken-enabled.js: * stress/typedarray-constructor.js: * stress/typedarray-copyWithin.js: * stress/typedarray-every.js: * stress/typedarray-fill.js: * stress/typedarray-filter.js: * stress/typedarray-find.js: * stress/typedarray-findIndex.js: * stress/typedarray-forEach.js: * stress/typedarray-from.js: * stress/typedarray-includes.js: * stress/typedarray-indexOf.js: * stress/typedarray-lastIndexOf.js: * stress/typedarray-map.js: * stress/typedarray-of.js: * stress/typedarray-reduce.js: * stress/typedarray-reduceRight.js: * stress/typedarray-set.js: * stress/typedarray-slice.js: * stress/typedarray-some.js: * stress/typedarray-sort.js: * stress/typedarray-subarray.js: * wasm/Builder.js: * wasm/Builder_WebAssemblyBinary.js: * wasm/LowLevelBinary.js: * wasm/README.md: * wasm/WASM.js: * wasm/regress/selectf64.js: * wasm/spec-harness.js: (import.string_appeared_here.then): LayoutTests/imported/w3c: Rebaseline module loader error messages against the new string. * web-platform-tests/html/semantics/scripting-1/the-script-element/module/specifier-error-expected.txt: Source/JavaScriptCore: This patch originally was just to add an optional parameter to our load function so that any relative path is computed with respect to calling script. Rather than computing the path relative to the current working directory. The main advantage of this is now you can run all the JSTests/stress scripts from anywhere rather than only from the stress directory. This also matches jsc.cpp's module loader implementation. To make this possible a surprising number of changes were needed. Specifically, it was much easier to get this to work if we converted SourceOrigin's url to a WTF::URL rather than just a WTF::String. At the same time it became clear that SourceProvider's m_sourceURL is really not a URL but more of a file name, which can sometimes be a URL. It's possible that we don't need m_sourceURL at all but we should do that in a different patch. Additionally, jsc.cpp now uses WTF::URL for handling file paths. This is cleaner than managing trying to do it ourselves and should work across all the ports. Lastly, the JSC CLI no longer accepts "bare-name" specifiers. i.e. all specifiers must start with "/", "./", or "../". This matches what we do in our Obj-C API and in WebCore. While fixing tests I also noticed that the error message was almost useless since it didn't tell you what the specifier or referrer in question so that information is now part of the user visible error. * API/JSAPIGlobalObject.mm: (JSC::computeValidImportSpecifier): (JSC::JSAPIGlobalObject::moduleLoaderImportModule): * API/JSBase.cpp: (JSEvaluateScript): (JSCheckScriptSyntax): * API/JSObjectRef.cpp: (JSObjectMakeFunction): * API/JSScript.mm: (-[JSScript sourceCode]): * API/JSScriptRef.cpp: * API/glib/JSCContext.cpp: (jsc_context_check_syntax): * builtins/BuiltinExecutables.cpp: (JSC::BuiltinExecutables::BuiltinExecutables): * debugger/DebuggerLocation.cpp: (JSC::DebuggerLocation::DebuggerLocation): * debugger/DebuggerLocation.h: (JSC::DebuggerLocation::DebuggerLocation): * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::sourceParsed): * jsc.cpp: (currentWorkingDirectory): (absolutePath): (GlobalObject::moduleLoaderImportModule): (GlobalObject::moduleLoaderResolve): (jscSource): (fetchModuleFromLocalFileSystem): (GlobalObject::moduleLoaderFetch): (functionLoad): (functionCallerSourceOrigin): (functionDollarAgentStart): (functionCheckModuleSyntax): (runWithOptions): (runInteractive): (ModuleName::startsWithRoot const): Deleted. (ModuleName::ModuleName): Deleted. (extractDirectoryName): Deleted. (resolvePath): Deleted. * parser/Nodes.h: (JSC::ScopeNode::source const): (JSC::ScopeNode::sourceURL const): Deleted. * parser/SourceCode.h: (JSC::makeSource): * parser/SourceCodeKey.h: (JSC::SourceCodeKey::host const): * parser/SourceProvider.cpp: (JSC::SourceProvider::SourceProvider): * parser/SourceProvider.h: (JSC::SourceProvider::sourceURL const): (JSC::StringSourceProvider::create): (JSC::StringSourceProvider::StringSourceProvider): (JSC::SourceProvider::url const): Deleted. * runtime/CachedTypes.cpp: (JSC::CachedSourceOrigin::encode): (JSC::CachedSourceOrigin::decode const): (JSC::CachedSourceProviderShape::encode): (JSC::CachedStringSourceProvider::decode const): (JSC::CachedWebAssemblySourceProvider::decode const): * runtime/Error.cpp: (JSC::addErrorInfo): * runtime/FunctionConstructor.cpp: (JSC::constructFunctionSkippingEvalEnabledCheck): * runtime/ScriptExecutable.h: (JSC::ScriptExecutable::sourceURL const): * runtime/SourceOrigin.h: (JSC::SourceOrigin::SourceOrigin): (JSC::SourceOrigin::url const): (JSC::SourceOrigin::string const): (JSC::SourceOrigin::isNull const): * runtime/ThrowScope.cpp: (JSC::ThrowScope::throwException): * runtime/ThrowScope.h: (JSC::ThrowScope::throwException): (JSC::throwVMException): * tools/FunctionOverrides.cpp: (JSC::initializeOverrideInfo): * tools/JSDollarVM.cpp: (JSC::doPrint): (JSC::functionCrash): Source/WebCore: Refactor WebCore <-> JSC binding layer now that JSC uses WTF::URLs for SourceOrigins. Also, improve module loading error messages to include the specifier and referrer when producing errors around bare-name specifiers. New error message behavior is already tested so existing tests have been updated. * bindings/js/CachedScriptSourceProvider.h: (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider): * bindings/js/JSEventListener.cpp: (WebCore::JSEventListener::handleEvent): * bindings/js/JSEventListener.h: (WebCore::JSEventListener::sourceURL const): * bindings/js/JSLazyEventListener.cpp: (WebCore::JSLazyEventListener::JSLazyEventListener): (WebCore::JSLazyEventListener::initializeJSFunction const): (WebCore::JSLazyEventListener::create): * bindings/js/JSLazyEventListener.h: * bindings/js/ScriptController.cpp: (WebCore::ScriptController::evaluateInWorld): (WebCore::ScriptController::evaluateModule): (WebCore::ScriptController::callInWorld): * bindings/js/ScriptController.h: (WebCore::ScriptController::sourceURL const): * bindings/js/ScriptModuleLoader.cpp: (WebCore::resolveModuleSpecifier): (WebCore::rejectPromise): * bindings/js/ScriptSourceCode.h: (WebCore::ScriptSourceCode::ScriptSourceCode): (WebCore::ScriptSourceCode::url const): Source/WebKitLegacy/mac: Use the source origin's URL for the debugger since it's the true URL for the script. * WebView/WebScriptDebugger.mm: (WebScriptDebugger::sourceParsed): Source/WTF: Using a URL as a boolean in a conditional should be a compile error. Currently, it "works" because it actually calls `operator NSURL*()`... which is likely NOT what you wanted. Until we decide what it means to have a URL in a conditional it will be a compile error. * wtf/URL.cpp: (WTF::URL::fileSystemPath const): * wtf/URL.h: LayoutTests: js-test-pre needs to strip the parts of file urls between file:/// and LayoutTests because that is dependent on the system running the tests. Tests using these harnesses may not be using a server to host the test files. Rebaseline module loader error messages against the new string. * http/tests/resources/js-test-pre.js: (escapeHTMLAndStripFileURLs): (testFailed): (escapeHTML): Deleted. (testPassed): Deleted. * js/dom/modules/import-incorrect-relative-specifier-expected.txt: * js/dom/modules/module-incorrect-relative-specifier-expected.txt: * resources/js-test-pre.js: (escapeHTMLAndStripFileURLs): (testFailed): (escapeHTML): Deleted. (testPassed): Deleted. Canonical link: https://commits.webkit.org/227069@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@264304 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-07-13 17:35:35 +00:00
debug('<span>' + _a + " is " + escapeHTMLAndStripFileURLs(_av) + '</span>');
Add basic visual/layout viewport support for fixed position layout https://bugs.webkit.org/show_bug.cgi?id=164261 Reviewed by Dean Jackson. Source/WebCore: This patch adds a new behavior for position:fixed objects on zooming. Instead of interpolating between two implicit viewports as we do now, have explicit and distinct layout and visual viewports. The layout viewport is always the size of the initial containing block (i.e. the RenderView). Position:fixed and sticky elements are laid out relative to the layout viewport. The visual viewport is the visible part of the view, in content coordinates. When the user pans and zooms, the visual viewport changes. If it hits the edge of the layout viepwort, it pushes the layout viewport in that direction; it's as if the user is dragging the layout viewport around. The layout viewport is maintained on FrameView, and has to be recomputed when the scroll position changes, when the view size changes, and when the content size (which affets min/max scroll position) changes. Layout viewport size and position are computed in unzoomed coordinates, requiring some new functions on FrameView to return these. Updated the TileCoverageMap to show the layout viewport visually. Subsequent patches will plumb the layout and visual viewports through the scrolling tree. Tests: fast/visual-viewport/nonzoomed-rects.html fast/visual-viewport/zoomed-fixed-scroll-down-then-up.html fast/visual-viewport/zoomed-fixed.html fast/visual-viewport/zoomed-rects.html * page/FrameView.cpp: (WebCore::FrameView::fixedScrollableAreaBoundsInflatedForScrolling): (WebCore::FrameView::scrollPositionRespectingCustomFixedPosition): (WebCore::FrameView::computeLayoutViewportOrigin): (WebCore::FrameView::setLayoutViewportOrigin): (WebCore::FrameView::updateLayoutViewport): (WebCore::FrameView::minStableLayoutViewportOrigin): (WebCore::FrameView::maxStableLayoutViewportOrigin): (WebCore::FrameView::layoutViewportRect): (WebCore::FrameView::visualViewportRect): (WebCore::FrameView::viewportConstrainedVisibleContentRect): (WebCore::FrameView::rectForFixedPositionLayout): (WebCore::FrameView::scrollPositionForFixedPosition): (WebCore::FrameView::unscaledMinimumScrollPosition): (WebCore::FrameView::unscaledMaximumScrollPosition): (WebCore::FrameView::scrollPositionChanged): (WebCore::FrameView::availableContentSizeChanged): (WebCore::FrameView::performPostLayoutTasks): (WebCore::FrameView::scrollTo): (WebCore::FrameView::useCustomFixedPositionLayoutRect): * page/FrameView.h: * page/Settings.in: * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): * platform/graphics/TiledBacking.h: * platform/graphics/ca/TileController.cpp: (WebCore::TileController::setLayoutViewportRect): * platform/graphics/ca/TileController.h: * platform/graphics/ca/TileCoverageMap.cpp: (WebCore::TileCoverageMap::TileCoverageMap): (WebCore::TileCoverageMap::update): * platform/graphics/ca/TileCoverageMap.h: * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::constrainingRectForStickyPosition): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateCompositedBounds): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::requiresCompositingForPosition): (WebCore::RenderLayerCompositor::computeFixedViewportConstraints): * rendering/RenderTreeAsText.cpp: (WebCore::externalRepresentation): Logging here is useful when debugging tests. * testing/Internals.cpp: (WebCore::Internals::layoutViewportRect): Expose these rects so tests can dump them. (WebCore::Internals::visualViewportRect): * testing/Internals.h: * testing/Internals.idl: Source/WebKit2: Don't make visualViewportEnabled an experimental feature, because I don't want it enabled by default in WebKitTestRunner (and therefore mismatching DumpRenderTree). * Shared/WebPreferencesDefinitions.h: Tools: Don't give tests in the "visual-viewport" directory a flexible viewport. * DumpRenderTree/mac/DumpRenderTree.mm: (shouldMakeViewportFlexible): * WebKitTestRunner/TestOptions.cpp: (WTR::shouldMakeViewportFlexible): LayoutTests: * fast/visual-viewport/nonzoomed-rects-expected.txt: Added. * fast/visual-viewport/nonzoomed-rects.html: Added. * fast/visual-viewport/zoomed-fixed-expected.txt: Added. * fast/visual-viewport/zoomed-fixed-scroll-down-then-up-expected.txt: Added. * fast/visual-viewport/zoomed-fixed-scroll-down-then-up.html: Added. * fast/visual-viewport/zoomed-fixed.html: Added. * fast/visual-viewport/zoomed-rects-expected.txt: Added. * fast/visual-viewport/zoomed-rects.html: Added. * platform/ios-simulator/fast/visual-viewport/nonzoomed-rects-expected.txt: Added. * platform/ios-simulator/fast/visual-viewport/zoomed-fixed-scroll-down-then-up-expected.txt: Added. * platform/ios-simulator/fast/visual-viewport/zoomed-rects-expected.txt: Added. * resources/js-test-pre.js: (evalAndLog): (evalAndLogResult): (shouldEvaluateTo): Canonical link: https://commits.webkit.org/181988@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208213 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-01 05:32:35 +00:00
}
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
function shouldBe(_a, _b, _quiet)
{
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
if ((typeof _a != "function" && typeof _a != "string") || (typeof _b != "function" && typeof _b != "string"))
debug("WARN: shouldBe() expects function or string arguments");
var _exception;
var _av;
try {
_av = (typeof _a == "function" ? _a() : eval(_a));
} catch (e) {
_exception = e;
}
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
var _bv = (typeof _b == "function" ? _b() : eval(_b));
if (_exception)
testFailed(_a + " should be " + stringify(_bv) + ". Threw exception " + _exception);
else if (isResultCorrect(_av, _bv)) {
if (!_quiet) {
testPassed(_a + " is " + (typeof _b == "function" ? _bv : _b));
}
} else if (typeof(_av) == typeof(_bv))
testFailed(_a + " should be " + stringify(_bv) + ". Was " + stringify(_av) + ".");
else
testFailed(_a + " should be " + stringify(_bv) + " (of type " + typeof _bv + "). Was " + _av + " (of type " + typeof _av + ").");
}
function dfgShouldBe(theFunction, _a, _b)
{
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
if (typeof theFunction != "function" || typeof _a != "string" || typeof _b != "string")
debug("WARN: dfgShouldBe() expects a function and two strings");
noInline(theFunction);
var exception;
var values = [];
// Defend against tests that muck with numeric properties on array.prototype.
values.__proto__ = null;
values.push = Array.prototype.push;
try {
while (!dfgCompiled({f:theFunction}))
values.push(eval(_a));
values.push(eval(_a));
} catch (e) {
exception = e;
}
var _bv = eval(_b);
if (exception)
testFailed(_a + " should be " + stringify(_bv) + ". On iteration " + (values.length + 1) + ", threw exception " + exception);
else {
var allPassed = true;
for (var i = 0; i < values.length; ++i) {
var _av = values[i];
if (isResultCorrect(_av, _bv))
continue;
if (typeof(_av) == typeof(_bv))
testFailed(_a + " should be " + stringify(_bv) + ". On iteration " + (i + 1) + ", was " + stringify(_av) + ".");
else
testFailed(_a + " should be " + stringify(_bv) + " (of type " + typeof _bv + "). On iteration " + (i + 1) + ", was " + _av + " (of type " + typeof _av + ").");
allPassed = false;
}
if (allPassed)
testPassed(_a + " is " + _b + " on all iterations including after DFG tier-up.");
}
return values.length;
}
// Execute condition every 5 milliseconds until it succeeds.
function _waitForCondition(condition, completionHandler)
{
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
if (condition())
completionHandler();
else
setTimeout(_waitForCondition, 5, condition, completionHandler);
}
function shouldBecomeEqual(_a, _b, completionHandler)
{
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
if (typeof _a != "string" || typeof _b != "string")
debug("WARN: shouldBecomeEqual() expects string arguments");
function condition() {
var exception;
var _av;
try {
_av = eval(_a);
} catch (e) {
exception = e;
}
var _bv = eval(_b);
if (exception)
testFailed(_a + " should become " + _bv + ". Threw exception " + exception);
if (isResultCorrect(_av, _bv)) {
testPassed(_a + " became " + _b);
return true;
}
return false;
}
if (!completionHandler)
return new Promise(resolve => setTimeout(_waitForCondition, 0, condition, resolve));
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
setTimeout(_waitForCondition, 0, condition, completionHandler);
}
function shouldBecomeEqualToString(value, reference, completionHandler)
{
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
if (typeof value !== "string" || typeof reference !== "string")
debug("WARN: shouldBecomeEqualToString() expects string arguments");
var unevaledString = JSON.stringify(reference);
shouldBecomeEqual(value, unevaledString, completionHandler);
}
function shouldBeType(_a, _type) {
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
var exception;
var _av;
try {
_av = eval(_a);
} catch (e) {
exception = e;
}
var _typev = eval(_type);
if (_av instanceof _typev) {
testPassed(_a + " is an instance of " + _type);
} else {
testFailed(_a + " is not an instance of " + _type);
}
}
// Variant of shouldBe()--confirms that result of eval(_to_eval) is within
// numeric _tolerance of numeric _target.
function shouldBeCloseTo(_to_eval, _target, _tolerance, quiet)
{
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
if (typeof _to_eval != "string") {
testFailed("shouldBeCloseTo() requires string argument _to_eval. was type " + typeof _to_eval);
return;
}
if (typeof _target != "number") {
testFailed("shouldBeCloseTo() requires numeric argument _target. was type " + typeof _target);
return;
}
if (typeof _tolerance != "number") {
testFailed("shouldBeCloseTo() requires numeric argument _tolerance. was type " + typeof _tolerance);
return;
}
var _result;
try {
_result = eval(_to_eval);
} catch (e) {
testFailed(_to_eval + " should be within " + _tolerance + " of "
+ _target + ". Threw exception " + e);
return;
}
if (typeof(_result) != typeof(_target)) {
testFailed(_to_eval + " should be of type " + typeof _target
+ " but was of type " + typeof _result);
} else if (Math.abs(_result - _target) <= _tolerance) {
if (!quiet) {
testPassed(_to_eval + " is within " + _tolerance + " of " + _target);
}
} else {
testFailed(_to_eval + " should be within " + _tolerance + " of " + _target
+ ". Was " + _result + ".");
}
}
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
function shouldNotBe(_a, _b, _quiet)
{
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
if ((typeof _a != "function" && typeof _a != "string") || (typeof _b != "function" && typeof _b != "string"))
debug("WARN: shouldNotBe() expects function or string arguments");
var _exception;
var _av;
try {
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
_av = (typeof _a == "function" ? _a() : eval(_a));
} catch (e) {
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
_exception = e;
}
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
var _bv = (typeof _b == "function" ? _b() : eval(_b));
if (_exception)
testFailed(_a + " should not be " + _bv + ". Threw exception " + _exception);
else if (!isResultCorrect(_av, _bv)) {
if (!_quiet) {
testPassed(_a + " is not " + (typeof _b == "function" ? _bv : _b));
}
} else
testFailed(_a + " should not be " + _bv + ".");
}
function shouldBecomeDifferent(_a, _b, completionHandler)
{
if (typeof _a != "string" || typeof _b != "string")
debug("WARN: shouldBecomeDifferent() expects string arguments");
function condition() {
var exception;
var _av;
try {
_av = eval(_a);
} catch (e) {
exception = e;
}
var _bv = eval(_b);
if (exception)
testFailed(_a + " should became not equal to " + _bv + ". Threw exception " + exception);
if (!isResultCorrect(_av, _bv)) {
testPassed(_a + " became different from " + _b);
return true;
}
return false;
}
if (!completionHandler)
return new Promise(resolve => setTimeout(_waitForCondition, 0, condition, resolve));
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
setTimeout(_waitForCondition, 0, condition, completionHandler);
}
function shouldBeTrue(_a) { shouldBe(_a, "true"); }
function shouldBeTrueQuiet(_a) { shouldBe(_a, "true", true); }
function shouldBeFalse(_a) { shouldBe(_a, "false"); }
function shouldBeNaN(_a) { shouldBe(_a, "NaN"); }
function shouldBeNull(_a) { shouldBe(_a, "null"); }
function shouldBeZero(_a) { shouldBe(_a, "0"); }
function shouldBeEqualToString(a, b)
{
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
if (typeof a !== "string" || typeof b !== "string")
debug("WARN: shouldBeEqualToString() expects string arguments");
var unevaledString = JSON.stringify(b);
shouldBe(a, unevaledString);
}
CSS Unit vw in border-width maps to 0px. https://bugs.webkit.org/show_bug.cgi?id=109229 Patch by Gurpreet Kaur <k.gurpreet@samsung.com> on 2013-09-12 Reviewed by Darin Adler. Source/WebCore: Border and outline properties were not applied incase its values were given in vh/vw units. Tests: fast/css/viewport-height-border.html fast/css/viewport-height-outline.html fast/css/viewport-width-border.html fast/css/viewport-width-outline.html * css/CSSPrimitiveValue.cpp: (WebCore::CSSPrimitiveValue::computeLengthDouble): Added case CSS_VH and CSS_VW. * css/CSSPrimitiveValue.h: (WebCore::CSSPrimitiveValue::isViewportPercentageWidth): (WebCore::CSSPrimitiveValue::isViewportPercentageHeight): Added APIs to check the unit type(CSS_VW and CSS_VH). * css/DeprecatedStyleBuilder.cpp: (WebCore::ApplyPropertyComputeLength::applyValue): Calculating the border values which has been specified in vh/vw units.The vh/vw units are calcultated as percent of viewport height and viewport width respectively. LayoutTests: * fast/css/viewport-height-border-expected.txt: Added. * fast/css/viewport-height-border.html: Added. * fast/css/viewport-height-outline-expected.txt: Added. * fast/css/viewport-height-outline.html: Added. * fast/css/viewport-width-border-expected.txt: Added. * fast/css/viewport-width-border.html: Added. * fast/css/viewport-width-outline-expected.txt: Added. * fast/css/viewport-width-outline.html: Added. Added new tests for verifying that border and outline properties are applied when its values are given in vh/vw units. * resources/js-test-pre.js: (shouldNotBeEqualToString): Added this API so that can compare two strings.Similiar to shouldBeEqualToString. Canonical link: https://commits.webkit.org/139181@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@155624 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-09-12 16:44:22 +00:00
function shouldNotBeEqualToString(a, b)
{
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
if (typeof a !== "string" || typeof b !== "string")
debug("WARN: shouldBeEqualToString() expects string arguments");
var unevaledString = JSON.stringify(b);
shouldNotBe(a, unevaledString);
CSS Unit vw in border-width maps to 0px. https://bugs.webkit.org/show_bug.cgi?id=109229 Patch by Gurpreet Kaur <k.gurpreet@samsung.com> on 2013-09-12 Reviewed by Darin Adler. Source/WebCore: Border and outline properties were not applied incase its values were given in vh/vw units. Tests: fast/css/viewport-height-border.html fast/css/viewport-height-outline.html fast/css/viewport-width-border.html fast/css/viewport-width-outline.html * css/CSSPrimitiveValue.cpp: (WebCore::CSSPrimitiveValue::computeLengthDouble): Added case CSS_VH and CSS_VW. * css/CSSPrimitiveValue.h: (WebCore::CSSPrimitiveValue::isViewportPercentageWidth): (WebCore::CSSPrimitiveValue::isViewportPercentageHeight): Added APIs to check the unit type(CSS_VW and CSS_VH). * css/DeprecatedStyleBuilder.cpp: (WebCore::ApplyPropertyComputeLength::applyValue): Calculating the border values which has been specified in vh/vw units.The vh/vw units are calcultated as percent of viewport height and viewport width respectively. LayoutTests: * fast/css/viewport-height-border-expected.txt: Added. * fast/css/viewport-height-border.html: Added. * fast/css/viewport-height-outline-expected.txt: Added. * fast/css/viewport-height-outline.html: Added. * fast/css/viewport-width-border-expected.txt: Added. * fast/css/viewport-width-border.html: Added. * fast/css/viewport-width-outline-expected.txt: Added. * fast/css/viewport-width-outline.html: Added. Added new tests for verifying that border and outline properties are applied when its values are given in vh/vw units. * resources/js-test-pre.js: (shouldNotBeEqualToString): Added this API so that can compare two strings.Similiar to shouldBeEqualToString. Canonical link: https://commits.webkit.org/139181@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@155624 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-09-12 16:44:22 +00:00
}
function shouldBeEmptyString(_a) { shouldBeEqualToString(_a, ""); }
Add basic visual/layout viewport support for fixed position layout https://bugs.webkit.org/show_bug.cgi?id=164261 Reviewed by Dean Jackson. Source/WebCore: This patch adds a new behavior for position:fixed objects on zooming. Instead of interpolating between two implicit viewports as we do now, have explicit and distinct layout and visual viewports. The layout viewport is always the size of the initial containing block (i.e. the RenderView). Position:fixed and sticky elements are laid out relative to the layout viewport. The visual viewport is the visible part of the view, in content coordinates. When the user pans and zooms, the visual viewport changes. If it hits the edge of the layout viepwort, it pushes the layout viewport in that direction; it's as if the user is dragging the layout viewport around. The layout viewport is maintained on FrameView, and has to be recomputed when the scroll position changes, when the view size changes, and when the content size (which affets min/max scroll position) changes. Layout viewport size and position are computed in unzoomed coordinates, requiring some new functions on FrameView to return these. Updated the TileCoverageMap to show the layout viewport visually. Subsequent patches will plumb the layout and visual viewports through the scrolling tree. Tests: fast/visual-viewport/nonzoomed-rects.html fast/visual-viewport/zoomed-fixed-scroll-down-then-up.html fast/visual-viewport/zoomed-fixed.html fast/visual-viewport/zoomed-rects.html * page/FrameView.cpp: (WebCore::FrameView::fixedScrollableAreaBoundsInflatedForScrolling): (WebCore::FrameView::scrollPositionRespectingCustomFixedPosition): (WebCore::FrameView::computeLayoutViewportOrigin): (WebCore::FrameView::setLayoutViewportOrigin): (WebCore::FrameView::updateLayoutViewport): (WebCore::FrameView::minStableLayoutViewportOrigin): (WebCore::FrameView::maxStableLayoutViewportOrigin): (WebCore::FrameView::layoutViewportRect): (WebCore::FrameView::visualViewportRect): (WebCore::FrameView::viewportConstrainedVisibleContentRect): (WebCore::FrameView::rectForFixedPositionLayout): (WebCore::FrameView::scrollPositionForFixedPosition): (WebCore::FrameView::unscaledMinimumScrollPosition): (WebCore::FrameView::unscaledMaximumScrollPosition): (WebCore::FrameView::scrollPositionChanged): (WebCore::FrameView::availableContentSizeChanged): (WebCore::FrameView::performPostLayoutTasks): (WebCore::FrameView::scrollTo): (WebCore::FrameView::useCustomFixedPositionLayoutRect): * page/FrameView.h: * page/Settings.in: * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): * platform/graphics/TiledBacking.h: * platform/graphics/ca/TileController.cpp: (WebCore::TileController::setLayoutViewportRect): * platform/graphics/ca/TileController.h: * platform/graphics/ca/TileCoverageMap.cpp: (WebCore::TileCoverageMap::TileCoverageMap): (WebCore::TileCoverageMap::update): * platform/graphics/ca/TileCoverageMap.h: * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::constrainingRectForStickyPosition): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateCompositedBounds): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::requiresCompositingForPosition): (WebCore::RenderLayerCompositor::computeFixedViewportConstraints): * rendering/RenderTreeAsText.cpp: (WebCore::externalRepresentation): Logging here is useful when debugging tests. * testing/Internals.cpp: (WebCore::Internals::layoutViewportRect): Expose these rects so tests can dump them. (WebCore::Internals::visualViewportRect): * testing/Internals.h: * testing/Internals.idl: Source/WebKit2: Don't make visualViewportEnabled an experimental feature, because I don't want it enabled by default in WebKitTestRunner (and therefore mismatching DumpRenderTree). * Shared/WebPreferencesDefinitions.h: Tools: Don't give tests in the "visual-viewport" directory a flexible viewport. * DumpRenderTree/mac/DumpRenderTree.mm: (shouldMakeViewportFlexible): * WebKitTestRunner/TestOptions.cpp: (WTR::shouldMakeViewportFlexible): LayoutTests: * fast/visual-viewport/nonzoomed-rects-expected.txt: Added. * fast/visual-viewport/nonzoomed-rects.html: Added. * fast/visual-viewport/zoomed-fixed-expected.txt: Added. * fast/visual-viewport/zoomed-fixed-scroll-down-then-up-expected.txt: Added. * fast/visual-viewport/zoomed-fixed-scroll-down-then-up.html: Added. * fast/visual-viewport/zoomed-fixed.html: Added. * fast/visual-viewport/zoomed-rects-expected.txt: Added. * fast/visual-viewport/zoomed-rects.html: Added. * platform/ios-simulator/fast/visual-viewport/nonzoomed-rects-expected.txt: Added. * platform/ios-simulator/fast/visual-viewport/zoomed-fixed-scroll-down-then-up-expected.txt: Added. * platform/ios-simulator/fast/visual-viewport/zoomed-rects-expected.txt: Added. * resources/js-test-pre.js: (evalAndLog): (evalAndLogResult): (shouldEvaluateTo): Canonical link: https://commits.webkit.org/181988@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208213 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-01 05:32:35 +00:00
function shouldEvaluateTo(actual, expected)
{
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
// A general-purpose comparator. 'actual' should be a string to be
// evaluated, as for shouldBe(). 'expected' may be any type and will be
// used without being eval'ed.
if (expected == null) {
// Do this before the object test, since null is of type 'object'.
shouldBeNull(actual);
} else if (typeof expected == "undefined") {
shouldBeUndefined(actual);
} else if (typeof expected == "function") {
// All this fuss is to avoid the string-arg warning from shouldBe().
try {
actualValue = eval(actual);
} catch (e) {
testFailed("Evaluating " + actual + ": Threw exception " + e);
return;
}
shouldBe("'" + actualValue.toString().replace(/\n/g, "") + "'",
"'" + expected.toString().replace(/\n/g, "") + "'");
} else if (typeof expected == "object") {
shouldBeTrue(actual + " == '" + expected + "'");
} else if (typeof expected == "string") {
shouldBe(actual, expected);
} else if (typeof expected == "boolean") {
shouldBe("typeof " + actual, "'boolean'");
if (expected)
shouldBeTrue(actual);
else
shouldBeFalse(actual);
} else if (typeof expected == "number") {
shouldBe(actual, stringify(expected));
} else {
debug(expected + " is unknown type " + typeof expected);
shouldBeTrue(actual, "'" +expected.toString() + "'");
}
}
function shouldBeNonZero(_a)
{
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
var exception;
var _av;
try {
_av = eval(_a);
} catch (e) {
exception = e;
}
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
if (exception)
testFailed(_a + " should be non-zero. Threw exception " + exception);
else if (_av != 0)
testPassed(_a + " is non-zero.");
else
testFailed(_a + " should be non-zero. Was " + _av);
}
function shouldBeNonNull(_a)
{
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
var exception;
var _av;
try {
_av = eval(_a);
} catch (e) {
exception = e;
}
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
if (exception)
testFailed(_a + " should be non-null. Threw exception " + exception);
else if (_av != null)
testPassed(_a + " is non-null.");
else
testFailed(_a + " should be non-null. Was " + _av);
}
function shouldBeUndefined(_a)
{
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
var exception;
var _av;
try {
_av = eval(_a);
} catch (e) {
exception = e;
}
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
if (exception)
testFailed(_a + " should be undefined. Threw exception " + exception);
else if (typeof _av == "undefined")
testPassed(_a + " is undefined.");
else
testFailed(_a + " should be undefined. Was " + _av);
}
function shouldBeDefined(_a)
{
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
var exception;
var _av;
try {
_av = eval(_a);
} catch (e) {
exception = e;
}
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
if (exception)
testFailed(_a + " should be defined. Threw exception " + exception);
else if (_av !== undefined)
testPassed(_a + " is defined.");
else
testFailed(_a + " should be defined. Was " + _av);
}
function shouldBeGreaterThanOrEqual(_a, _b) {
if (typeof _a != "string" || typeof _b != "string")
debug("WARN: shouldBeGreaterThanOrEqual expects string arguments");
var exception;
var _av;
try {
_av = eval(_a);
} catch (e) {
exception = e;
}
var _bv = eval(_b);
if (exception)
testFailed(_a + " should be >= " + _b + ". Threw exception " + exception);
else if (typeof _av == "undefined" || _av < _bv)
testFailed(_a + " should be >= " + _b + ". Was " + _av + " (of type " + typeof _av + ").");
else
testPassed(_a + " is >= " + _b);
}
function expectTrue(v, msg) {
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
if (v) {
testPassed(msg);
} else {
testFailed(msg);
}
}
Enhance shouldNotThrow()/shouldThrow() to accept functions and a descriptive message <https://webkit.org/b/159232> Reviewed by Brent Fulgham. Based on a Blink change (patch by <hongchan@chromium.org>): <https://src.chromium.org/viewvc/blink?view=revision&revision=192204> Currently, shouldNotThrow() and shouldThrow() take the following arguments: shouldNotThrow(evalString) shouldThrow(evalString, expectedExceptionString) The challenges with this design are: 1) The 'evalString' must capture every variable that it needs, which means the code can be long, and concatenated into a single line. It would be really nice to be able to use an (anonymous) function to capture variables instead. 2) The 'evalString' is literally printed out in the test results, which isn't always the most descriptive. A descriptive message would make it clearer what failed. 3) When changing a shouldThrow() into a shouldNotThrow() or copying/pasting code, it's possible to forget to remove 'expectedExceptionString' from the function call. This patch changes the methods to take the following arguments: shouldNotThrow(evalString|function [, message]) shouldThrow(evalString|function, expectedExceptionString [, message]) If 'function' is passed in, then it is invoked instead of evaluated, and 'message' replaces the literal code in the pass/fail output. This patch also adds the global 'didFailSomeTests' variable to js-test.js, which already exists in js-test-pre.js. This was added to js-test-pre.js in r153203 by Oliver Hunt to LayoutTests/fast/js/resources/js-test-pre.js. * fast/canvas/webgl/canvas-supports-context-expected.txt: * fast/canvas/webgl/gl-bind-attrib-location-before-compile-test-expected.txt: * fast/css-grid-layout/grid-element-auto-repeat-get-set-expected.txt: * fast/dom/getElementsByClassName/ASCII-case-insensitive-expected.txt: * storage/indexeddb/cursor-basics-expected.txt: * storage/indexeddb/cursor-basics-private-expected.txt: - Update expected results to include "Some tests fail." since some subtests actually do fail during these tests. * fast/css/parsing-css-lang.html: * fast/css/parsing-css-matches-1.html: * fast/css/parsing-css-matches-2.html: * fast/css/parsing-css-matches-3.html: * fast/css/parsing-css-matches-4.html: * fast/css/parsing-css-not-1.html: * fast/css/parsing-css-not-2.html: * fast/css/parsing-css-not-3.html: * fast/css/parsing-css-not-4.html: * fast/css/parsing-css-nth-child-of-1.html: * fast/css/parsing-css-nth-child-of-2.html: * fast/css/parsing-css-nth-last-child-of-1.html: * fast/css/parsing-css-nth-last-child-of-2.html: * js/script-tests/arrowfunction-supercall.js: - Remove expectedExceptionString from shouldNotThrow() calls after they were changed from shouldThrow() calls. * resources/js-test-pre.js: (shouldNotThrow): Change to invoke first argument if it is a function, else use eval() as before. Use second argurment in place of first argument (if set) when printing results. NOTE: Care was taken not to add any lines of code to prevent changes to test results. (shouldThrow): Ditto. Reformat code. * resources/js-test.js: Declare 'didFailSomeTests'. (testFailed): Set 'didFailSomeTests' to true when a test fails. (shouldNotThrow): Same changes as js-test-pre.js. (shouldThrow): Ditto. (isSuccessfullyParsed): Output a message if 'didFailSomeTests' is true. Canonical link: https://commits.webkit.org/177356@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202609 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-06-29 04:17:36 +00:00
function shouldNotThrow(_a, _message) {
try {
Enhance shouldNotThrow()/shouldThrow() to accept functions and a descriptive message <https://webkit.org/b/159232> Reviewed by Brent Fulgham. Based on a Blink change (patch by <hongchan@chromium.org>): <https://src.chromium.org/viewvc/blink?view=revision&revision=192204> Currently, shouldNotThrow() and shouldThrow() take the following arguments: shouldNotThrow(evalString) shouldThrow(evalString, expectedExceptionString) The challenges with this design are: 1) The 'evalString' must capture every variable that it needs, which means the code can be long, and concatenated into a single line. It would be really nice to be able to use an (anonymous) function to capture variables instead. 2) The 'evalString' is literally printed out in the test results, which isn't always the most descriptive. A descriptive message would make it clearer what failed. 3) When changing a shouldThrow() into a shouldNotThrow() or copying/pasting code, it's possible to forget to remove 'expectedExceptionString' from the function call. This patch changes the methods to take the following arguments: shouldNotThrow(evalString|function [, message]) shouldThrow(evalString|function, expectedExceptionString [, message]) If 'function' is passed in, then it is invoked instead of evaluated, and 'message' replaces the literal code in the pass/fail output. This patch also adds the global 'didFailSomeTests' variable to js-test.js, which already exists in js-test-pre.js. This was added to js-test-pre.js in r153203 by Oliver Hunt to LayoutTests/fast/js/resources/js-test-pre.js. * fast/canvas/webgl/canvas-supports-context-expected.txt: * fast/canvas/webgl/gl-bind-attrib-location-before-compile-test-expected.txt: * fast/css-grid-layout/grid-element-auto-repeat-get-set-expected.txt: * fast/dom/getElementsByClassName/ASCII-case-insensitive-expected.txt: * storage/indexeddb/cursor-basics-expected.txt: * storage/indexeddb/cursor-basics-private-expected.txt: - Update expected results to include "Some tests fail." since some subtests actually do fail during these tests. * fast/css/parsing-css-lang.html: * fast/css/parsing-css-matches-1.html: * fast/css/parsing-css-matches-2.html: * fast/css/parsing-css-matches-3.html: * fast/css/parsing-css-matches-4.html: * fast/css/parsing-css-not-1.html: * fast/css/parsing-css-not-2.html: * fast/css/parsing-css-not-3.html: * fast/css/parsing-css-not-4.html: * fast/css/parsing-css-nth-child-of-1.html: * fast/css/parsing-css-nth-child-of-2.html: * fast/css/parsing-css-nth-last-child-of-1.html: * fast/css/parsing-css-nth-last-child-of-2.html: * js/script-tests/arrowfunction-supercall.js: - Remove expectedExceptionString from shouldNotThrow() calls after they were changed from shouldThrow() calls. * resources/js-test-pre.js: (shouldNotThrow): Change to invoke first argument if it is a function, else use eval() as before. Use second argurment in place of first argument (if set) when printing results. NOTE: Care was taken not to add any lines of code to prevent changes to test results. (shouldThrow): Ditto. Reformat code. * resources/js-test.js: Declare 'didFailSomeTests'. (testFailed): Set 'didFailSomeTests' to true when a test fails. (shouldNotThrow): Same changes as js-test-pre.js. (shouldThrow): Ditto. (isSuccessfullyParsed): Output a message if 'didFailSomeTests' is true. Canonical link: https://commits.webkit.org/177356@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202609 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-06-29 04:17:36 +00:00
typeof _a == "function" ? _a() : eval(_a);
testPassed((_message ? _message : _a) + " did not throw exception.");
} catch (e) {
Enhance shouldNotThrow()/shouldThrow() to accept functions and a descriptive message <https://webkit.org/b/159232> Reviewed by Brent Fulgham. Based on a Blink change (patch by <hongchan@chromium.org>): <https://src.chromium.org/viewvc/blink?view=revision&revision=192204> Currently, shouldNotThrow() and shouldThrow() take the following arguments: shouldNotThrow(evalString) shouldThrow(evalString, expectedExceptionString) The challenges with this design are: 1) The 'evalString' must capture every variable that it needs, which means the code can be long, and concatenated into a single line. It would be really nice to be able to use an (anonymous) function to capture variables instead. 2) The 'evalString' is literally printed out in the test results, which isn't always the most descriptive. A descriptive message would make it clearer what failed. 3) When changing a shouldThrow() into a shouldNotThrow() or copying/pasting code, it's possible to forget to remove 'expectedExceptionString' from the function call. This patch changes the methods to take the following arguments: shouldNotThrow(evalString|function [, message]) shouldThrow(evalString|function, expectedExceptionString [, message]) If 'function' is passed in, then it is invoked instead of evaluated, and 'message' replaces the literal code in the pass/fail output. This patch also adds the global 'didFailSomeTests' variable to js-test.js, which already exists in js-test-pre.js. This was added to js-test-pre.js in r153203 by Oliver Hunt to LayoutTests/fast/js/resources/js-test-pre.js. * fast/canvas/webgl/canvas-supports-context-expected.txt: * fast/canvas/webgl/gl-bind-attrib-location-before-compile-test-expected.txt: * fast/css-grid-layout/grid-element-auto-repeat-get-set-expected.txt: * fast/dom/getElementsByClassName/ASCII-case-insensitive-expected.txt: * storage/indexeddb/cursor-basics-expected.txt: * storage/indexeddb/cursor-basics-private-expected.txt: - Update expected results to include "Some tests fail." since some subtests actually do fail during these tests. * fast/css/parsing-css-lang.html: * fast/css/parsing-css-matches-1.html: * fast/css/parsing-css-matches-2.html: * fast/css/parsing-css-matches-3.html: * fast/css/parsing-css-matches-4.html: * fast/css/parsing-css-not-1.html: * fast/css/parsing-css-not-2.html: * fast/css/parsing-css-not-3.html: * fast/css/parsing-css-not-4.html: * fast/css/parsing-css-nth-child-of-1.html: * fast/css/parsing-css-nth-child-of-2.html: * fast/css/parsing-css-nth-last-child-of-1.html: * fast/css/parsing-css-nth-last-child-of-2.html: * js/script-tests/arrowfunction-supercall.js: - Remove expectedExceptionString from shouldNotThrow() calls after they were changed from shouldThrow() calls. * resources/js-test-pre.js: (shouldNotThrow): Change to invoke first argument if it is a function, else use eval() as before. Use second argurment in place of first argument (if set) when printing results. NOTE: Care was taken not to add any lines of code to prevent changes to test results. (shouldThrow): Ditto. Reformat code. * resources/js-test.js: Declare 'didFailSomeTests'. (testFailed): Set 'didFailSomeTests' to true when a test fails. (shouldNotThrow): Same changes as js-test-pre.js. (shouldThrow): Ditto. (isSuccessfullyParsed): Output a message if 'didFailSomeTests' is true. Canonical link: https://commits.webkit.org/177356@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202609 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-06-29 04:17:36 +00:00
testFailed((_message ? _message : _a) + " should not throw exception. Threw exception " + e + ".");
}
}
Enhance shouldNotThrow()/shouldThrow() to accept functions and a descriptive message <https://webkit.org/b/159232> Reviewed by Brent Fulgham. Based on a Blink change (patch by <hongchan@chromium.org>): <https://src.chromium.org/viewvc/blink?view=revision&revision=192204> Currently, shouldNotThrow() and shouldThrow() take the following arguments: shouldNotThrow(evalString) shouldThrow(evalString, expectedExceptionString) The challenges with this design are: 1) The 'evalString' must capture every variable that it needs, which means the code can be long, and concatenated into a single line. It would be really nice to be able to use an (anonymous) function to capture variables instead. 2) The 'evalString' is literally printed out in the test results, which isn't always the most descriptive. A descriptive message would make it clearer what failed. 3) When changing a shouldThrow() into a shouldNotThrow() or copying/pasting code, it's possible to forget to remove 'expectedExceptionString' from the function call. This patch changes the methods to take the following arguments: shouldNotThrow(evalString|function [, message]) shouldThrow(evalString|function, expectedExceptionString [, message]) If 'function' is passed in, then it is invoked instead of evaluated, and 'message' replaces the literal code in the pass/fail output. This patch also adds the global 'didFailSomeTests' variable to js-test.js, which already exists in js-test-pre.js. This was added to js-test-pre.js in r153203 by Oliver Hunt to LayoutTests/fast/js/resources/js-test-pre.js. * fast/canvas/webgl/canvas-supports-context-expected.txt: * fast/canvas/webgl/gl-bind-attrib-location-before-compile-test-expected.txt: * fast/css-grid-layout/grid-element-auto-repeat-get-set-expected.txt: * fast/dom/getElementsByClassName/ASCII-case-insensitive-expected.txt: * storage/indexeddb/cursor-basics-expected.txt: * storage/indexeddb/cursor-basics-private-expected.txt: - Update expected results to include "Some tests fail." since some subtests actually do fail during these tests. * fast/css/parsing-css-lang.html: * fast/css/parsing-css-matches-1.html: * fast/css/parsing-css-matches-2.html: * fast/css/parsing-css-matches-3.html: * fast/css/parsing-css-matches-4.html: * fast/css/parsing-css-not-1.html: * fast/css/parsing-css-not-2.html: * fast/css/parsing-css-not-3.html: * fast/css/parsing-css-not-4.html: * fast/css/parsing-css-nth-child-of-1.html: * fast/css/parsing-css-nth-child-of-2.html: * fast/css/parsing-css-nth-last-child-of-1.html: * fast/css/parsing-css-nth-last-child-of-2.html: * js/script-tests/arrowfunction-supercall.js: - Remove expectedExceptionString from shouldNotThrow() calls after they were changed from shouldThrow() calls. * resources/js-test-pre.js: (shouldNotThrow): Change to invoke first argument if it is a function, else use eval() as before. Use second argurment in place of first argument (if set) when printing results. NOTE: Care was taken not to add any lines of code to prevent changes to test results. (shouldThrow): Ditto. Reformat code. * resources/js-test.js: Declare 'didFailSomeTests'. (testFailed): Set 'didFailSomeTests' to true when a test fails. (shouldNotThrow): Same changes as js-test-pre.js. (shouldThrow): Ditto. (isSuccessfullyParsed): Output a message if 'didFailSomeTests' is true. Canonical link: https://commits.webkit.org/177356@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202609 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-06-29 04:17:36 +00:00
function shouldThrow(_a, _e, _message)
{
Enhance shouldNotThrow()/shouldThrow() to accept functions and a descriptive message <https://webkit.org/b/159232> Reviewed by Brent Fulgham. Based on a Blink change (patch by <hongchan@chromium.org>): <https://src.chromium.org/viewvc/blink?view=revision&revision=192204> Currently, shouldNotThrow() and shouldThrow() take the following arguments: shouldNotThrow(evalString) shouldThrow(evalString, expectedExceptionString) The challenges with this design are: 1) The 'evalString' must capture every variable that it needs, which means the code can be long, and concatenated into a single line. It would be really nice to be able to use an (anonymous) function to capture variables instead. 2) The 'evalString' is literally printed out in the test results, which isn't always the most descriptive. A descriptive message would make it clearer what failed. 3) When changing a shouldThrow() into a shouldNotThrow() or copying/pasting code, it's possible to forget to remove 'expectedExceptionString' from the function call. This patch changes the methods to take the following arguments: shouldNotThrow(evalString|function [, message]) shouldThrow(evalString|function, expectedExceptionString [, message]) If 'function' is passed in, then it is invoked instead of evaluated, and 'message' replaces the literal code in the pass/fail output. This patch also adds the global 'didFailSomeTests' variable to js-test.js, which already exists in js-test-pre.js. This was added to js-test-pre.js in r153203 by Oliver Hunt to LayoutTests/fast/js/resources/js-test-pre.js. * fast/canvas/webgl/canvas-supports-context-expected.txt: * fast/canvas/webgl/gl-bind-attrib-location-before-compile-test-expected.txt: * fast/css-grid-layout/grid-element-auto-repeat-get-set-expected.txt: * fast/dom/getElementsByClassName/ASCII-case-insensitive-expected.txt: * storage/indexeddb/cursor-basics-expected.txt: * storage/indexeddb/cursor-basics-private-expected.txt: - Update expected results to include "Some tests fail." since some subtests actually do fail during these tests. * fast/css/parsing-css-lang.html: * fast/css/parsing-css-matches-1.html: * fast/css/parsing-css-matches-2.html: * fast/css/parsing-css-matches-3.html: * fast/css/parsing-css-matches-4.html: * fast/css/parsing-css-not-1.html: * fast/css/parsing-css-not-2.html: * fast/css/parsing-css-not-3.html: * fast/css/parsing-css-not-4.html: * fast/css/parsing-css-nth-child-of-1.html: * fast/css/parsing-css-nth-child-of-2.html: * fast/css/parsing-css-nth-last-child-of-1.html: * fast/css/parsing-css-nth-last-child-of-2.html: * js/script-tests/arrowfunction-supercall.js: - Remove expectedExceptionString from shouldNotThrow() calls after they were changed from shouldThrow() calls. * resources/js-test-pre.js: (shouldNotThrow): Change to invoke first argument if it is a function, else use eval() as before. Use second argurment in place of first argument (if set) when printing results. NOTE: Care was taken not to add any lines of code to prevent changes to test results. (shouldThrow): Ditto. Reformat code. * resources/js-test.js: Declare 'didFailSomeTests'. (testFailed): Set 'didFailSomeTests' to true when a test fails. (shouldNotThrow): Same changes as js-test-pre.js. (shouldThrow): Ditto. (isSuccessfullyParsed): Output a message if 'didFailSomeTests' is true. Canonical link: https://commits.webkit.org/177356@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202609 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-06-29 04:17:36 +00:00
var _exception;
var _av;
try {
_av = typeof _a == "function" ? _a() : eval(_a);
} catch (e) {
_exception = e;
}
Enhance shouldNotThrow()/shouldThrow() to accept functions and a descriptive message <https://webkit.org/b/159232> Reviewed by Brent Fulgham. Based on a Blink change (patch by <hongchan@chromium.org>): <https://src.chromium.org/viewvc/blink?view=revision&revision=192204> Currently, shouldNotThrow() and shouldThrow() take the following arguments: shouldNotThrow(evalString) shouldThrow(evalString, expectedExceptionString) The challenges with this design are: 1) The 'evalString' must capture every variable that it needs, which means the code can be long, and concatenated into a single line. It would be really nice to be able to use an (anonymous) function to capture variables instead. 2) The 'evalString' is literally printed out in the test results, which isn't always the most descriptive. A descriptive message would make it clearer what failed. 3) When changing a shouldThrow() into a shouldNotThrow() or copying/pasting code, it's possible to forget to remove 'expectedExceptionString' from the function call. This patch changes the methods to take the following arguments: shouldNotThrow(evalString|function [, message]) shouldThrow(evalString|function, expectedExceptionString [, message]) If 'function' is passed in, then it is invoked instead of evaluated, and 'message' replaces the literal code in the pass/fail output. This patch also adds the global 'didFailSomeTests' variable to js-test.js, which already exists in js-test-pre.js. This was added to js-test-pre.js in r153203 by Oliver Hunt to LayoutTests/fast/js/resources/js-test-pre.js. * fast/canvas/webgl/canvas-supports-context-expected.txt: * fast/canvas/webgl/gl-bind-attrib-location-before-compile-test-expected.txt: * fast/css-grid-layout/grid-element-auto-repeat-get-set-expected.txt: * fast/dom/getElementsByClassName/ASCII-case-insensitive-expected.txt: * storage/indexeddb/cursor-basics-expected.txt: * storage/indexeddb/cursor-basics-private-expected.txt: - Update expected results to include "Some tests fail." since some subtests actually do fail during these tests. * fast/css/parsing-css-lang.html: * fast/css/parsing-css-matches-1.html: * fast/css/parsing-css-matches-2.html: * fast/css/parsing-css-matches-3.html: * fast/css/parsing-css-matches-4.html: * fast/css/parsing-css-not-1.html: * fast/css/parsing-css-not-2.html: * fast/css/parsing-css-not-3.html: * fast/css/parsing-css-not-4.html: * fast/css/parsing-css-nth-child-of-1.html: * fast/css/parsing-css-nth-child-of-2.html: * fast/css/parsing-css-nth-last-child-of-1.html: * fast/css/parsing-css-nth-last-child-of-2.html: * js/script-tests/arrowfunction-supercall.js: - Remove expectedExceptionString from shouldNotThrow() calls after they were changed from shouldThrow() calls. * resources/js-test-pre.js: (shouldNotThrow): Change to invoke first argument if it is a function, else use eval() as before. Use second argurment in place of first argument (if set) when printing results. NOTE: Care was taken not to add any lines of code to prevent changes to test results. (shouldThrow): Ditto. Reformat code. * resources/js-test.js: Declare 'didFailSomeTests'. (testFailed): Set 'didFailSomeTests' to true when a test fails. (shouldNotThrow): Same changes as js-test-pre.js. (shouldThrow): Ditto. (isSuccessfullyParsed): Output a message if 'didFailSomeTests' is true. Canonical link: https://commits.webkit.org/177356@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202609 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-06-29 04:17:36 +00:00
var _ev;
if (_e)
_ev = eval(_e);
Enhance shouldNotThrow()/shouldThrow() to accept functions and a descriptive message <https://webkit.org/b/159232> Reviewed by Brent Fulgham. Based on a Blink change (patch by <hongchan@chromium.org>): <https://src.chromium.org/viewvc/blink?view=revision&revision=192204> Currently, shouldNotThrow() and shouldThrow() take the following arguments: shouldNotThrow(evalString) shouldThrow(evalString, expectedExceptionString) The challenges with this design are: 1) The 'evalString' must capture every variable that it needs, which means the code can be long, and concatenated into a single line. It would be really nice to be able to use an (anonymous) function to capture variables instead. 2) The 'evalString' is literally printed out in the test results, which isn't always the most descriptive. A descriptive message would make it clearer what failed. 3) When changing a shouldThrow() into a shouldNotThrow() or copying/pasting code, it's possible to forget to remove 'expectedExceptionString' from the function call. This patch changes the methods to take the following arguments: shouldNotThrow(evalString|function [, message]) shouldThrow(evalString|function, expectedExceptionString [, message]) If 'function' is passed in, then it is invoked instead of evaluated, and 'message' replaces the literal code in the pass/fail output. This patch also adds the global 'didFailSomeTests' variable to js-test.js, which already exists in js-test-pre.js. This was added to js-test-pre.js in r153203 by Oliver Hunt to LayoutTests/fast/js/resources/js-test-pre.js. * fast/canvas/webgl/canvas-supports-context-expected.txt: * fast/canvas/webgl/gl-bind-attrib-location-before-compile-test-expected.txt: * fast/css-grid-layout/grid-element-auto-repeat-get-set-expected.txt: * fast/dom/getElementsByClassName/ASCII-case-insensitive-expected.txt: * storage/indexeddb/cursor-basics-expected.txt: * storage/indexeddb/cursor-basics-private-expected.txt: - Update expected results to include "Some tests fail." since some subtests actually do fail during these tests. * fast/css/parsing-css-lang.html: * fast/css/parsing-css-matches-1.html: * fast/css/parsing-css-matches-2.html: * fast/css/parsing-css-matches-3.html: * fast/css/parsing-css-matches-4.html: * fast/css/parsing-css-not-1.html: * fast/css/parsing-css-not-2.html: * fast/css/parsing-css-not-3.html: * fast/css/parsing-css-not-4.html: * fast/css/parsing-css-nth-child-of-1.html: * fast/css/parsing-css-nth-child-of-2.html: * fast/css/parsing-css-nth-last-child-of-1.html: * fast/css/parsing-css-nth-last-child-of-2.html: * js/script-tests/arrowfunction-supercall.js: - Remove expectedExceptionString from shouldNotThrow() calls after they were changed from shouldThrow() calls. * resources/js-test-pre.js: (shouldNotThrow): Change to invoke first argument if it is a function, else use eval() as before. Use second argurment in place of first argument (if set) when printing results. NOTE: Care was taken not to add any lines of code to prevent changes to test results. (shouldThrow): Ditto. Reformat code. * resources/js-test.js: Declare 'didFailSomeTests'. (testFailed): Set 'didFailSomeTests' to true when a test fails. (shouldNotThrow): Same changes as js-test-pre.js. (shouldThrow): Ditto. (isSuccessfullyParsed): Output a message if 'didFailSomeTests' is true. Canonical link: https://commits.webkit.org/177356@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202609 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-06-29 04:17:36 +00:00
if (_exception) {
if (typeof _e == "undefined" || _exception == _ev)
testPassed((_message ? _message : _a) + " threw exception " + _exception + ".");
else
testFailed((_message ? _message : _a) + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Threw exception " + _exception + ".");
} else if (typeof _av == "undefined")
testFailed((_message ? _message : _a) + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was undefined.");
else
Enhance shouldNotThrow()/shouldThrow() to accept functions and a descriptive message <https://webkit.org/b/159232> Reviewed by Brent Fulgham. Based on a Blink change (patch by <hongchan@chromium.org>): <https://src.chromium.org/viewvc/blink?view=revision&revision=192204> Currently, shouldNotThrow() and shouldThrow() take the following arguments: shouldNotThrow(evalString) shouldThrow(evalString, expectedExceptionString) The challenges with this design are: 1) The 'evalString' must capture every variable that it needs, which means the code can be long, and concatenated into a single line. It would be really nice to be able to use an (anonymous) function to capture variables instead. 2) The 'evalString' is literally printed out in the test results, which isn't always the most descriptive. A descriptive message would make it clearer what failed. 3) When changing a shouldThrow() into a shouldNotThrow() or copying/pasting code, it's possible to forget to remove 'expectedExceptionString' from the function call. This patch changes the methods to take the following arguments: shouldNotThrow(evalString|function [, message]) shouldThrow(evalString|function, expectedExceptionString [, message]) If 'function' is passed in, then it is invoked instead of evaluated, and 'message' replaces the literal code in the pass/fail output. This patch also adds the global 'didFailSomeTests' variable to js-test.js, which already exists in js-test-pre.js. This was added to js-test-pre.js in r153203 by Oliver Hunt to LayoutTests/fast/js/resources/js-test-pre.js. * fast/canvas/webgl/canvas-supports-context-expected.txt: * fast/canvas/webgl/gl-bind-attrib-location-before-compile-test-expected.txt: * fast/css-grid-layout/grid-element-auto-repeat-get-set-expected.txt: * fast/dom/getElementsByClassName/ASCII-case-insensitive-expected.txt: * storage/indexeddb/cursor-basics-expected.txt: * storage/indexeddb/cursor-basics-private-expected.txt: - Update expected results to include "Some tests fail." since some subtests actually do fail during these tests. * fast/css/parsing-css-lang.html: * fast/css/parsing-css-matches-1.html: * fast/css/parsing-css-matches-2.html: * fast/css/parsing-css-matches-3.html: * fast/css/parsing-css-matches-4.html: * fast/css/parsing-css-not-1.html: * fast/css/parsing-css-not-2.html: * fast/css/parsing-css-not-3.html: * fast/css/parsing-css-not-4.html: * fast/css/parsing-css-nth-child-of-1.html: * fast/css/parsing-css-nth-child-of-2.html: * fast/css/parsing-css-nth-last-child-of-1.html: * fast/css/parsing-css-nth-last-child-of-2.html: * js/script-tests/arrowfunction-supercall.js: - Remove expectedExceptionString from shouldNotThrow() calls after they were changed from shouldThrow() calls. * resources/js-test-pre.js: (shouldNotThrow): Change to invoke first argument if it is a function, else use eval() as before. Use second argurment in place of first argument (if set) when printing results. NOTE: Care was taken not to add any lines of code to prevent changes to test results. (shouldThrow): Ditto. Reformat code. * resources/js-test.js: Declare 'didFailSomeTests'. (testFailed): Set 'didFailSomeTests' to true when a test fails. (shouldNotThrow): Same changes as js-test-pre.js. (shouldThrow): Ditto. (isSuccessfullyParsed): Output a message if 'didFailSomeTests' is true. Canonical link: https://commits.webkit.org/177356@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202609 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-06-29 04:17:36 +00:00
testFailed((_message ? _message : _a) + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was " + _av + ".");
}
function shouldReject(_a, _message)
Update SubtleCrypto::generateKey to match the latest spec https://bugs.webkit.org/show_bug.cgi?id=163718 <rdar://problem/28864380> Reviewed by Chris Dumez. LayoutTests/imported/w3c: * WebCryptoAPI/generateKey/test_aes-cbc-expected.txt: * WebCryptoAPI/generateKey/test_aes-cbc.html: * WebCryptoAPI/generateKey/test_aes-ctr-expected.txt: * WebCryptoAPI/generateKey/test_aes-ctr.html: * WebCryptoAPI/generateKey/test_failures-expected.txt: * WebCryptoAPI/generateKey/test_failures.html: * WebCryptoAPI/generateKey/test_failures_AES-CBC-expected.txt: * WebCryptoAPI/generateKey/test_failures_AES-CBC.html: * WebCryptoAPI/generateKey/test_failures_AES-CTR-expected.txt: * WebCryptoAPI/generateKey/test_failures_AES-CTR.html: * WebCryptoAPI/generateKey/test_failures_AES-GCM-expected.txt: * WebCryptoAPI/generateKey/test_failures_AES-GCM.html: * WebCryptoAPI/generateKey/test_failures_AES-KW-expected.txt: * WebCryptoAPI/generateKey/test_failures_AES-KW.html: * WebCryptoAPI/generateKey/test_failures_ECDH-expected.txt: * WebCryptoAPI/generateKey/test_failures_ECDH.html: * WebCryptoAPI/generateKey/test_failures_ECDSA-expected.txt: * WebCryptoAPI/generateKey/test_failures_ECDSA.html: * WebCryptoAPI/generateKey/test_failures_HMAC-expected.txt: * WebCryptoAPI/generateKey/test_failures_HMAC.html: * WebCryptoAPI/generateKey/test_failures_RSA-OAEP-expected.txt: * WebCryptoAPI/generateKey/test_failures_RSA-OAEP.html: * WebCryptoAPI/generateKey/test_failures_RSA-PSS-expected.txt: * WebCryptoAPI/generateKey/test_failures_RSA-PSS.html: * WebCryptoAPI/generateKey/test_failures_RSASSA-PKCS1-v1_5-expected.txt: * WebCryptoAPI/generateKey/test_failures_RSASSA-PKCS1-v1_5.html: * WebCryptoAPI/generateKey/test_successes-expected.txt: * WebCryptoAPI/generateKey/test_successes.html: * WebCryptoAPI/generateKey/test_successes_AES-CBC-expected.txt: * WebCryptoAPI/generateKey/test_successes_AES-CBC.html: * WebCryptoAPI/generateKey/test_successes_AES-CTR-expected.txt: * WebCryptoAPI/generateKey/test_successes_AES-CTR.html: * WebCryptoAPI/generateKey/test_successes_AES-GCM-expected.txt: * WebCryptoAPI/generateKey/test_successes_AES-GCM.html: * WebCryptoAPI/generateKey/test_successes_AES-KW-expected.txt: * WebCryptoAPI/generateKey/test_successes_AES-KW.html: * WebCryptoAPI/generateKey/test_successes_ECDH-expected.txt: * WebCryptoAPI/generateKey/test_successes_ECDH.html: * WebCryptoAPI/generateKey/test_successes_ECDSA-expected.txt: * WebCryptoAPI/generateKey/test_successes_ECDSA.html: * WebCryptoAPI/generateKey/test_successes_HMAC-expected.txt: * WebCryptoAPI/generateKey/test_successes_HMAC.html: * WebCryptoAPI/generateKey/test_successes_RSA-OAEP-expected.txt: * WebCryptoAPI/generateKey/test_successes_RSA-OAEP.html: * WebCryptoAPI/generateKey/test_successes_RSA-PSS-expected.txt: * WebCryptoAPI/generateKey/test_successes_RSA-PSS.html: * WebCryptoAPI/generateKey/test_successes_RSASSA-PKCS1-v1_5-expected.txt: * WebCryptoAPI/generateKey/test_successes_RSASSA-PKCS1-v1_5.html: * WebCryptoAPI/idlharness-expected.txt: Source/WebCore: This patch does following few things: 1. It updates the SubtleCrypto::generateKey method to match the latest spec: https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-generateKey. It also refers to the latest Editor's Draft at a certain degree: https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-generateKey. 2. It implements generateKey operations of following algorithms: AES-CBC, AES-KW, HMAC, RSAES-PKCS1-V1_5, RSASSA-PKCS1-V1_5, and RSA-OAEP. 3. It replaces SPECIALIZE_TYPE_TRAITS_CRYPTO_ALGORITHM_PARAMETERS with SPECIALIZE_TYPE_TRAITS_CRYPTO_ALGORITHM_PARAMETERS_DEPRECATED for deprecated params. 4. It fixes https://bugs.webkit.org/show_bug.cgi?id=129750 as well. Tests: crypto/subtle/aes-cbc-generate-key-length-128.html crypto/subtle/aes-cbc-generate-key-length-192.html crypto/subtle/aes-cbc-generate-key-length-256.html crypto/subtle/aes-generate-key-malformed-parameters.html crypto/subtle/aes-kw-generate-key.html crypto/subtle/generate-key-malformed-paramters.html crypto/subtle/hmac-generate-key-customized-length.html crypto/subtle/hmac-generate-key-hash-object.html crypto/subtle/hmac-generate-key-malformed-parameters.html crypto/subtle/hmac-generate-key-sha1.html crypto/subtle/hmac-generate-key-sha224.html crypto/subtle/hmac-generate-key-sha256.html crypto/subtle/hmac-generate-key-sha384.html crypto/subtle/hmac-generate-key-sha512.html crypto/subtle/rsa-generate-key-malformed-parameters.html crypto/subtle/rsa-oaep-generate-key.html crypto/subtle/rsaes-pkcs1-v1_5-generate-key-extractable.html crypto/subtle/rsaes-pkcs1-v1_5-generate-key.html crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html crypto/webkitSubtle/hmac-generate-key.html: crypto/workers/subtle/aes-generate-key.html crypto/workers/subtle/hmac-generate-key.html crypto/workers/subtle/rsa-generate-key.html * CMakeLists.txt: * DerivedSources.make: * Modules/encryptedmedia/CDMSessionClearKey.cpp: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSSubtleCryptoCustom.cpp: Added. (WebCore::toHashIdentifier): (WebCore::normalizeCryptoAlgorithmParameters): (WebCore::cryptoKeyUsagesFromJSValue): (WebCore::createAlgorithm): (WebCore::rejectWithException): (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise): (WebCore::JSSubtleCrypto::generateKey): * bindings/js/JSWebKitSubtleCryptoCustom.cpp: (WebCore::JSWebKitSubtleCrypto::generateKey): * crypto/CryptoAlgorithm.cpp: (WebCore::CryptoAlgorithm::generateKey): * crypto/CryptoAlgorithm.h: * crypto/CryptoAlgorithmParameters.h: Added. (WebCore::CryptoAlgorithmParameters::CryptoAlgorithmParameters): (WebCore::CryptoAlgorithmParameters::~CryptoAlgorithmParameters): (WebCore::CryptoAlgorithmParameters::parametersClass): * crypto/CryptoAlgorithmParameters.idl: Added. * crypto/CryptoAlgorithmParametersDeprecated.h: * crypto/CryptoKey.cpp: (WebCore::CryptoKey::setUsagesBitmap): * crypto/CryptoKey.h: * crypto/CryptoKeyPair.idl: * crypto/SubtleCrypto.idl: * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::generateKey): * crypto/algorithms/CryptoAlgorithmAES_CBC.h: * crypto/algorithms/CryptoAlgorithmAES_KW.cpp: (WebCore::CryptoAlgorithmAES_KW::generateKey): * crypto/algorithms/CryptoAlgorithmAES_KW.h: * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::generateKey): * crypto/algorithms/CryptoAlgorithmHMAC.h: * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::generateKey): * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey): * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::generateKey): * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h: * crypto/gnutls/CryptoKeyRSAGnuTLS.cpp: (WebCore::CryptoKeyRSA::generatePair): * crypto/keys/CryptoKeyAES.cpp: (WebCore::CryptoKeyAES::generate): * crypto/keys/CryptoKeyHMAC.cpp: (WebCore::CryptoKeyHMAC::generate): * crypto/keys/CryptoKeyRSA.h: * crypto/mac/CryptoKeyRSAMac.cpp: (WebCore::CryptoKeyRSA::generatePair): * crypto/parameters/AesKeyGenParams.idl: Added. * crypto/parameters/CryptoAlgorithmAesCbcParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmAesKeyGenParams.h: Added. * crypto/parameters/CryptoAlgorithmAesKeyGenParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmHmacKeyGenParams.h: Added. * crypto/parameters/CryptoAlgorithmHmacKeyParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmHmacParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmRsaHashedKeyGenParams.h: Added. * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h: Added. (WebCore::CryptoAlgorithmRsaKeyGenParams::arrayToVector): * crypto/parameters/CryptoAlgorithmRsaKeyGenParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmRsaKeyParamsWithHashDeprecated.h: * crypto/parameters/CryptoAlgorithmRsaOaepParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmRsaSsaParamsDeprecated.h: * crypto/parameters/HmacKeyGenParams.idl: Added. * crypto/parameters/RsaHashedKeyGenParams.idl: Added. * crypto/parameters/RsaKeyGenParams.idl: Added. LayoutTests: Besides adding tests for SubtleCrypto::generateKey related stuff and fixing HMAC. This patch also add shouldReject(_a, _rejectCallback, _resolveCallback, _message) in js-test-pre.js. * TestExpectations: * crypto/subtle/aes-cbc-generate-key-length-128-expected.txt: Added. * crypto/subtle/aes-cbc-generate-key-length-128.html: Added. * crypto/subtle/aes-cbc-generate-key-length-192-expected.txt: Added. * crypto/subtle/aes-cbc-generate-key-length-192.html: Added. * crypto/subtle/aes-cbc-generate-key-length-256-expected.txt: Added. * crypto/subtle/aes-cbc-generate-key-length-256.html: Added. * crypto/subtle/aes-generate-key-malformed-parameters-expected.txt: Added. * crypto/subtle/aes-generate-key-malformed-parameters.html: Added. * crypto/subtle/aes-kw-generate-key-expected.txt: Added. * crypto/subtle/aes-kw-generate-key.html: Added. * crypto/subtle/generate-key-malformed-paramters-expected.txt: Added. * crypto/subtle/generate-key-malformed-paramters.html: Added. * crypto/subtle/hmac-generate-key-customized-length-expected.txt: Added. * crypto/subtle/hmac-generate-key-customized-length.html: Added. * crypto/subtle/hmac-generate-key-hash-object-expected.txt: Added. * crypto/subtle/hmac-generate-key-hash-object.html: Added. * crypto/subtle/hmac-generate-key-malformed-parameters-expected.txt: Added. * crypto/subtle/hmac-generate-key-malformed-parameters.html: Added. * crypto/subtle/hmac-generate-key-sha1-expected.txt: Added. * crypto/subtle/hmac-generate-key-sha1.html: Added. * crypto/subtle/hmac-generate-key-sha224-expected.txt: Added. * crypto/subtle/hmac-generate-key-sha224.html: Added. * crypto/subtle/hmac-generate-key-sha256-expected.txt: Added. * crypto/subtle/hmac-generate-key-sha256.html: Added. * crypto/subtle/hmac-generate-key-sha384-expected.txt: Added. * crypto/subtle/hmac-generate-key-sha384.html: Added. * crypto/subtle/hmac-generate-key-sha512-expected.txt: Added. * crypto/subtle/hmac-generate-key-sha512.html: Added. * crypto/subtle/rsa-generate-key-malformed-parameters-expected.txt: Added. * crypto/subtle/rsa-generate-key-malformed-parameters.html: Added. * crypto/subtle/rsa-oaep-generate-key-expected.txt: Added. * crypto/subtle/rsa-oaep-generate-key.html: Added. * crypto/subtle/rsaes-pkcs1-v1_5-generate-key-expected.txt: Added. * crypto/subtle/rsaes-pkcs1-v1_5-generate-key-extractable-expected.txt: Added. * crypto/subtle/rsaes-pkcs1-v1_5-generate-key-extractable.html: Added. * crypto/subtle/rsaes-pkcs1-v1_5-generate-key.html: Added. * crypto/subtle/rsassa-pkcs1-v1_5-generate-key-expected.txt: Added. * crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html: Added. * crypto/webkitSubtle/hmac-generate-key-expected.txt: * crypto/webkitSubtle/hmac-generate-key.html: * crypto/workers/subtle/aes-generate-key-expected.txt: Added. * crypto/workers/subtle/aes-generate-key.html: Added. * crypto/workers/subtle/hmac-generate-key-expected.txt: Added. * crypto/workers/subtle/hmac-generate-key.html: Added. * crypto/workers/subtle/resources/aes-generate-key.js: Added. * crypto/workers/subtle/resources/hmac-generate-key.js: Added. * crypto/workers/subtle/resources/rsa-generate-key.js: Added. * crypto/workers/subtle/rsa-generate-key-expected.txt: Added. * crypto/workers/subtle/rsa-generate-key.html: Added. * resources/js-test-pre.js: Canonical link: https://commits.webkit.org/181666@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207809 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-25 06:07:04 +00:00
{
var _exception;
var _av;
try {
_av = typeof _a == "function" ? _a() : eval(_a);
} catch (e) {
testFailed((_message ? _message : _a) + " should not throw exception. Threw exception " + e + ".");
return Promise.resolve();
}
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
return _av.then(function(result) {
Update SubtleCrypto::generateKey to match the latest spec https://bugs.webkit.org/show_bug.cgi?id=163718 <rdar://problem/28864380> Reviewed by Chris Dumez. LayoutTests/imported/w3c: * WebCryptoAPI/generateKey/test_aes-cbc-expected.txt: * WebCryptoAPI/generateKey/test_aes-cbc.html: * WebCryptoAPI/generateKey/test_aes-ctr-expected.txt: * WebCryptoAPI/generateKey/test_aes-ctr.html: * WebCryptoAPI/generateKey/test_failures-expected.txt: * WebCryptoAPI/generateKey/test_failures.html: * WebCryptoAPI/generateKey/test_failures_AES-CBC-expected.txt: * WebCryptoAPI/generateKey/test_failures_AES-CBC.html: * WebCryptoAPI/generateKey/test_failures_AES-CTR-expected.txt: * WebCryptoAPI/generateKey/test_failures_AES-CTR.html: * WebCryptoAPI/generateKey/test_failures_AES-GCM-expected.txt: * WebCryptoAPI/generateKey/test_failures_AES-GCM.html: * WebCryptoAPI/generateKey/test_failures_AES-KW-expected.txt: * WebCryptoAPI/generateKey/test_failures_AES-KW.html: * WebCryptoAPI/generateKey/test_failures_ECDH-expected.txt: * WebCryptoAPI/generateKey/test_failures_ECDH.html: * WebCryptoAPI/generateKey/test_failures_ECDSA-expected.txt: * WebCryptoAPI/generateKey/test_failures_ECDSA.html: * WebCryptoAPI/generateKey/test_failures_HMAC-expected.txt: * WebCryptoAPI/generateKey/test_failures_HMAC.html: * WebCryptoAPI/generateKey/test_failures_RSA-OAEP-expected.txt: * WebCryptoAPI/generateKey/test_failures_RSA-OAEP.html: * WebCryptoAPI/generateKey/test_failures_RSA-PSS-expected.txt: * WebCryptoAPI/generateKey/test_failures_RSA-PSS.html: * WebCryptoAPI/generateKey/test_failures_RSASSA-PKCS1-v1_5-expected.txt: * WebCryptoAPI/generateKey/test_failures_RSASSA-PKCS1-v1_5.html: * WebCryptoAPI/generateKey/test_successes-expected.txt: * WebCryptoAPI/generateKey/test_successes.html: * WebCryptoAPI/generateKey/test_successes_AES-CBC-expected.txt: * WebCryptoAPI/generateKey/test_successes_AES-CBC.html: * WebCryptoAPI/generateKey/test_successes_AES-CTR-expected.txt: * WebCryptoAPI/generateKey/test_successes_AES-CTR.html: * WebCryptoAPI/generateKey/test_successes_AES-GCM-expected.txt: * WebCryptoAPI/generateKey/test_successes_AES-GCM.html: * WebCryptoAPI/generateKey/test_successes_AES-KW-expected.txt: * WebCryptoAPI/generateKey/test_successes_AES-KW.html: * WebCryptoAPI/generateKey/test_successes_ECDH-expected.txt: * WebCryptoAPI/generateKey/test_successes_ECDH.html: * WebCryptoAPI/generateKey/test_successes_ECDSA-expected.txt: * WebCryptoAPI/generateKey/test_successes_ECDSA.html: * WebCryptoAPI/generateKey/test_successes_HMAC-expected.txt: * WebCryptoAPI/generateKey/test_successes_HMAC.html: * WebCryptoAPI/generateKey/test_successes_RSA-OAEP-expected.txt: * WebCryptoAPI/generateKey/test_successes_RSA-OAEP.html: * WebCryptoAPI/generateKey/test_successes_RSA-PSS-expected.txt: * WebCryptoAPI/generateKey/test_successes_RSA-PSS.html: * WebCryptoAPI/generateKey/test_successes_RSASSA-PKCS1-v1_5-expected.txt: * WebCryptoAPI/generateKey/test_successes_RSASSA-PKCS1-v1_5.html: * WebCryptoAPI/idlharness-expected.txt: Source/WebCore: This patch does following few things: 1. It updates the SubtleCrypto::generateKey method to match the latest spec: https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-generateKey. It also refers to the latest Editor's Draft at a certain degree: https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-generateKey. 2. It implements generateKey operations of following algorithms: AES-CBC, AES-KW, HMAC, RSAES-PKCS1-V1_5, RSASSA-PKCS1-V1_5, and RSA-OAEP. 3. It replaces SPECIALIZE_TYPE_TRAITS_CRYPTO_ALGORITHM_PARAMETERS with SPECIALIZE_TYPE_TRAITS_CRYPTO_ALGORITHM_PARAMETERS_DEPRECATED for deprecated params. 4. It fixes https://bugs.webkit.org/show_bug.cgi?id=129750 as well. Tests: crypto/subtle/aes-cbc-generate-key-length-128.html crypto/subtle/aes-cbc-generate-key-length-192.html crypto/subtle/aes-cbc-generate-key-length-256.html crypto/subtle/aes-generate-key-malformed-parameters.html crypto/subtle/aes-kw-generate-key.html crypto/subtle/generate-key-malformed-paramters.html crypto/subtle/hmac-generate-key-customized-length.html crypto/subtle/hmac-generate-key-hash-object.html crypto/subtle/hmac-generate-key-malformed-parameters.html crypto/subtle/hmac-generate-key-sha1.html crypto/subtle/hmac-generate-key-sha224.html crypto/subtle/hmac-generate-key-sha256.html crypto/subtle/hmac-generate-key-sha384.html crypto/subtle/hmac-generate-key-sha512.html crypto/subtle/rsa-generate-key-malformed-parameters.html crypto/subtle/rsa-oaep-generate-key.html crypto/subtle/rsaes-pkcs1-v1_5-generate-key-extractable.html crypto/subtle/rsaes-pkcs1-v1_5-generate-key.html crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html crypto/webkitSubtle/hmac-generate-key.html: crypto/workers/subtle/aes-generate-key.html crypto/workers/subtle/hmac-generate-key.html crypto/workers/subtle/rsa-generate-key.html * CMakeLists.txt: * DerivedSources.make: * Modules/encryptedmedia/CDMSessionClearKey.cpp: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSSubtleCryptoCustom.cpp: Added. (WebCore::toHashIdentifier): (WebCore::normalizeCryptoAlgorithmParameters): (WebCore::cryptoKeyUsagesFromJSValue): (WebCore::createAlgorithm): (WebCore::rejectWithException): (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise): (WebCore::JSSubtleCrypto::generateKey): * bindings/js/JSWebKitSubtleCryptoCustom.cpp: (WebCore::JSWebKitSubtleCrypto::generateKey): * crypto/CryptoAlgorithm.cpp: (WebCore::CryptoAlgorithm::generateKey): * crypto/CryptoAlgorithm.h: * crypto/CryptoAlgorithmParameters.h: Added. (WebCore::CryptoAlgorithmParameters::CryptoAlgorithmParameters): (WebCore::CryptoAlgorithmParameters::~CryptoAlgorithmParameters): (WebCore::CryptoAlgorithmParameters::parametersClass): * crypto/CryptoAlgorithmParameters.idl: Added. * crypto/CryptoAlgorithmParametersDeprecated.h: * crypto/CryptoKey.cpp: (WebCore::CryptoKey::setUsagesBitmap): * crypto/CryptoKey.h: * crypto/CryptoKeyPair.idl: * crypto/SubtleCrypto.idl: * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::generateKey): * crypto/algorithms/CryptoAlgorithmAES_CBC.h: * crypto/algorithms/CryptoAlgorithmAES_KW.cpp: (WebCore::CryptoAlgorithmAES_KW::generateKey): * crypto/algorithms/CryptoAlgorithmAES_KW.h: * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::generateKey): * crypto/algorithms/CryptoAlgorithmHMAC.h: * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::generateKey): * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey): * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::generateKey): * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h: * crypto/gnutls/CryptoKeyRSAGnuTLS.cpp: (WebCore::CryptoKeyRSA::generatePair): * crypto/keys/CryptoKeyAES.cpp: (WebCore::CryptoKeyAES::generate): * crypto/keys/CryptoKeyHMAC.cpp: (WebCore::CryptoKeyHMAC::generate): * crypto/keys/CryptoKeyRSA.h: * crypto/mac/CryptoKeyRSAMac.cpp: (WebCore::CryptoKeyRSA::generatePair): * crypto/parameters/AesKeyGenParams.idl: Added. * crypto/parameters/CryptoAlgorithmAesCbcParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmAesKeyGenParams.h: Added. * crypto/parameters/CryptoAlgorithmAesKeyGenParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmHmacKeyGenParams.h: Added. * crypto/parameters/CryptoAlgorithmHmacKeyParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmHmacParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmRsaHashedKeyGenParams.h: Added. * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h: Added. (WebCore::CryptoAlgorithmRsaKeyGenParams::arrayToVector): * crypto/parameters/CryptoAlgorithmRsaKeyGenParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmRsaKeyParamsWithHashDeprecated.h: * crypto/parameters/CryptoAlgorithmRsaOaepParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmRsaSsaParamsDeprecated.h: * crypto/parameters/HmacKeyGenParams.idl: Added. * crypto/parameters/RsaHashedKeyGenParams.idl: Added. * crypto/parameters/RsaKeyGenParams.idl: Added. LayoutTests: Besides adding tests for SubtleCrypto::generateKey related stuff and fixing HMAC. This patch also add shouldReject(_a, _rejectCallback, _resolveCallback, _message) in js-test-pre.js. * TestExpectations: * crypto/subtle/aes-cbc-generate-key-length-128-expected.txt: Added. * crypto/subtle/aes-cbc-generate-key-length-128.html: Added. * crypto/subtle/aes-cbc-generate-key-length-192-expected.txt: Added. * crypto/subtle/aes-cbc-generate-key-length-192.html: Added. * crypto/subtle/aes-cbc-generate-key-length-256-expected.txt: Added. * crypto/subtle/aes-cbc-generate-key-length-256.html: Added. * crypto/subtle/aes-generate-key-malformed-parameters-expected.txt: Added. * crypto/subtle/aes-generate-key-malformed-parameters.html: Added. * crypto/subtle/aes-kw-generate-key-expected.txt: Added. * crypto/subtle/aes-kw-generate-key.html: Added. * crypto/subtle/generate-key-malformed-paramters-expected.txt: Added. * crypto/subtle/generate-key-malformed-paramters.html: Added. * crypto/subtle/hmac-generate-key-customized-length-expected.txt: Added. * crypto/subtle/hmac-generate-key-customized-length.html: Added. * crypto/subtle/hmac-generate-key-hash-object-expected.txt: Added. * crypto/subtle/hmac-generate-key-hash-object.html: Added. * crypto/subtle/hmac-generate-key-malformed-parameters-expected.txt: Added. * crypto/subtle/hmac-generate-key-malformed-parameters.html: Added. * crypto/subtle/hmac-generate-key-sha1-expected.txt: Added. * crypto/subtle/hmac-generate-key-sha1.html: Added. * crypto/subtle/hmac-generate-key-sha224-expected.txt: Added. * crypto/subtle/hmac-generate-key-sha224.html: Added. * crypto/subtle/hmac-generate-key-sha256-expected.txt: Added. * crypto/subtle/hmac-generate-key-sha256.html: Added. * crypto/subtle/hmac-generate-key-sha384-expected.txt: Added. * crypto/subtle/hmac-generate-key-sha384.html: Added. * crypto/subtle/hmac-generate-key-sha512-expected.txt: Added. * crypto/subtle/hmac-generate-key-sha512.html: Added. * crypto/subtle/rsa-generate-key-malformed-parameters-expected.txt: Added. * crypto/subtle/rsa-generate-key-malformed-parameters.html: Added. * crypto/subtle/rsa-oaep-generate-key-expected.txt: Added. * crypto/subtle/rsa-oaep-generate-key.html: Added. * crypto/subtle/rsaes-pkcs1-v1_5-generate-key-expected.txt: Added. * crypto/subtle/rsaes-pkcs1-v1_5-generate-key-extractable-expected.txt: Added. * crypto/subtle/rsaes-pkcs1-v1_5-generate-key-extractable.html: Added. * crypto/subtle/rsaes-pkcs1-v1_5-generate-key.html: Added. * crypto/subtle/rsassa-pkcs1-v1_5-generate-key-expected.txt: Added. * crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html: Added. * crypto/webkitSubtle/hmac-generate-key-expected.txt: * crypto/webkitSubtle/hmac-generate-key.html: * crypto/workers/subtle/aes-generate-key-expected.txt: Added. * crypto/workers/subtle/aes-generate-key.html: Added. * crypto/workers/subtle/hmac-generate-key-expected.txt: Added. * crypto/workers/subtle/hmac-generate-key.html: Added. * crypto/workers/subtle/resources/aes-generate-key.js: Added. * crypto/workers/subtle/resources/hmac-generate-key.js: Added. * crypto/workers/subtle/resources/rsa-generate-key.js: Added. * crypto/workers/subtle/rsa-generate-key-expected.txt: Added. * crypto/workers/subtle/rsa-generate-key.html: Added. * resources/js-test-pre.js: Canonical link: https://commits.webkit.org/181666@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207809 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-25 06:07:04 +00:00
testFailed((_message ? _message : _a) + " should reject promise. Resolved with " + result + ".");
}, function(error) {
testPassed((_message ? _message : _a) + " rejected promise with " + error + ".");
});
}
Enable strict type checking for Window dictionary members https://bugs.webkit.org/show_bug.cgi?id=160356 Reviewed by Darin Adler. LayoutTests/imported/w3c: Rebaseline W3C test now that one more check is passing. * web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt: Source/WebCore: Enable strict type checking for Window dictionary members. Technically, we should do strict type checking of all wrapper types but this patch focuses on Window because it is common to pass a Window dictionary member to Event constructors. By strict type checking, I mean that we should throw a TypeError is the value is not null/undefined and does not implement the Window interface: - http://heycam.github.io/webidl/#es-interface Firefox and Chrome comply with the specification already. No new tests, updated / rebaselined existing tests. * bindings/js/JSDictionary.cpp: (WebCore::JSDictionary::convertValue): LayoutTests: Update existing tests to reflect behavior change. * fast/events/constructors/composition-event-constructor-expected.txt: * fast/events/constructors/composition-event-constructor.html: * fast/events/constructors/focus-event-constructor-expected.txt: * fast/events/constructors/focus-event-constructor.html: * fast/events/constructors/keyboard-event-constructor-expected.txt: * fast/events/constructors/keyboard-event-constructor.html: * fast/events/constructors/mouse-event-constructor.html: * fast/events/constructors/ui-event-constructor-expected.txt: * fast/events/constructors/ui-event-constructor.html: * fast/events/constructors/wheel-event-constructor.html: * platform/mac/fast/events/constructors/mouse-event-constructor-expected.txt: * platform/mac/fast/events/constructors/wheel-event-constructor-expected.txt: * resources/js-test-pre.js: Add a shouldThrowErrorName() utility function that is similar to shouldThrow() but only checks the error name instead of the full error message. Checking only the error name has the benefit of working across browsers and facilitating refactoring of error messages. Canonical link: https://commits.webkit.org/178533@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203950 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-07-31 00:29:19 +00:00
function shouldThrowErrorName(_a, _name)
{
var _exception;
try {
typeof _a == "function" ? _a() : eval(_a);
} catch (e) {
_exception = e;
}
if (_exception) {
if (_exception.name == _name)
testPassed(_a + " threw exception " + _exception + ".");
else
testFailed(_a + " should throw a " + _name + ". Threw a " + _exception.name + ".");
} else
testFailed(_a + " should throw a " + _name + ". Did not throw.");
}
function shouldHaveHadError(message)
{
if (errorMessage) {
if (!message)
testPassed("Got expected error");
else if (errorMessage.indexOf(message) !== -1)
testPassed("Got expected error: '" + message + "'");
else
testFailed("Unexpexted error '" + message + "'");
} else
testFailed("Missing expexted error");
errorMessage = undefined;
}
function gc() {
if (typeof GCController !== "undefined")
GCController.collect();
else {
var gcRec = function (n) {
if (n < 1)
return {};
var temp = {i: "ab" + i + (i / 100000)};
temp += "foo";
gcRec(n-1);
};
for (var i = 0; i < 1000; i++)
gcRec(10)
}
}
function dfgCompiled(argument)
{
var numberOfCompiles = "compiles" in argument ? argument.compiles : 1;
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
if (!("f" in argument))
throw new Error("dfgCompiled called with invalid argument.");
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
if (argument.f instanceof Array) {
for (var i = 0; i < argument.f.length; ++i) {
if (testRunner.numberOfDFGCompiles(argument.f[i]) < numberOfCompiles)
return false;
}
} else {
if (testRunner.numberOfDFGCompiles(argument.f) < numberOfCompiles)
return false;
}
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
return true;
}
function dfgIncrement(argument)
{
if (!self.testRunner)
return argument.i;
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
if (argument.i < argument.n)
return argument.i;
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
if (didFailSomeTests)
return argument.i;
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
if (!dfgCompiled(argument))
return "start" in argument ? argument.start : 0;
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
return argument.i;
}
function noInline(theFunction)
{
if (!self.testRunner)
return;
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
testRunner.neverInlineFunction(theFunction);
}
function isSuccessfullyParsed()
{
// FIXME: Remove this and only report unexpected syntax errors.
if (!errorMessage)
successfullyParsed = true;
shouldBeTrue("successfullyParsed");
if (silentTestPass && didPassSomeTestsSilently)
debug("Passed some tests silently.");
if (silentTestPass && didFailSomeTests)
debug("Some tests failed.");
debug('<br /><span class="pass">TEST COMPLETE</span>');
}
Add support for WeakRef https://bugs.webkit.org/show_bug.cgi?id=198710 Reviewed by Yusuke Suzuki. Source/JavaScriptCore: Add support for WeakRefs which are now at stage 3 (https://tc39.es/proposal-weakrefs). This patch doesn't add support for FinalizationGroups, which I'll add in another patch. Some other things of interest. Per the spec, we cannot collect a weak refs target unless it has not been dereffed (or created) in the current microtask turn. i.e. WeakRefs are only allowed to be collected at the end of a drain of the Microtask queue. My understanding for this behavior is to reduce implementation dependence on specific GC behavior in a given browser. We track if a WeakRef is retaining its target by using a version number on each WeakRef as well as on the VM. Whenever a WeakRef is derefed we update its version number to match the VM's then WriteBarrier ourselves. During marking if the VM and the WeakRef have the same version number, the target is visited. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * heap/Heap.cpp: (JSC::Heap::finalizeUnconditionalFinalizers): * jsc.cpp: (GlobalObject::finishCreation): (functionReleaseWeakRefs): * runtime/CommonIdentifiers.h: * runtime/JSGlobalObject.cpp: * runtime/JSGlobalObject.h: * runtime/JSWeakObjectRef.cpp: Added. (JSC::JSWeakObjectRef::finishCreation): (JSC::JSWeakObjectRef::visitChildren): (JSC::JSWeakObjectRef::finalizeUnconditionally): (JSC::JSWeakObjectRef::toStringName): * runtime/JSWeakObjectRef.h: Added. * runtime/VM.cpp: (JSC::VM::drainMicrotasks): * runtime/VM.h: (JSC::VM::setOnEachMicrotaskTick): (JSC::VM::finalizeSynchronousJSExecution): (JSC::VM::currentWeakRefVersion const): * runtime/WeakObjectRefConstructor.cpp: Added. (JSC::WeakObjectRefConstructor::finishCreation): (JSC::WeakObjectRefConstructor::WeakObjectRefConstructor): (JSC::callWeakRef): (JSC::constructWeakRef): * runtime/WeakObjectRefConstructor.h: Added. (JSC::WeakObjectRefConstructor::create): (JSC::WeakObjectRefConstructor::createStructure): * runtime/WeakObjectRefPrototype.cpp: Added. (JSC::WeakObjectRefPrototype::finishCreation): (JSC::getWeakRef): (JSC::protoFuncWeakRefDeref): * runtime/WeakObjectRefPrototype.h: Added. Source/WebCore: We need to make sure the Web MicrotaskQueue notifies the JSC VM that it has finished performing a microtask checkpoint. This lets the JSC VM know it is safe to collect referenced WeakRefs. Since there was no way to get the VM from the MicrotaskQueue I have added a RefPtr to the queue's VM. For the main thread the VM lives forever so is fine. For workers the queue and the VM share an owner so this shouldn't matter either. Tests: js/weakref-async-is-collected.html js/weakref-eventually-collects-values.html js/weakref-microtasks-dont-collect.html js/weakref-weakset-consistency.html * dom/Microtasks.cpp: (WebCore::MicrotaskQueue::MicrotaskQueue): (WebCore::MicrotaskQueue::mainThreadQueue): (WebCore::MicrotaskQueue::performMicrotaskCheckpoint): * dom/Microtasks.h: (WebCore::MicrotaskQueue::vm const): * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): LayoutTests: Add an asyncTestStart that mirrors the asyncTestStart behavior in the JSC cli. * http/tests/resources/js-test-pre.js: (asyncTestStart): * js/script-tests/weakref-async-is-collected.js: Added. (makeWeakRef): (turnEventLoop): (async.foo): (async.test): * js/script-tests/weakref-eventually-collects-values.js: Added. (makeWeakRef): (turnEventLoop): (let.weakRefs.async.test): * js/script-tests/weakref-microtasks-dont-collect.js: Added. (asyncTestStart.1.makeWeakRef): (turnEventLoop): (async.foo): (async.test): * js/script-tests/weakref-weakset-consistency.js: Added. (makeWeakRef): (turnEventLoop): (async.foo): (async.test): * js/weakref-async-is-collected-expected.txt: Added. * js/weakref-async-is-collected.html: Added. * js/weakref-eventually-collects-values-expected.txt: Added. * js/weakref-eventually-collects-values.html: Added. * js/weakref-microtasks-dont-collect-expected.txt: Added. * js/weakref-microtasks-dont-collect.html: Added. * js/weakref-weakset-consistency-expected.txt: Added. * js/weakref-weakset-consistency.html: Added. * resources/js-test-pre.js: (asyncTestStart): Canonical link: https://commits.webkit.org/212957@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-06-18 21:02:19 +00:00
function asyncTestStart() {
if (self.testRunner)
testRunner.waitUntilDone();
}
function asyncTestPassed() {
if (self.testRunner)
testRunner.notifyDone();
}
// It's possible for an async test to call finishJSTest() before js-test-post.js
// has been parsed.
function finishJSTest()
{
wasFinishJSTestCalled = true;
if (!self.wasPostTestScriptParsed)
return;
isSuccessfullyParsed();
if (self.jsTestIsAsync && self.testRunner)
testRunner.notifyDone();
}
Remove support for SharedWorkers https://bugs.webkit.org/show_bug.cgi?id=140344 Reviewed by Anders Carlsson. .: * Source/cmake/OptionsEfl.cmake: * Source/cmake/OptionsGTK.cmake: * Source/cmake/OptionsMac.cmake: * Source/cmake/WebKitFeatures.cmake: * Source/cmakeconfig.h.cmake: Source/JavaScriptCore: * Configurations/FeatureDefines.xcconfig: Source/WebCore: * CMakeLists.txt: * Configurations/FeatureDefines.xcconfig: * DerivedSources.cpp: * DerivedSources.make: * PlatformGTK.cmake: * PlatformMac.cmake: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: * bindings/generic/RuntimeEnabledFeatures.cpp: (WebCore::RuntimeEnabledFeatures::sharedWorkerEnabled): Deleted. * bindings/generic/RuntimeEnabledFeatures.h: * bindings/js/JSBindingsAllInOne.cpp: * bindings/js/JSDOMWindowCustom.cpp: * bindings/js/JSSharedWorkerCustom.cpp: Removed. * bindings/js/JSWorkerGlobalScopeBase.cpp: (WebCore::toJSWorkerGlobalScope): (WebCore::toJSSharedWorkerGlobalScope): Deleted. * bindings/js/JSWorkerGlobalScopeBase.h: * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::initScript): * bindings/scripts/IDLAttributes.txt: * bindings/scripts/preprocess-idls.pl: * dom/Document.cpp: (WebCore::Document::prepareForDestruction): * dom/EventTarget.h: * dom/EventTargetFactory.in: * history/PageCache.cpp: (WebCore::logCanCacheFrameDecision): (WebCore::PageCache::canCachePageContainingThisFrame): * loader/FrameLoader.cpp: * page/SecurityOrigin.h: (WebCore::SecurityOrigin::canAccessLocalStorage): (WebCore::SecurityOrigin::canAccessSharedWorkers): Deleted. * platform/FeatureCounterKeys.h: * platform/PlatformStrategies.h: (WebCore::PlatformStrategies::PlatformStrategies): (WebCore::PlatformStrategies::sharedWorkerStrategy): Deleted. * workers/DefaultSharedWorkerRepository.cpp: Removed. * workers/DefaultSharedWorkerRepository.h: Removed. * workers/SharedWorker.cpp: Removed. * workers/SharedWorker.h: Removed. * workers/SharedWorker.idl: Removed. * workers/SharedWorkerGlobalScope.cpp: Removed. * workers/SharedWorkerGlobalScope.h: Removed. * workers/SharedWorkerGlobalScope.idl: Removed. * workers/SharedWorkerRepository.cpp: Removed. * workers/SharedWorkerRepository.h: Removed. * workers/SharedWorkerStrategy.h: Removed. * workers/SharedWorkerThread.cpp: Removed. * workers/SharedWorkerThread.h: Removed. * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::isSharedWorkerGlobalScope): Deleted. Source/WebKit/mac: * Configurations/FeatureDefines.xcconfig: * WebCoreSupport/WebPlatformStrategies.h: * WebCoreSupport/WebPlatformStrategies.mm: (WebPlatformStrategies::createSharedWorkerStrategy): Deleted. Source/WebKit/win: * WebCoreSupport/WebPlatformStrategies.cpp: (WebPlatformStrategies::createSharedWorkerStrategy): Deleted. * WebCoreSupport/WebPlatformStrategies.h: Source/WebKit2: * Configurations/FeatureDefines.xcconfig: * NetworkProcess/NetworkProcessPlatformStrategies.cpp: (WebKit::NetworkProcessPlatformStrategies::createSharedWorkerStrategy): Deleted. * NetworkProcess/NetworkProcessPlatformStrategies.h: * WebKit2Prefix.h: * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: (WebKit::WebPlatformStrategies::createSharedWorkerStrategy): Deleted. (WebKit::WebPlatformStrategies::isAvailable): Deleted. * WebProcess/WebCoreSupport/WebPlatformStrategies.h: Source/WTF: * wtf/FeatureDefines.h: Tools: * Scripts/webkitperl/FeatureList.pm: LayoutTests: Remove shared worker specific tests and update others to remove references to shared workers. * fast/constructors/constructor-as-function-crash-expected.txt: * fast/constructors/constructor-as-function-crash.html: * fast/dom/call-a-constructor-as-a-function-expected.txt: * fast/dom/call-a-constructor-as-a-function.html: * fast/workers/resources/create-shared-worker-frame.html: Removed. * fast/workers/resources/shared-worker-common.js: Removed. * fast/workers/resources/shared-worker-count-connections.js: Removed. * fast/workers/resources/shared-worker-create-common.js: Removed. * fast/workers/resources/shared-worker-exception.js: Removed. * fast/workers/resources/shared-worker-iframe.html: Removed. * fast/workers/resources/shared-worker-lifecycle.js: Removed. * fast/workers/resources/shared-worker-name.js: Removed. * fast/workers/resources/shared-worker-script-error.js: Removed. * fast/workers/shared-worker-constructor-expected.txt: Removed. * fast/workers/shared-worker-constructor.html: Removed. * fast/workers/shared-worker-context-gc-expected.txt: Removed. * fast/workers/shared-worker-context-gc.html: Removed. * fast/workers/shared-worker-event-listener-expected.txt: Removed. * fast/workers/shared-worker-event-listener.html: Removed. * fast/workers/shared-worker-exception-expected.txt: Removed. * fast/workers/shared-worker-exception.html: Removed. * fast/workers/shared-worker-frame-lifecycle-expected.txt: Removed. * fast/workers/shared-worker-frame-lifecycle.html: Removed. * fast/workers/shared-worker-gc-expected.txt: Removed. * fast/workers/shared-worker-gc.html: Removed. * fast/workers/shared-worker-in-iframe-expected.txt: Removed. * fast/workers/shared-worker-in-iframe.html: Removed. * fast/workers/shared-worker-lifecycle-expected.txt: Removed. * fast/workers/shared-worker-lifecycle.html: Removed. * fast/workers/shared-worker-load-error-expected.txt: Removed. * fast/workers/shared-worker-load-error.html: Removed. * fast/workers/shared-worker-location-expected.txt: Removed. * fast/workers/shared-worker-location.html: Removed. * fast/workers/shared-worker-messageevent-source-expected.txt: Removed. * fast/workers/shared-worker-messageevent-source.html: Removed. * fast/workers/shared-worker-name-expected.txt: Removed. * fast/workers/shared-worker-name.html: Removed. * fast/workers/shared-worker-navigator-expected.txt: Removed. * fast/workers/shared-worker-navigator.html: Removed. * fast/workers/shared-worker-replace-global-constructor-expected.txt: Removed. * fast/workers/shared-worker-replace-global-constructor.html: Removed. * fast/workers/shared-worker-replace-self-expected.txt: Removed. * fast/workers/shared-worker-replace-self.html: Removed. * fast/workers/shared-worker-script-error-expected.txt: Removed. * fast/workers/shared-worker-script-error.html: Removed. * fast/workers/shared-worker-shared-expected.txt: Removed. * fast/workers/shared-worker-shared.html: Removed. * fast/workers/shared-worker-simple-expected.txt: Removed. * fast/workers/shared-worker-simple.html: Removed. * fast/workers/shared-worker-storagequota-query-usage-expected.txt: Removed. * fast/workers/shared-worker-storagequota-query-usage.html: Removed. * fast/workers/worker-crash-with-invalid-location-expected.txt: * fast/workers/worker-crash-with-invalid-location.html: * http/tests/resources/js-test-pre.js: (startWorker): (.worker.port.onmessage): Deleted. (.self.onconnect.workerPort.onmessage): Deleted. (.self.onconnect): Deleted. * http/tests/security/contentSecurityPolicy/resources/shared-worker-make-xhr.js: Removed. * http/tests/security/contentSecurityPolicy/shared-worker-connect-src-allowed-expected.txt: Removed. * http/tests/security/contentSecurityPolicy/shared-worker-connect-src-allowed.html: Removed. * http/tests/security/contentSecurityPolicy/shared-worker-connect-src-blocked-expected.txt: Removed. * http/tests/security/contentSecurityPolicy/shared-worker-connect-src-blocked.html: Removed. * http/tests/security/cross-origin-shared-worker-allowed-expected.txt: Removed. * http/tests/security/cross-origin-shared-worker-allowed.html: Removed. * http/tests/security/cross-origin-shared-worker-expected.txt: Removed. * http/tests/security/cross-origin-shared-worker.html: Removed. * http/tests/security/resources/cross-origin-iframe-for-shared-worker.html: Removed. * http/tests/security/resources/iframe-for-storage-blocking-changed-shared-worker.html: Removed. * http/tests/security/resources/shared-worker.js: Removed. * http/tests/security/same-origin-shared-worker-blocked-expected.txt: Removed. * http/tests/security/same-origin-shared-worker-blocked.html: Removed. * http/tests/security/storage-blocking-loosened-shared-worker-expected.txt: Removed. * http/tests/security/storage-blocking-loosened-shared-worker.html: Removed. * http/tests/security/storage-blocking-strengthened-shared-worker-expected.txt: Removed. * http/tests/security/storage-blocking-strengthened-shared-worker.html: Removed. * http/tests/websocket/tests/hybi/workers/close-in-shared-worker-expected.txt: Removed. * http/tests/websocket/tests/hybi/workers/close-in-shared-worker.html: Removed. * http/tests/websocket/tests/hybi/workers/shared-worker-simple-expected.txt: Removed. * http/tests/websocket/tests/hybi/workers/shared-worker-simple.html: Removed. * http/tests/workers/shared-worker-importScripts-expected.txt: Removed. * http/tests/workers/shared-worker-importScripts.html: Removed. * http/tests/workers/shared-worker-invalid-url-expected.txt: Removed. * http/tests/workers/shared-worker-invalid-url.html: Removed. * http/tests/workers/shared-worker-redirect-expected.txt: Removed. * http/tests/workers/shared-worker-redirect.html: Removed. * http/tests/xmlhttprequest/workers/resources/shared-worker-create.js: Removed. * http/tests/xmlhttprequest/workers/shared-worker-access-control-basic-get-fail-non-simple-expected.txt: Removed. * http/tests/xmlhttprequest/workers/shared-worker-access-control-basic-get-fail-non-simple.html: Removed. * http/tests/xmlhttprequest/workers/shared-worker-close-expected.txt: Removed. * http/tests/xmlhttprequest/workers/shared-worker-close.html: Removed. * http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt: Removed. * http/tests/xmlhttprequest/workers/shared-worker-methods-async.html: Removed. * http/tests/xmlhttprequest/workers/shared-worker-methods-expected.txt: Removed. * http/tests/xmlhttprequest/workers/shared-worker-methods.html: Removed. * http/tests/xmlhttprequest/workers/shared-worker-referer-expected.txt: Removed. * http/tests/xmlhttprequest/workers/shared-worker-referer.html: Removed. * http/tests/xmlhttprequest/workers/shared-worker-xhr-file-not-found-expected.txt: Removed. * http/tests/xmlhttprequest/workers/shared-worker-xhr-file-not-found.html: Removed. * js/dom/constructor-length.html: * js/dom/global-constructors-attributes-expected.txt: * js/dom/global-constructors-attributes-shared-worker-expected.txt: Removed. * js/dom/global-constructors-attributes-shared-worker.html: Removed. * platform/efl/http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt: Removed. * platform/efl/http/tests/xmlhttprequest/workers/shared-worker-methods-expected.txt: Removed. * platform/efl/js/dom/constructor-length-expected.txt: * platform/efl/js/dom/global-constructors-attributes-expected.txt: * platform/efl/js/dom/global-constructors-attributes-shared-worker-expected.txt: Removed. * platform/gtk/http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt: Removed. * platform/gtk/http/tests/xmlhttprequest/workers/shared-worker-methods-expected.txt: Removed. * platform/gtk/js/dom/constructor-length-expected.txt: * platform/gtk/js/dom/global-constructors-attributes-expected.txt: * platform/ios-sim-deprecated/fast/dom/Window/window-property-descriptors-expected.txt: * platform/ios-sim-deprecated/fast/js/constructor-length-expected.txt: * platform/ios-sim-deprecated/fast/js/global-constructors-expected.txt: * platform/ios-sim-deprecated/fast/workers/shared-worker-storagequota-query-usage-expected.txt: Removed. * platform/ios-sim-deprecated/http/tests/security/cross-origin-shared-worker-allowed-expected.txt: Removed. * platform/ios-sim-deprecated/http/tests/security/cross-origin-shared-worker-expected.txt: Removed. * platform/ios-sim-deprecated/js/dom/global-constructors-attributes-expected.txt: * platform/ios-sim-deprecated/storage/indexeddb/basics-shared-workers-expected.txt: Removed. * platform/ios-simulator/js/dom/constructor-length-expected.txt: * platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt: * platform/mac-mountainlion/js/dom/global-constructors-attributes-expected.txt: * platform/mac-wk2/TestExpectations: * platform/mac/js/dom/constructor-length-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * platform/win/fast/dom/call-a-constructor-as-a-function-expected.txt: * platform/win/js/dom/global-constructors-attributes-expected.txt: * platform/win/js/dom/global-constructors-attributes-shared-worker-expected.txt: Removed. * resources/js-test-pre.js: (startWorker): (.worker.port.onmessage): Deleted. (.self.onconnect.workerPort.onmessage): Deleted. (.self.onconnect): Deleted. * resources/js-test.js: (startWorker): (.worker.port.onmessage): Deleted. (.self.onconnect.workerPort.onmessage): Deleted. (.self.onconnect): Deleted. * storage/indexeddb/basics-shared-workers-expected.txt: Removed. * storage/indexeddb/basics-shared-workers.html: Removed. Canonical link: https://commits.webkit.org/158361@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@178310 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-01-13 00:40:49 +00:00
function startWorker(testScriptURL)
{
self.jsTestIsAsync = true;
debug('Starting worker: ' + testScriptURL);
Remove support for SharedWorkers https://bugs.webkit.org/show_bug.cgi?id=140344 Reviewed by Anders Carlsson. .: * Source/cmake/OptionsEfl.cmake: * Source/cmake/OptionsGTK.cmake: * Source/cmake/OptionsMac.cmake: * Source/cmake/WebKitFeatures.cmake: * Source/cmakeconfig.h.cmake: Source/JavaScriptCore: * Configurations/FeatureDefines.xcconfig: Source/WebCore: * CMakeLists.txt: * Configurations/FeatureDefines.xcconfig: * DerivedSources.cpp: * DerivedSources.make: * PlatformGTK.cmake: * PlatformMac.cmake: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: * bindings/generic/RuntimeEnabledFeatures.cpp: (WebCore::RuntimeEnabledFeatures::sharedWorkerEnabled): Deleted. * bindings/generic/RuntimeEnabledFeatures.h: * bindings/js/JSBindingsAllInOne.cpp: * bindings/js/JSDOMWindowCustom.cpp: * bindings/js/JSSharedWorkerCustom.cpp: Removed. * bindings/js/JSWorkerGlobalScopeBase.cpp: (WebCore::toJSWorkerGlobalScope): (WebCore::toJSSharedWorkerGlobalScope): Deleted. * bindings/js/JSWorkerGlobalScopeBase.h: * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::initScript): * bindings/scripts/IDLAttributes.txt: * bindings/scripts/preprocess-idls.pl: * dom/Document.cpp: (WebCore::Document::prepareForDestruction): * dom/EventTarget.h: * dom/EventTargetFactory.in: * history/PageCache.cpp: (WebCore::logCanCacheFrameDecision): (WebCore::PageCache::canCachePageContainingThisFrame): * loader/FrameLoader.cpp: * page/SecurityOrigin.h: (WebCore::SecurityOrigin::canAccessLocalStorage): (WebCore::SecurityOrigin::canAccessSharedWorkers): Deleted. * platform/FeatureCounterKeys.h: * platform/PlatformStrategies.h: (WebCore::PlatformStrategies::PlatformStrategies): (WebCore::PlatformStrategies::sharedWorkerStrategy): Deleted. * workers/DefaultSharedWorkerRepository.cpp: Removed. * workers/DefaultSharedWorkerRepository.h: Removed. * workers/SharedWorker.cpp: Removed. * workers/SharedWorker.h: Removed. * workers/SharedWorker.idl: Removed. * workers/SharedWorkerGlobalScope.cpp: Removed. * workers/SharedWorkerGlobalScope.h: Removed. * workers/SharedWorkerGlobalScope.idl: Removed. * workers/SharedWorkerRepository.cpp: Removed. * workers/SharedWorkerRepository.h: Removed. * workers/SharedWorkerStrategy.h: Removed. * workers/SharedWorkerThread.cpp: Removed. * workers/SharedWorkerThread.h: Removed. * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::isSharedWorkerGlobalScope): Deleted. Source/WebKit/mac: * Configurations/FeatureDefines.xcconfig: * WebCoreSupport/WebPlatformStrategies.h: * WebCoreSupport/WebPlatformStrategies.mm: (WebPlatformStrategies::createSharedWorkerStrategy): Deleted. Source/WebKit/win: * WebCoreSupport/WebPlatformStrategies.cpp: (WebPlatformStrategies::createSharedWorkerStrategy): Deleted. * WebCoreSupport/WebPlatformStrategies.h: Source/WebKit2: * Configurations/FeatureDefines.xcconfig: * NetworkProcess/NetworkProcessPlatformStrategies.cpp: (WebKit::NetworkProcessPlatformStrategies::createSharedWorkerStrategy): Deleted. * NetworkProcess/NetworkProcessPlatformStrategies.h: * WebKit2Prefix.h: * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: (WebKit::WebPlatformStrategies::createSharedWorkerStrategy): Deleted. (WebKit::WebPlatformStrategies::isAvailable): Deleted. * WebProcess/WebCoreSupport/WebPlatformStrategies.h: Source/WTF: * wtf/FeatureDefines.h: Tools: * Scripts/webkitperl/FeatureList.pm: LayoutTests: Remove shared worker specific tests and update others to remove references to shared workers. * fast/constructors/constructor-as-function-crash-expected.txt: * fast/constructors/constructor-as-function-crash.html: * fast/dom/call-a-constructor-as-a-function-expected.txt: * fast/dom/call-a-constructor-as-a-function.html: * fast/workers/resources/create-shared-worker-frame.html: Removed. * fast/workers/resources/shared-worker-common.js: Removed. * fast/workers/resources/shared-worker-count-connections.js: Removed. * fast/workers/resources/shared-worker-create-common.js: Removed. * fast/workers/resources/shared-worker-exception.js: Removed. * fast/workers/resources/shared-worker-iframe.html: Removed. * fast/workers/resources/shared-worker-lifecycle.js: Removed. * fast/workers/resources/shared-worker-name.js: Removed. * fast/workers/resources/shared-worker-script-error.js: Removed. * fast/workers/shared-worker-constructor-expected.txt: Removed. * fast/workers/shared-worker-constructor.html: Removed. * fast/workers/shared-worker-context-gc-expected.txt: Removed. * fast/workers/shared-worker-context-gc.html: Removed. * fast/workers/shared-worker-event-listener-expected.txt: Removed. * fast/workers/shared-worker-event-listener.html: Removed. * fast/workers/shared-worker-exception-expected.txt: Removed. * fast/workers/shared-worker-exception.html: Removed. * fast/workers/shared-worker-frame-lifecycle-expected.txt: Removed. * fast/workers/shared-worker-frame-lifecycle.html: Removed. * fast/workers/shared-worker-gc-expected.txt: Removed. * fast/workers/shared-worker-gc.html: Removed. * fast/workers/shared-worker-in-iframe-expected.txt: Removed. * fast/workers/shared-worker-in-iframe.html: Removed. * fast/workers/shared-worker-lifecycle-expected.txt: Removed. * fast/workers/shared-worker-lifecycle.html: Removed. * fast/workers/shared-worker-load-error-expected.txt: Removed. * fast/workers/shared-worker-load-error.html: Removed. * fast/workers/shared-worker-location-expected.txt: Removed. * fast/workers/shared-worker-location.html: Removed. * fast/workers/shared-worker-messageevent-source-expected.txt: Removed. * fast/workers/shared-worker-messageevent-source.html: Removed. * fast/workers/shared-worker-name-expected.txt: Removed. * fast/workers/shared-worker-name.html: Removed. * fast/workers/shared-worker-navigator-expected.txt: Removed. * fast/workers/shared-worker-navigator.html: Removed. * fast/workers/shared-worker-replace-global-constructor-expected.txt: Removed. * fast/workers/shared-worker-replace-global-constructor.html: Removed. * fast/workers/shared-worker-replace-self-expected.txt: Removed. * fast/workers/shared-worker-replace-self.html: Removed. * fast/workers/shared-worker-script-error-expected.txt: Removed. * fast/workers/shared-worker-script-error.html: Removed. * fast/workers/shared-worker-shared-expected.txt: Removed. * fast/workers/shared-worker-shared.html: Removed. * fast/workers/shared-worker-simple-expected.txt: Removed. * fast/workers/shared-worker-simple.html: Removed. * fast/workers/shared-worker-storagequota-query-usage-expected.txt: Removed. * fast/workers/shared-worker-storagequota-query-usage.html: Removed. * fast/workers/worker-crash-with-invalid-location-expected.txt: * fast/workers/worker-crash-with-invalid-location.html: * http/tests/resources/js-test-pre.js: (startWorker): (.worker.port.onmessage): Deleted. (.self.onconnect.workerPort.onmessage): Deleted. (.self.onconnect): Deleted. * http/tests/security/contentSecurityPolicy/resources/shared-worker-make-xhr.js: Removed. * http/tests/security/contentSecurityPolicy/shared-worker-connect-src-allowed-expected.txt: Removed. * http/tests/security/contentSecurityPolicy/shared-worker-connect-src-allowed.html: Removed. * http/tests/security/contentSecurityPolicy/shared-worker-connect-src-blocked-expected.txt: Removed. * http/tests/security/contentSecurityPolicy/shared-worker-connect-src-blocked.html: Removed. * http/tests/security/cross-origin-shared-worker-allowed-expected.txt: Removed. * http/tests/security/cross-origin-shared-worker-allowed.html: Removed. * http/tests/security/cross-origin-shared-worker-expected.txt: Removed. * http/tests/security/cross-origin-shared-worker.html: Removed. * http/tests/security/resources/cross-origin-iframe-for-shared-worker.html: Removed. * http/tests/security/resources/iframe-for-storage-blocking-changed-shared-worker.html: Removed. * http/tests/security/resources/shared-worker.js: Removed. * http/tests/security/same-origin-shared-worker-blocked-expected.txt: Removed. * http/tests/security/same-origin-shared-worker-blocked.html: Removed. * http/tests/security/storage-blocking-loosened-shared-worker-expected.txt: Removed. * http/tests/security/storage-blocking-loosened-shared-worker.html: Removed. * http/tests/security/storage-blocking-strengthened-shared-worker-expected.txt: Removed. * http/tests/security/storage-blocking-strengthened-shared-worker.html: Removed. * http/tests/websocket/tests/hybi/workers/close-in-shared-worker-expected.txt: Removed. * http/tests/websocket/tests/hybi/workers/close-in-shared-worker.html: Removed. * http/tests/websocket/tests/hybi/workers/shared-worker-simple-expected.txt: Removed. * http/tests/websocket/tests/hybi/workers/shared-worker-simple.html: Removed. * http/tests/workers/shared-worker-importScripts-expected.txt: Removed. * http/tests/workers/shared-worker-importScripts.html: Removed. * http/tests/workers/shared-worker-invalid-url-expected.txt: Removed. * http/tests/workers/shared-worker-invalid-url.html: Removed. * http/tests/workers/shared-worker-redirect-expected.txt: Removed. * http/tests/workers/shared-worker-redirect.html: Removed. * http/tests/xmlhttprequest/workers/resources/shared-worker-create.js: Removed. * http/tests/xmlhttprequest/workers/shared-worker-access-control-basic-get-fail-non-simple-expected.txt: Removed. * http/tests/xmlhttprequest/workers/shared-worker-access-control-basic-get-fail-non-simple.html: Removed. * http/tests/xmlhttprequest/workers/shared-worker-close-expected.txt: Removed. * http/tests/xmlhttprequest/workers/shared-worker-close.html: Removed. * http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt: Removed. * http/tests/xmlhttprequest/workers/shared-worker-methods-async.html: Removed. * http/tests/xmlhttprequest/workers/shared-worker-methods-expected.txt: Removed. * http/tests/xmlhttprequest/workers/shared-worker-methods.html: Removed. * http/tests/xmlhttprequest/workers/shared-worker-referer-expected.txt: Removed. * http/tests/xmlhttprequest/workers/shared-worker-referer.html: Removed. * http/tests/xmlhttprequest/workers/shared-worker-xhr-file-not-found-expected.txt: Removed. * http/tests/xmlhttprequest/workers/shared-worker-xhr-file-not-found.html: Removed. * js/dom/constructor-length.html: * js/dom/global-constructors-attributes-expected.txt: * js/dom/global-constructors-attributes-shared-worker-expected.txt: Removed. * js/dom/global-constructors-attributes-shared-worker.html: Removed. * platform/efl/http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt: Removed. * platform/efl/http/tests/xmlhttprequest/workers/shared-worker-methods-expected.txt: Removed. * platform/efl/js/dom/constructor-length-expected.txt: * platform/efl/js/dom/global-constructors-attributes-expected.txt: * platform/efl/js/dom/global-constructors-attributes-shared-worker-expected.txt: Removed. * platform/gtk/http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt: Removed. * platform/gtk/http/tests/xmlhttprequest/workers/shared-worker-methods-expected.txt: Removed. * platform/gtk/js/dom/constructor-length-expected.txt: * platform/gtk/js/dom/global-constructors-attributes-expected.txt: * platform/ios-sim-deprecated/fast/dom/Window/window-property-descriptors-expected.txt: * platform/ios-sim-deprecated/fast/js/constructor-length-expected.txt: * platform/ios-sim-deprecated/fast/js/global-constructors-expected.txt: * platform/ios-sim-deprecated/fast/workers/shared-worker-storagequota-query-usage-expected.txt: Removed. * platform/ios-sim-deprecated/http/tests/security/cross-origin-shared-worker-allowed-expected.txt: Removed. * platform/ios-sim-deprecated/http/tests/security/cross-origin-shared-worker-expected.txt: Removed. * platform/ios-sim-deprecated/js/dom/global-constructors-attributes-expected.txt: * platform/ios-sim-deprecated/storage/indexeddb/basics-shared-workers-expected.txt: Removed. * platform/ios-simulator/js/dom/constructor-length-expected.txt: * platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt: * platform/mac-mountainlion/js/dom/global-constructors-attributes-expected.txt: * platform/mac-wk2/TestExpectations: * platform/mac/js/dom/constructor-length-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * platform/win/fast/dom/call-a-constructor-as-a-function-expected.txt: * platform/win/js/dom/global-constructors-attributes-expected.txt: * platform/win/js/dom/global-constructors-attributes-shared-worker-expected.txt: Removed. * resources/js-test-pre.js: (startWorker): (.worker.port.onmessage): Deleted. (.self.onconnect.workerPort.onmessage): Deleted. (.self.onconnect): Deleted. * resources/js-test.js: (startWorker): (.worker.port.onmessage): Deleted. (.self.onconnect.workerPort.onmessage): Deleted. (.self.onconnect): Deleted. * storage/indexeddb/basics-shared-workers-expected.txt: Removed. * storage/indexeddb/basics-shared-workers.html: Removed. Canonical link: https://commits.webkit.org/158361@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@178310 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-01-13 00:40:49 +00:00
var worker = new Worker(testScriptURL);
worker.onmessage = function(event)
{
var workerPrefix = "[Worker] ";
if (event.data.length < 5 || event.data.charAt(4) != ':') {
check-webkit-style should keep JavaScript test functions in sync <https://webkit.org/b/171424> Reviewed by Joseph Pecoraro. JSTests: This change makes shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() in sync with other copies of these methods. * stress/resources/standalone-pre.js: (shouldBe): Fix whitespace. Prefix 'exception' and 'quiet' variables with underscore. (shouldThrow): Fix whitespace. Tools: Add a new JSTestChecker for check-webkit-style that keeps these two files in sync: LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js And keeps implementations of shouldBe(), shouldNotBe(), shouldNotThrow(), and shouldThrow() in sync across multiple files (with the ability to add more functions later): JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js * Scripts/webkitpy/style/checker.py: Remove unused import. Add import for JSTestChecker. (_NEVER_SKIPPED_FILES): Add array of file names that are never skipped regardless of other rules. (_all_categories): Add JSTestChecker categories. (CheckerDispatcher.should_skip_without_warning): Use _NEVER_SKIPPED_FILES. (CheckerDispatcher._create_checker): Return JSTestChecker for the files to check. * Scripts/webkitpy/style/checkers/jstest.py: Add. (map_functions_to_dict): Parse JavaScript source by splitting on /^function\s+/ regex. This is good enough for the sanity checks to keep function implementations in sync. (strip_blank_lines_and_comments): Strips blank lines and lines with comments from the end of a chunk of text representing a function. (JSTestChecker): New checker. (JSTestChecker.__init__): (JSTestChecker.check): (JSTestChecker.check_js_test_files): Keeps whole files in sync. (JSTestChecker.check_js_test_functions): Keeps individual functions in sync. * Scripts/webkitpy/style/checkers/jstest_unittest.py: Add test case. (JSTestTestCase): (JSTestTestCase.test_map_functions_to_dict): LayoutTests: This change attempts to fix all whitespace issues in these two files (which are now identical and will be kept in sync by check-webkit-style): LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js It also syncs the implementation of shouldBe(), shouldNotBe(), shouldNotThrow() and shouldThrow() across the following files: JSTests/stress/resources/standalone-pre.js LayoutTests/http/tests/resources/js-test-pre.js LayoutTests/resources/js-test-pre.js LayoutTests/resources/js-test.js LayoutTests/resources/standalone-pre.js Only interesting (non-whitespace) changes are listed below. * http/tests/resources/js-test-pre.js: Copy from resources/js-test-pre.js. (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. * resources/js-test.js: (shouldBe): Prefix 'quiet' variable with underscore. Use stringify() when printing '_bv' value. * resources/standalone-pre.js: (shouldBe): Prefix 'exception' and 'quiet' variables with underscore. (shouldNotBe): Ditto. Canonical link: https://commits.webkit.org/188477@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-02 20:10:12 +00:00
debug(workerPrefix + event.data);
return;
}
var code = event.data.substring(0, 4);
var payload = workerPrefix + event.data.substring(5);
if (code == "PASS")
testPassed(payload);
else if (code == "FAIL")
testFailed(payload);
else if (code == "DESC")
description(payload);
else if (code == "DONE")
finishJSTest();
else
debug(workerPrefix + event.data);
};
worker.onerror = function(event)
{
debug('Got error from worker: ' + event.message);
finishJSTest();
}
return worker;
}
if (isWorker()) {
var workerPort = self;
description = function(msg, quiet) {
workerPort.postMessage('DESC:' + msg);
}
testFailed = function(msg) {
workerPort.postMessage('FAIL:' + msg);
}
testPassed = function(msg) {
workerPort.postMessage('PASS:' + msg);
}
finishJSTest = function() {
workerPort.postMessage('DONE:');
}
debug = function(msg) {
workerPort.postMessage(msg);
}
}