From 6f306245a1d381e8007cf8e698aab9d1e136d7e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Thu, 3 Mar 2011 11:34:55 +0100 Subject: [PATCH 01/21] Bug 586212 - Don't carry out the command when clicking on a disabled splitmenu. r=dolske --- browser/base/content/urlbarBindings.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/browser/base/content/urlbarBindings.xml b/browser/base/content/urlbarBindings.xml index dbf830d6518d..0cd2e14e9309 100644 --- a/browser/base/content/urlbarBindings.xml +++ b/browser/base/content/urlbarBindings.xml @@ -1166,6 +1166,12 @@ ]]> Date: Thu, 3 Mar 2011 11:35:18 +0100 Subject: [PATCH 02/21] Bug 631491 - toolbar's iconsize attribute is not updated correctly after switching themes. r+a=dolske --- browser/base/content/browser.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index dd085396a85e..4940c10d9083 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -3653,13 +3653,10 @@ function retrieveToolbarIconsizesFromTheme() { // toolbar. A custom property cannot be used because getComputedStyle can // only return the values of standard CSS properties. let counterReset = getComputedStyle(aToolbar).counterReset; - if (counterReset == "smallicons 0") { + if (counterReset == "smallicons 0") aToolbar.setAttribute("iconsize", "small"); - document.persist(aToolbar.id, "iconsize"); - } else if (counterReset == "largeicons 0") { + else if (counterReset == "largeicons 0") aToolbar.setAttribute("iconsize", "large"); - document.persist(aToolbar.id, "iconsize"); - } } Array.forEach(gNavToolbox.childNodes, retrieveToolbarIconsize); From 63bc2609ca780c34403da04507e167da6082c386 Mon Sep 17 00:00:00 2001 From: Marco Bonardo Date: Thu, 3 Mar 2011 13:50:59 +0100 Subject: [PATCH 03/21] Bug 619689 - Intermittent browser_sidebarpanels_click.js | Item is visited followed by timeout and havoc in other tests. r=sdwilsh a=tests-only --- .../browser/browser_sidebarpanels_click.js | 159 +++++++++--------- 1 file changed, 80 insertions(+), 79 deletions(-) diff --git a/browser/components/places/tests/browser/browser_sidebarpanels_click.js b/browser/components/places/tests/browser/browser_sidebarpanels_click.js index 390d81c08463..937c9bfba760 100644 --- a/browser/components/places/tests/browser/browser_sidebarpanels_click.js +++ b/browser/components/places/tests/browser/browser_sidebarpanels_click.js @@ -39,44 +39,41 @@ // panels are clickable in both LTR and RTL modes. function test() { + waitForExplicitFinish(); + const BOOKMARKS_SIDEBAR_ID = "viewBookmarksSidebar"; const BOOKMARKS_SIDEBAR_TREE_ID = "bookmarks-view"; const HISTORY_SIDEBAR_ID = "viewHistorySidebar"; const HISTORY_SIDEBAR_TREE_ID = "historyTree"; - - // Initialization. - let os = Cc["@mozilla.org/observer-service;1"]. - getService(Ci.nsIObserverService); - let bs = PlacesUtils.bookmarks; - let hs = PlacesUtils.history; - let sidebarBox = document.getElementById("sidebar-box"); - let sidebar = document.getElementById("sidebar"); - waitForExplicitFinish(); + const TEST_URL = "http://mochi.test:8888/browser/browser/components/places/tests/browser/sidebarpanels_click_test_page.html"; // If a sidebar is already open, close it. - if (!sidebarBox.hidden) { + if (!document.getElementById("sidebar-box").hidden) { info("Unexpected sidebar found - a previous test failed to cleanup correctly"); toggleSidebar(); } - const TEST_URL = "http://mochi.test:8888/browser/browser/components/places/tests/browser/sidebarpanels_click_test_page.html"; - + let sidebar = document.getElementById("sidebar"); let tests = []; + let currentTest; + tests.push({ _itemID: null, init: function() { // Add a bookmark to the Unfiled Bookmarks folder. - this._itemID = bs.insertBookmark(bs.unfiledBookmarksFolder, - PlacesUtils._uri(TEST_URL), - bs.DEFAULT_INDEX, "test"); + this._itemID = PlacesUtils.bookmarks.insertBookmark( + PlacesUtils.unfiledBookmarksFolderId, PlacesUtils._uri(TEST_URL), + PlacesUtils.bookmarks.DEFAULT_INDEX, "test" + ); }, prepare: function() { }, selectNode: function(tree) { tree.selectItems([this._itemID]); }, - cleanup: function() { - bs.removeFolderChildren(bs.unfiledBookmarksFolder); + cleanup: function(aCallback) { + PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId); + executeSoon(aCallback); }, sidebarName: BOOKMARKS_SIDEBAR_ID, treeName: BOOKMARKS_SIDEBAR_TREE_ID, @@ -86,11 +83,11 @@ function test() { tests.push({ init: function() { // Add a history entry. - this.cleanup(); let uri = PlacesUtils._uri(TEST_URL); - hs.addVisit(uri, Date.now() * 1000, null, hs.TRANSITION_TYPED, false, 0); - let gh = hs.QueryInterface(Ci.nsIGlobalHistory2); - ok(gh.isVisited(uri), "Item is visited"); + PlacesUtils.history.addVisit(uri, Date.now() * 1000, null, + PlacesUtils.history.TRANSITION_TYPED, + false, 0); + ok(PlacesUtils.ghistory2.isVisited(uri), "Item is visited"); }, prepare: function() { sidebar.contentDocument.getElementById("byvisited").doCommand(); @@ -100,66 +97,46 @@ function test() { is(tree.selectedNode.uri, TEST_URL, "The correct visit has been selected"); is(tree.selectedNode.itemId, -1, "The selected node is not bookmarked"); }, - cleanup: function() { - hs.QueryInterface(Ci.nsIBrowserHistory) - .removeAllPages(); + cleanup: function(aCallback) { + waitForClearHistory(aCallback); }, sidebarName: HISTORY_SIDEBAR_ID, treeName: HISTORY_SIDEBAR_TREE_ID, desc: "History sidebar test" }); - let currentTest; - function testPlacesPanel(preFunc, postFunc) { currentTest.init(); sidebar.addEventListener("load", function() { sidebar.removeEventListener("load", arguments.callee, true); - - let doc = sidebar.contentDocument; - let tree = doc.getElementById(currentTest.treeName); - let tbo = tree.treeBoxObject; - executeSoon(function() { currentTest.prepare(); + if (preFunc) preFunc(); function observer(aSubject, aTopic, aData) { info("alert dialog observed as expected"); - os.removeObserver(observer, "common-dialog-loaded"); - os.removeObserver(observer, "tabmodal-dialog-loaded"); + Services.obs.removeObserver(observer, "common-dialog-loaded"); + Services.obs.removeObserver(observer, "tabmodal-dialog-loaded"); aSubject.Dialog.ui.button0.click(); executeSoon(function () { toggleSidebar(currentTest.sidebarName); - currentTest.cleanup(); - postFunc(); + currentTest.cleanup(postFunc); }); } - os.addObserver(observer, "common-dialog-loaded", false); - os.addObserver(observer, "tabmodal-dialog-loaded", false); + Services.obs.addObserver(observer, "common-dialog-loaded", false); + Services.obs.addObserver(observer, "tabmodal-dialog-loaded", false); + + let tree = sidebar.contentDocument.getElementById(currentTest.treeName); // Select the inserted places item. currentTest.selectNode(tree); - is(tbo.view.selection.count, 1, - "The test node should be successfully selected"); - // Get its row ID. - let min = {}, max = {}; - tbo.view.selection.getRangeAt(0, min, max); - let rowID = min.value; - tbo.ensureRowIsVisible(rowID); - // Calculate the click coordinates. - let x = {}, y = {}, width = {}, height = {}; - tbo.getCoordsForCellItem(rowID, tree.columns[0], "text", - x, y, width, height); - x = x.value + width.value / 2; - y = y.value + height.value / 2; - // Simulate the click. - EventUtils.synthesizeMouse(tree.body, x, y, {}, doc.defaultView); + synthesizeClickOnSelectedTreeCell(tree); // Now, wait for the observer to catch the alert dialog. // If something goes wrong, the test will time out at this stage. // Note that for the history sidebar, the URL itself is not opened, @@ -171,45 +148,69 @@ function test() { toggleSidebar(currentTest.sidebarName); } + function synthesizeClickOnSelectedTreeCell(aTree) { + let tbo = aTree.treeBoxObject; + is(tbo.view.selection.count, 1, + "The test node should be successfully selected"); + // Get selection rowID. + let min = {}, max = {}; + tbo.view.selection.getRangeAt(0, min, max); + let rowID = min.value; + tbo.ensureRowIsVisible(rowID); + + // Calculate the click coordinates. + let x = {}, y = {}, width = {}, height = {}; + tbo.getCoordsForCellItem(rowID, aTree.columns[0], "text", + x, y, width, height); + x = x.value + width.value / 2; + y = y.value + height.value / 2; + // Simulate the click. + EventUtils.synthesizeMouse(aTree.body, x, y, {}, + aTree.ownerDocument.defaultView); + } + function changeSidebarDirection(aDirection) { - document.getElementById("sidebar") - .contentDocument - .documentElement - .style.direction = aDirection; + sidebar.contentDocument.documentElement.style.direction = aDirection; + } + + function waitForClearHistory(aCallback) { + Services.obs.addObserver(function(aSubject, aTopic, aData) { + Services.obs.removeObserver(arguments.callee, PlacesUtils.TOPIC_EXPIRATION_FINISHED); + aCallback(aSubject, aTopic, aData); + }, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false); + PlacesUtils.bhistory.removeAllPages(); } function runNextTest() { - // Remove any extraneous tabs. - for (let tabCount = gBrowser.tabContainer.childNodes.length; - tabCount > 1; tabCount--) { - gBrowser.selectedTab = gBrowser.tabContainer.childNodes[tabCount - 1]; - gBrowser.removeCurrentTab(); + // Remove eventual tabs created by previous sub-tests. + while (gBrowser.tabs.length > 1) { + gBrowser.removeTab(gBrowser.tabContainer.lastChild); } - if (tests.length == 0) + if (tests.length == 0) { finish(); + } else { - // Create a new tab for our test to use. + // Create a new tab and run the test. gBrowser.selectedTab = gBrowser.addTab(); - - // Now we can run our test. currentTest = tests.shift(); testPlacesPanel(function() { - changeSidebarDirection("ltr"); - info("Running " + currentTest.desc + " in LTR mode"); - }, function() { - executeSoon(function() { - testPlacesPanel(function() { - // Run the test in RTL mode. - changeSidebarDirection("rtl"); - info("Running " + currentTest.desc + " in RTL mode"); - }, function() { - executeSoon(runNextTest); - }); - }); - }); + changeSidebarDirection("ltr"); + info("Running " + currentTest.desc + " in LTR mode"); + }, + function() { + testPlacesPanel(function() { + // Run the test in RTL mode. + changeSidebarDirection("rtl"); + info("Running " + currentTest.desc + " in RTL mode"); + }, + function() { + runNextTest(); + }); + }); } } - runNextTest(); + // Ensure history is clean before starting the test. + waitForClearHistory(runNextTest); } From 3ba0e2f32cac0d7277102fd00ae2df0fe8cbaa7c Mon Sep 17 00:00:00 2001 From: Marco Bonardo Date: Thu, 3 Mar 2011 13:51:01 +0100 Subject: [PATCH 04/21] Bug 467997 - browser_sanitize-timespans.js random failure when crossing midnight. r=sdwilsh a=tests-only --- browser/base/content/test/browser_sanitize-timespans.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/browser/base/content/test/browser_sanitize-timespans.js b/browser/base/content/test/browser_sanitize-timespans.js index f7769017cedf..9b07c25a4ebe 100644 --- a/browser/base/content/test/browser_sanitize-timespans.js +++ b/browser/base/content/test/browser_sanitize-timespans.js @@ -283,7 +283,7 @@ function setupHistory() { let today = new Date(); today.setHours(0); today.setMinutes(0); - today.setSeconds(30); + today.setSeconds(1); bhist.addPageWithDetails(makeURI("http://today.com/"), "Today", today.valueOf() * 1000); let lastYear = new Date(); @@ -526,7 +526,7 @@ function setupDownloads() { let today = new Date(); today.setHours(0); today.setMinutes(0); - today.setSeconds(30); + today.setSeconds(1); data = { id: "5555554", From 0db68e3cd71c81be80b3f55cfa6e9d6239adc688 Mon Sep 17 00:00:00 2001 From: Marco Bonardo Date: Thu, 3 Mar 2011 13:51:03 +0100 Subject: [PATCH 05/21] Bug 551538 - intermittend timeout in browser_bookmarksProperties.js r=sdwilsh a=tests-only --- .../browser/browser_bookmarksProperties.js | 79 +++++++++---------- 1 file changed, 36 insertions(+), 43 deletions(-) diff --git a/browser/components/places/tests/browser/browser_bookmarksProperties.js b/browser/components/places/tests/browser/browser_bookmarksProperties.js index d666ca28c69d..f0e39c2e3efd 100644 --- a/browser/components/places/tests/browser/browser_bookmarksProperties.js +++ b/browser/components/places/tests/browser/browser_bookmarksProperties.js @@ -200,6 +200,7 @@ gTests.push({ itemType: null, window: null, _itemId: null, + _cleanShutdown: false, setup: function() { // Add a bookmark in unsorted bookmarks folder. @@ -222,31 +223,27 @@ gTests.push({ var tagsField = this.window.document.getElementById("editBMPanel_tagsField"); var self = this; - function windowObserver(aSubject, aTopic, aData) { - if (aTopic == "domwindowclosed" && - aSubject.QueryInterface(Ci.nsIDOMWindow).location == DIALOG_URL) { - ww.unregisterNotification(windowObserver); - tagsField.popup.removeEventListener("popuphidden", popupListener, true); - ok(false, "Dialog window should not be closed by pressing Enter on the autocomplete popup"); + this.window.addEventListener("unload", function(event) { + self.window.removeEventListener("unload", arguments.callee, true); + tagsField.popup.removeEventListener("popuphidden", popupListener, true); + ok(self._cleanShutdown, "Dialog window should not be closed by pressing Enter on the autocomplete popup"); + executeSoon(function () { self.finish(); - } - } + }); + }, true); var popupListener = { handleEvent: function(aEvent) { switch (aEvent.type) { case "popuphidden": // Everything worked fine, we can stop observing the window. - ww.unregisterNotification(windowObserver); - tagsField.popup.removeEventListener("popuphidden", this, true); + self._cleanShutdown = true; self.window.document.documentElement.cancelDialog(); - self.finish(); break; case "popupshown": tagsField.popup.removeEventListener("popupshown", this, true); - // In case this test fails the window will close, we should mark the - // failure and continue, to avoid timing out. - ww.registerNotification(windowObserver); + // In case this test fails the window will close, the test will fail + // since we didn't set _cleanShutdown. var tree = tagsField.popup.tree; // Focus and select first result. isnot(tree, null, "Autocomplete results tree exists"); @@ -318,12 +315,14 @@ gTests.push({ var namePicker = this.window.document.getElementById("editBMPanel_namePicker"); var userEnteredName = this.window.document.getElementById("editBMPanel_userEnteredName"); var self = this; + this.window.addEventListener("unload", function(event) { - this.window.removeEventListener("unload", arguments.callee, false); - executeSoon(function() { - self.finish(); - }); - }, false); + self.window.removeEventListener("unload", arguments.callee, false); + executeSoon(function () { + self.finish(); + }); + }, false); + namePicker.value = "n"; userEnteredName.label = "n"; info("About to focus the namePicker field"); @@ -357,6 +356,7 @@ gTests.push({ itemType: null, window: null, _itemId: null, + _cleanShutdown: false, setup: function() { // Add a bookmark in unsorted bookmarks folder. @@ -379,31 +379,27 @@ gTests.push({ var tagsField = this.window.document.getElementById("editBMPanel_tagsField"); var self = this; - function windowObserver(aSubject, aTopic, aData) { - if (aTopic == "domwindowclosed" && - aSubject.QueryInterface(Ci.nsIDOMWindow).location == DIALOG_URL) { - ww.unregisterNotification(windowObserver); - tagsField.popup.removeEventListener("popuphidden", popupListener, true); - ok(false, "Dialog window should not be closed by pressing Escape on the autocomplete popup"); + this.window.addEventListener("unload", function(event) { + self.window.removeEventListener("unload", arguments.callee, true); + tagsField.popup.removeEventListener("popuphidden", popupListener, true); + ok(self._cleanShutdown, "Dialog window should not be closed by pressing Escape on the autocomplete popup"); + executeSoon(function () { self.finish(); - } - } + }); + }, true); var popupListener = { handleEvent: function(aEvent) { switch (aEvent.type) { case "popuphidden": - // Everything worked fine, we can stop observing the window. - ww.unregisterNotification(windowObserver); - tagsField.popup.removeEventListener("popuphidden", this, true); + // Everything worked fine. + self._cleanShutdown = true; self.window.document.documentElement.cancelDialog(); - self.finish(); break; case "popupshown": tagsField.popup.removeEventListener("popupshown", this, true); - // In case this test fails the window will close, we should mark the - // failure and continue, to avoid timing out. - ww.registerNotification(windowObserver); + // In case this test fails the window will close, the test will fail + // since we didn't set _cleanShutdown. var tree = tagsField.popup.tree; // Focus and select first result. isnot(tree, null, "Autocomplete results tree exists"); @@ -479,16 +475,13 @@ gTests.push({ var folderTree = this.window.document.getElementById("editBMPanel_folderTree"); var self = this; - function windowObserver(aSubject, aTopic, aData) { - if (aTopic == "domwindowclosed" && - aSubject.QueryInterface(Ci.nsIDOMWindow).location == DIALOG_URL_MINIMAL_UI) { - ww.unregisterNotification(windowObserver); - ok(self._cleanShutdown, - "Dialog window should not be closed by pressing ESC in folder name textbox"); + this.window.addEventListener("unload", function(event) { + self.window.removeEventListener("unload", arguments.callee, true); + ok(self._cleanShutdown, "Dialog window should not be closed by pressing ESC in folder name textbox"); + executeSoon(function () { self.finish(); - } - } - ww.registerNotification(windowObserver); + }); + }, true); folderTree.addEventListener("DOMAttrModified", function onDOMAttrModified(event) { if (event.attrName != "place") From 62659ff2e28098608b4ad4bf9f77c7d0f647d90b Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Thu, 3 Mar 2011 11:02:35 -0500 Subject: [PATCH 06/21] Bug 635068 - WebGL test array-unit-tests.html fails - r=jag, a=blocking2.0 --- content/canvas/src/WebGLContextValidate.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/canvas/src/WebGLContextValidate.cpp b/content/canvas/src/WebGLContextValidate.cpp index ca720a983b60..b88b519bab86 100644 --- a/content/canvas/src/WebGLContextValidate.cpp +++ b/content/canvas/src/WebGLContextValidate.cpp @@ -378,9 +378,9 @@ PRBool WebGLContext::ValidateTexFormatAndType(WebGLenum format, WebGLenum type, PRBool WebGLContext::ValidateAttribIndex(WebGLuint index, const char *info) { - if (index > mAttribBuffers.Length()) { + if (index >= mAttribBuffers.Length()) { if (index == WebGLuint(-1)) { - ErrorInvalidValue("%s: index -1 is invalid. That probably comes from a getAttribLication() call, " + ErrorInvalidValue("%s: index -1 is invalid. That probably comes from a getAttribLocation() call, " "where this return value -1 means that the passed name didn't correspond to an active attribute in " "the specified program.", info); } else { From d6f13ef3b3a5c6d3299061f4e2dfefd9f8ca154c Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Thu, 3 Mar 2011 11:02:35 -0500 Subject: [PATCH 07/21] Bug 635068 - WebGL test array-unit-tests.html fails - r=dmandelin+vlad, a=blocking2.0 --- js/src/jstypedarray.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/src/jstypedarray.cpp b/js/src/jstypedarray.cpp index 15efef472669..8975fb124eab 100644 --- a/js/src/jstypedarray.cpp +++ b/js/src/jstypedarray.cpp @@ -1121,7 +1121,11 @@ class TypedArrayTemplate double d = v.toDouble(); if (!ArrayTypeIsFloatingPoint() && JS_UNLIKELY(JSDOUBLE_IS_NaN(d))) return NativeType(int32(0)); - return NativeType(d); + if (TypeIsFloatingPoint()) + return NativeType(d); + if (TypeIsUnsigned()) + return NativeType(js_DoubleToECMAUint32(d)); + return NativeType(js_DoubleToECMAInt32(d)); } if (v.isPrimitive() && !v.isMagic()) { From 10be2f2f4a158c0b768f6bcb738303035cfdc098 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Thu, 3 Mar 2011 11:02:36 -0500 Subject: [PATCH 08/21] Bug 635059 - Update WebGL test suite to version 1.0.0 from khronos.org - a=NPOTB --- content/canvas/test/webgl/00_test_list.txt | 10 +- content/canvas/test/webgl/README.mozilla | 21 +- content/canvas/test/webgl/README.txt | 28 ++ .../test/webgl/conformance/00_readme.txt | 0 .../test/webgl/conformance/00_test_list.txt | 17 +- .../webgl/conformance/array-unit-tests.html | 298 ++++++++++--- .../conformance/buffer-data-array-buffer.html | 9 + .../conformance/buffer-preserve-test.html | 85 ++++ .../test/webgl/conformance/canvas-test.html | 49 +-- .../test/webgl/conformance/constants.html | 5 - ...ributes-alpha-depth-stencil-antialias.html | 11 +- .../conformance/context-lost-restored.html | 130 ++++++ .../test/webgl/conformance/context-lost.html | 318 ++++++++++++++ .../copy-tex-image-and-sub-image-2d.html | 193 +++------ .../draw-elements-out-of-bounds.html | 36 +- .../gl-bind-attrib-location-test.html | 2 +- .../webgl/conformance/gl-drawelements.html | 0 .../conformance/gl-enable-enum-test.html | 0 .../test/webgl/conformance/gl-enum-tests.html | 1 - .../test/webgl/conformance/gl-get-calls.html | 19 +- .../webgl/conformance/gl-getshadersource.html | 45 ++ .../webgl/conformance/gl-min-attribs.html | 91 ++++ .../conformance/gl-min-textures-unroll.html | 86 ++++ .../webgl/conformance/gl-min-textures.html | 81 ++++ .../webgl/conformance/gl-min-uniforms.html | 120 ++++++ .../conformance/gl-object-get-calls.html | 18 +- .../webgl/conformance/gl-pixelstorei.html | 0 .../test/webgl/conformance/gl-teximage.html | 121 ++++-- .../webgl/conformance/gl-uniform-arrays.html | 57 ++- .../webgl/conformance/gl-uniform-bool.html | 2 +- .../conformance/gl-uniformmatrix4fv.html | 13 +- .../gl-vertex-attrib-zero-issues.html | 97 +++++ .../conformance/gl-vertexattribpointer.html | 90 +++- .../webgl/conformance/glsl-conformance.html | 141 +++++- .../canvas/test/webgl/conformance/include.vs | 4 + .../webgl/conformance/index-validation.html | 2 + .../webgl/conformance/instanceof-test.html | 97 +++++ .../conformance/invalid-passed-params.html | 116 +++++ .../{ => conformance}/more/00_test_list.txt | 8 +- .../webgl/{ => conformance}/more/README.md | 0 .../{ => conformance}/more/all_tests.html | 0 .../more/all_tests_linkonly.html | 0 .../more/all_tests_sequential.html | 0 .../conformance/badArgsArityLessThanArgc.html | 0 .../more/conformance/constants.html | 18 +- .../more/conformance/fuzzTheAPI.html | 0 .../more/conformance/getContext.html | 14 +- .../more/conformance/methods.html | 5 +- .../more/conformance/quickCheckAPI.html | 0 .../more/conformance/quickCheckAPI.js | 0 .../conformance/quickCheckAPIBadArgs.html | 0 .../more/conformance/webGLArrays.html | 0 .../more/demos/opengl_web.html | 0 .../{ => conformance}/more/demos/video.html | 0 .../more/functions/bindBuffer.html | 0 .../more/functions/bindBufferBadArgs.html | 0 .../bindFramebufferLeaveNonZero.html | 0 .../more/functions/bufferData.html | 0 .../more/functions/bufferDataBadArgs.html | 4 +- .../more/functions/bufferSubData.html | 0 .../more/functions/bufferSubDataBadArgs.html | 0 .../more/functions/copyTexImage2D.html | 0 .../more/functions/copyTexImage2DBadArgs.html | 0 .../more/functions/copyTexSubImage2D.html | 0 .../functions/copyTexSubImage2DBadArgs.html | 0 .../more/functions/deleteBufferBadArgs.html | 2 +- .../more/functions/drawArrays.html | 0 .../more/functions/drawArraysOutOfBounds.html | 20 +- .../more/functions/drawElements.html | 0 .../more/functions/drawElementsBadArgs.html | 14 +- .../more/functions/isTests.html | 0 .../more/functions/readPixels.html | 3 - .../more/functions/readPixelsBadArgs.html | 0 .../more/functions/texImage2D.html | 0 .../more/functions/texImage2DBadArgs.html | 0 .../more/functions/texImage2DHTML.html | 0 .../more/functions/texImage2DHTMLBadArgs.html | 0 .../more/functions/texSubImage2D.html | 0 .../more/functions/texSubImage2DBadArgs.html | 4 +- .../more/functions/texSubImage2DHTML.html | 0 .../functions/texSubImage2DHTMLBadArgs.html | 12 +- .../more/functions/uniformMatrix.html | 0 .../more/functions/uniformMatrixBadArgs.html | 28 +- .../more/functions/uniformf.html | 0 .../more/functions/uniformfArrayLen1.html | 95 +++++ .../more/functions/uniformfBadArgs.html | 9 +- .../more/functions/uniformi.html | 0 .../more/functions/uniformiBadArgs.html | 9 +- .../more/functions/vertexAttrib.html | 0 .../more/functions/vertexAttribBadArgs.html | 4 - .../more/functions/vertexAttribPointer.html | 0 .../functions/vertexAttribPointerBadArgs.html | 0 .../more/glsl/arrayOutOfBounds.html | 50 ++- .../more/glsl/longLoops.html | 0 .../more/glsl/uniformOutOfBounds.html | 0 .../more/glsl/unusedAttribsUniforms.html | 0 .../webgl/{ => conformance}/more/index.html | 0 .../more/performance/CPUvsGPU.html | 0 .../more/performance/bandwidth.html | 0 .../more/performance/jsGCPause.html | 0 .../more/performance/jsMatrixMult.html | 0 .../more/performance/jsToGLOverhead.html | 0 .../webgl/{ => conformance}/more/unit.css | 9 +- .../test/webgl/{ => conformance}/more/unit.js | 59 ++- .../test/webgl/{ => conformance}/more/util.js | 0 .../conformance/null-object-behaviour.html | 8 +- .../object-deletion-behaviour.html | 49 +++ .../conformance/oes-standard-derivatives.html | 376 ++++++++++++++++ .../webgl/conformance/oes-texture-float.html | 226 ++++++++++ .../conformance/oes-vertex-array-object.html | 400 ++++++++++++++++++ .../test/webgl/conformance/program-test.html | 28 +- .../webgl/conformance/read-pixels-test.html | 309 ++++++++------ .../conformance/resource-sharing-test.html | 0 .../resources/boolUniformShader.vert | 2 +- .../resources/floatUniformShader.vert | 2 +- .../conformance/resources/fragmentShader.frag | 2 +- .../resources/gray-ramp-default-gamma.png | Bin .../resources/gray-ramp-gamma0.1.png | Bin .../resources/gray-ramp-gamma1.0.png | Bin .../resources/gray-ramp-gamma2.0.png | Bin .../resources/gray-ramp-gamma4.0.png | Bin .../resources/gray-ramp-gamma9.0.png | Bin .../webgl/conformance/resources/gray-ramp.png | Bin .../resources/intUniformShader.vert | 2 +- .../resources/matUniformShader.vert | 2 +- .../resources/noopUniformShader.frag | 2 +- .../resources/noopUniformShader.vert | 4 + .../conformance/resources/red-indexed.png | Bin 0 -> 168 bytes .../resources/samplerUniformShader.frag | 8 + .../resources/structUniformShader.vert | 2 +- .../webgl/conformance/resources/testrunner.js | 101 ----- .../conformance/resources/vertexShader.vert | 2 +- .../conformance/resources/webgl-test-utils.js | 35 +- .../conformance/resources/zero-alpha.png | Bin .../webgl/conformance/shaders/00_shaders.txt | 1 + .../conformance/shaders/misc/00_shaders.txt | 3 + .../shaders/misc/non-ascii-comments.vert | 9 + .../conformance/shaders/misc/non-ascii.vert | 8 + ...mage-and-sub-image-2d-with-image-data.html | 12 +- ...tex-image-and-sub-image-2d-with-image.html | 12 +- ...tex-image-and-sub-image-2d-with-video.html | 25 +- .../tex-image-with-format-and-type.html | 12 +- .../conformance/tex-input-validation.html | 145 +++++-- .../tex-sub-image-2d-bad-args.html | 65 +++ .../conformance/texture-active-bind-2.html | 7 +- .../conformance/texture-active-bind.html | 0 .../webgl/conformance/texture-complete.html | 2 +- .../conformance/texture-formats-test.html | 0 .../test/webgl/conformance/texture-npot.html | 0 ...exture-transparent-pixels-initialized.html | 12 +- .../webgl/conformance/uniform-location.html | 12 + .../webgl/conformance/uninitialized-test.html | 146 +++++-- .../viewport-unchanged-upon-resize.html | 47 +- .../webgl/conformance/webgl-specific.html | 134 +++--- .../test/webgl/delete-quickCheckAPI.patch | 19 + .../test/webgl/disable-gl-min-textures.patch | 24 ++ .../webgl/dont-load-image-from-internet.patch | 148 +++++++ .../canvas/test/webgl/extra/webgl-info.html | 79 ++++ .../canvas/test/webgl/failing_tests_linux.txt | 19 +- .../canvas/test/webgl/failing_tests_mac.txt | 21 +- .../test/webgl/failing_tests_windows.txt | 21 +- .../test/webgl/increase-timeout-delays.patch | 38 ++ .../test/webgl/more/00_testFIXME_list.txt | 52 --- .../webgl/more/functions/getImageData.html | 92 ---- .../more/functions/getImageDataBadArgs.html | 92 ---- .../more/functions/linkProgramBadArgs.html | 59 --- .../webgl/resources/desktop-gl-constants.js | 0 .../test/webgl/resources/js-test-pre.js | 15 + .../webgl/resources/webgl-test-harness.js | 2 +- .../test_webgl_conformance_test_suite.html | 4 +- .../test/webgl/webgl-conformance-tests.html | 75 +++- 171 files changed, 4492 insertions(+), 1260 deletions(-) create mode 100644 content/canvas/test/webgl/README.txt mode change 100755 => 100644 content/canvas/test/webgl/conformance/00_readme.txt create mode 100644 content/canvas/test/webgl/conformance/buffer-preserve-test.html mode change 100755 => 100644 content/canvas/test/webgl/conformance/canvas-test.html create mode 100644 content/canvas/test/webgl/conformance/context-lost-restored.html create mode 100644 content/canvas/test/webgl/conformance/context-lost.html mode change 100755 => 100644 content/canvas/test/webgl/conformance/gl-bind-attrib-location-test.html mode change 100755 => 100644 content/canvas/test/webgl/conformance/gl-drawelements.html mode change 100755 => 100644 content/canvas/test/webgl/conformance/gl-enable-enum-test.html mode change 100755 => 100644 content/canvas/test/webgl/conformance/gl-enum-tests.html create mode 100644 content/canvas/test/webgl/conformance/gl-getshadersource.html create mode 100644 content/canvas/test/webgl/conformance/gl-min-attribs.html create mode 100644 content/canvas/test/webgl/conformance/gl-min-textures-unroll.html create mode 100644 content/canvas/test/webgl/conformance/gl-min-textures.html create mode 100644 content/canvas/test/webgl/conformance/gl-min-uniforms.html mode change 100755 => 100644 content/canvas/test/webgl/conformance/gl-pixelstorei.html mode change 100755 => 100644 content/canvas/test/webgl/conformance/gl-teximage.html mode change 100755 => 100644 content/canvas/test/webgl/conformance/gl-uniformmatrix4fv.html create mode 100644 content/canvas/test/webgl/conformance/gl-vertex-attrib-zero-issues.html mode change 100755 => 100644 content/canvas/test/webgl/conformance/gl-vertexattribpointer.html mode change 100755 => 100644 content/canvas/test/webgl/conformance/glsl-conformance.html create mode 100644 content/canvas/test/webgl/conformance/include.vs create mode 100644 content/canvas/test/webgl/conformance/instanceof-test.html rename content/canvas/test/webgl/{ => conformance}/more/00_test_list.txt (86%) rename content/canvas/test/webgl/{ => conformance}/more/README.md (100%) rename content/canvas/test/webgl/{ => conformance}/more/all_tests.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/all_tests_linkonly.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/all_tests_sequential.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/conformance/badArgsArityLessThanArgc.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/conformance/constants.html (97%) rename content/canvas/test/webgl/{ => conformance}/more/conformance/fuzzTheAPI.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/conformance/getContext.html (65%) rename content/canvas/test/webgl/{ => conformance}/more/conformance/methods.html (98%) rename content/canvas/test/webgl/{ => conformance}/more/conformance/quickCheckAPI.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/conformance/quickCheckAPI.js (100%) rename content/canvas/test/webgl/{ => conformance}/more/conformance/quickCheckAPIBadArgs.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/conformance/webGLArrays.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/demos/opengl_web.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/demos/video.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/functions/bindBuffer.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/functions/bindBufferBadArgs.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/functions/bindFramebufferLeaveNonZero.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/functions/bufferData.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/functions/bufferDataBadArgs.html (94%) rename content/canvas/test/webgl/{ => conformance}/more/functions/bufferSubData.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/functions/bufferSubDataBadArgs.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/functions/copyTexImage2D.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/functions/copyTexImage2DBadArgs.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/functions/copyTexSubImage2D.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/functions/copyTexSubImage2DBadArgs.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/functions/deleteBufferBadArgs.html (94%) rename content/canvas/test/webgl/{ => conformance}/more/functions/drawArrays.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/functions/drawArraysOutOfBounds.html (97%) rename content/canvas/test/webgl/{ => conformance}/more/functions/drawElements.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/functions/drawElementsBadArgs.html (93%) rename content/canvas/test/webgl/{ => conformance}/more/functions/isTests.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/functions/readPixels.html (92%) rename content/canvas/test/webgl/{ => conformance}/more/functions/readPixelsBadArgs.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/functions/texImage2D.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/functions/texImage2DBadArgs.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/functions/texImage2DHTML.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/functions/texImage2DHTMLBadArgs.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/functions/texSubImage2D.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/functions/texSubImage2DBadArgs.html (96%) rename content/canvas/test/webgl/{ => conformance}/more/functions/texSubImage2DHTML.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/functions/texSubImage2DHTMLBadArgs.html (89%) rename content/canvas/test/webgl/{ => conformance}/more/functions/uniformMatrix.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/functions/uniformMatrixBadArgs.html (84%) rename content/canvas/test/webgl/{ => conformance}/more/functions/uniformf.html (100%) create mode 100644 content/canvas/test/webgl/conformance/more/functions/uniformfArrayLen1.html rename content/canvas/test/webgl/{ => conformance}/more/functions/uniformfBadArgs.html (89%) rename content/canvas/test/webgl/{ => conformance}/more/functions/uniformi.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/functions/uniformiBadArgs.html (89%) rename content/canvas/test/webgl/{ => conformance}/more/functions/vertexAttrib.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/functions/vertexAttribBadArgs.html (95%) rename content/canvas/test/webgl/{ => conformance}/more/functions/vertexAttribPointer.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/functions/vertexAttribPointerBadArgs.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/glsl/arrayOutOfBounds.html (89%) rename content/canvas/test/webgl/{ => conformance}/more/glsl/longLoops.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/glsl/uniformOutOfBounds.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/glsl/unusedAttribsUniforms.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/index.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/performance/CPUvsGPU.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/performance/bandwidth.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/performance/jsGCPause.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/performance/jsMatrixMult.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/performance/jsToGLOverhead.html (100%) rename content/canvas/test/webgl/{ => conformance}/more/unit.css (95%) rename content/canvas/test/webgl/{ => conformance}/more/unit.js (89%) rename content/canvas/test/webgl/{ => conformance}/more/util.js (100%) create mode 100644 content/canvas/test/webgl/conformance/oes-standard-derivatives.html create mode 100644 content/canvas/test/webgl/conformance/oes-texture-float.html create mode 100644 content/canvas/test/webgl/conformance/oes-vertex-array-object.html mode change 100755 => 100644 content/canvas/test/webgl/conformance/resource-sharing-test.html mode change 100755 => 100644 content/canvas/test/webgl/conformance/resources/gray-ramp-default-gamma.png mode change 100755 => 100644 content/canvas/test/webgl/conformance/resources/gray-ramp-gamma0.1.png mode change 100755 => 100644 content/canvas/test/webgl/conformance/resources/gray-ramp-gamma1.0.png mode change 100755 => 100644 content/canvas/test/webgl/conformance/resources/gray-ramp-gamma2.0.png mode change 100755 => 100644 content/canvas/test/webgl/conformance/resources/gray-ramp-gamma4.0.png mode change 100755 => 100644 content/canvas/test/webgl/conformance/resources/gray-ramp-gamma9.0.png mode change 100755 => 100644 content/canvas/test/webgl/conformance/resources/gray-ramp.png create mode 100644 content/canvas/test/webgl/conformance/resources/noopUniformShader.vert create mode 100644 content/canvas/test/webgl/conformance/resources/red-indexed.png create mode 100644 content/canvas/test/webgl/conformance/resources/samplerUniformShader.frag delete mode 100644 content/canvas/test/webgl/conformance/resources/testrunner.js mode change 100755 => 100644 content/canvas/test/webgl/conformance/resources/zero-alpha.png create mode 100644 content/canvas/test/webgl/conformance/shaders/misc/00_shaders.txt create mode 100644 content/canvas/test/webgl/conformance/shaders/misc/non-ascii-comments.vert create mode 100644 content/canvas/test/webgl/conformance/shaders/misc/non-ascii.vert create mode 100644 content/canvas/test/webgl/conformance/tex-sub-image-2d-bad-args.html mode change 100755 => 100644 content/canvas/test/webgl/conformance/texture-active-bind.html mode change 100755 => 100644 content/canvas/test/webgl/conformance/texture-complete.html mode change 100755 => 100644 content/canvas/test/webgl/conformance/texture-formats-test.html mode change 100755 => 100644 content/canvas/test/webgl/conformance/texture-npot.html create mode 100644 content/canvas/test/webgl/delete-quickCheckAPI.patch create mode 100644 content/canvas/test/webgl/disable-gl-min-textures.patch create mode 100644 content/canvas/test/webgl/dont-load-image-from-internet.patch create mode 100644 content/canvas/test/webgl/extra/webgl-info.html create mode 100644 content/canvas/test/webgl/increase-timeout-delays.patch delete mode 100644 content/canvas/test/webgl/more/00_testFIXME_list.txt delete mode 100644 content/canvas/test/webgl/more/functions/getImageData.html delete mode 100644 content/canvas/test/webgl/more/functions/getImageDataBadArgs.html delete mode 100644 content/canvas/test/webgl/more/functions/linkProgramBadArgs.html mode change 100755 => 100644 content/canvas/test/webgl/resources/desktop-gl-constants.js mode change 100755 => 100644 content/canvas/test/webgl/resources/webgl-test-harness.js diff --git a/content/canvas/test/webgl/00_test_list.txt b/content/canvas/test/webgl/00_test_list.txt index 56dec2b33977..a04e846d4134 100644 --- a/content/canvas/test/webgl/00_test_list.txt +++ b/content/canvas/test/webgl/00_test_list.txt @@ -1,5 +1,5 @@ -// files that end in .txt list other tests -// other lines are assumed to be .html files - -conformance/00_test_list.txt - +// files that end in .txt list other tests +// other lines are assumed to be .html files + +conformance/00_test_list.txt + diff --git a/content/canvas/test/webgl/README.mozilla b/content/canvas/test/webgl/README.mozilla index a481d2d15415..de4caffcdc8d 100644 --- a/content/canvas/test/webgl/README.mozilla +++ b/content/canvas/test/webgl/README.mozilla @@ -1,24 +1,13 @@ -This is a local copy of the WebGL conformance suite. - - SVN revision: 13113 +This is a local copy of the WebGL conformance suite, version 1.0.0. The canonical location for this testsuite is: - https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/tests/ + https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/conformance-suites/1.0.0/webgl-conformance-tests.html All files and directories in this directory, with the exceptions listed below, come from upstream and should not be modified without corresponding upstream fixes and/or a -patch file in the "patches" directory. The exceptions (the Mozilla-specific files) are: +patch file in this directory. The exceptions (the Mozilla-specific files) are: * README.mozilla (this file) - * failing_tests.txt + * failing_tests_*.txt * Makefile.in - * the "mozilla" directory, if any - * the "patches" directory, if any - -Moreover, the files named 00_test_list.txt are temporarily renamed to 00_testFIXME_list.txt to work around bug 584611, quote: -> In mochitest, we tell people that mochitests should start with test_. The -> actual truth is that we match anything with a test_ in it. - -The "mozilla" directory contains integration of this test suite into Mozilla's -testing system. - + * *.patch files, if any diff --git a/content/canvas/test/webgl/README.txt b/content/canvas/test/webgl/README.txt new file mode 100644 index 000000000000..1746d80cb8af --- /dev/null +++ b/content/canvas/test/webgl/README.txt @@ -0,0 +1,28 @@ +Welcome to the WebGL Conformance Test Suite +=========================================== + +This is the initial release of the WebGL conformance test suite. + +NOTE TO USERS: Unless you are a WebGL implementor, there is no need to submit +a conformance result using this process. Should you discover bugs in your +browser's WebGL implementation, either via this test suite or otherwise, +please report them to your browser vendor's bug tracking system. + +FOR WEBGL IMPLEMENTORS: Please follow the isntructions below to create +a formal conformance submission.' + +1) Open webgl-conformance-tests.html in your target browser + +2) Press the "run tests" button + +3) At the end of the run, press "display text summary" + +4) Verify that the User Agent and WebGL renderer strings identify your browser and target correctly. + +5) Copy the contents of the text summary (starting with "WebGL Conformance Test Results") and send via email to + --- NEED ADDRESS HERE --- @khronos.org + + +- Version 1.0.0 +- February 24, 2011 + diff --git a/content/canvas/test/webgl/conformance/00_readme.txt b/content/canvas/test/webgl/conformance/00_readme.txt old mode 100755 new mode 100644 diff --git a/content/canvas/test/webgl/conformance/00_test_list.txt b/content/canvas/test/webgl/conformance/00_test_list.txt index 7912f6548aed..887db90a42ea 100644 --- a/content/canvas/test/webgl/conformance/00_test_list.txt +++ b/content/canvas/test/webgl/conformance/00_test_list.txt @@ -4,9 +4,12 @@ array-unit-tests.html bad-arguments-test.html buffer-bind-test.html buffer-data-array-buffer.html +buffer-preserve-test.html canvas-test.html constants.html context-attributes-alpha-depth-stencil-antialias.html +context-lost-restored.html +context-lost.html context-type-test.html copy-tex-image-and-sub-image-2d.html draw-arrays-out-of-bounds.html @@ -24,7 +27,11 @@ gl-enum-tests.html gl-get-active-attribute.html gl-get-active-uniform.html gl-get-calls.html +gl-getshadersource.html gl-getstring.html +gl-min-attribs.html +# gl-min-textures.html +gl-min-uniforms.html gl-object-get-calls.html gl-pixelstorei.html gl-scissor-test.html @@ -35,8 +42,9 @@ gl-uniform-bool.html gl-uniformmatrix4fv.html gl-unknown-uniform.html gl-vertex-attrib.html +gl-vertex-attrib-zero-issues.html gl-vertexattribpointer.html -glsl-2types-of-textures-on-same-unit.html +#glsl-2types-of-textures-on-same-unit.html glsl-conformance.html incorrect-context-object-behaviour.html index-validation-copies-indices.html @@ -44,6 +52,7 @@ index-validation-crash-with-buffer-sub-data.html index-validation-verifies-too-many-indices.html index-validation-with-resized-buffer.html index-validation.html +instanceof-test.html invalid-UTF-16.html invalid-passed-params.html is-object.html @@ -52,6 +61,9 @@ more-than-65536-points.html null-object-behaviour.html null-uniform-location.html object-deletion-behaviour.html +oes-standard-derivatives.html +oes-texture-float.html +oes-vertex-array-object.html origin-clean-conformance.html point-size.html program-test.html @@ -67,6 +79,7 @@ tex-image-and-uniform-binding-bugs.html tex-image-with-format-and-type.html tex-image-with-invalid-data.html tex-input-validation.html +tex-sub-image-2d-bad-args.html tex-sub-image-2d.html texparameter-test.html texture-active-bind-2.html @@ -82,3 +95,5 @@ uniform-samplers-test.html uninitialized-test.html viewport-unchanged-upon-resize.html webgl-specific.html +more/00_test_list.txt + diff --git a/content/canvas/test/webgl/conformance/array-unit-tests.html b/content/canvas/test/webgl/conformance/array-unit-tests.html index 46015edb556f..e90a8d4c87d8 100644 --- a/content/canvas/test/webgl/conformance/array-unit-tests.html +++ b/content/canvas/test/webgl/conformance/array-unit-tests.html @@ -186,6 +186,95 @@ function testConstructWithTypedArrayOfSignedValues(type, name) { } } +// +// Test cases for integral types. +// Some JavaScript engines need separate copies of this code in order +// to exercise all of their optimized code paths. +// + +function testIntegralArrayTruncationBehavior(type, name, unsigned) { + running('test integral array truncation behavior for ' + name); + + var sourceData; + var expectedResults; + + if (unsigned) { + sourceData = [0.6, 10.6]; + expectedResults = [0, 10]; + } else { + sourceData = [0.6, 10.6, -0.6, -10.6]; + expectedResults = [0, 10, 0, -10]; + } + + var numIterations = 10; + var array = new type(numIterations); + + // The code block in each of the case statements below is identical, but some + // JavaScript engines need separate copies in order to exercise all of + // their optimized code paths. + + try { + switch (type) { + case Int8Array: + for (var ii = 0; ii < sourceData.length; ++ii) { + for (var jj = 0; jj < numIterations; ++jj) { + array[jj] = sourceData[ii]; + assertEq('Storing ' + sourceData[ii], expectedResults[ii], array[jj]); + } + } + break; + case Int16Array: + for (var ii = 0; ii < sourceData.length; ++ii) { + for (var jj = 0; jj < numIterations; ++jj) { + array[jj] = sourceData[ii]; + assertEq('Storing ' + sourceData[ii], expectedResults[ii], array[jj]); + } + } + break; + case Int32Array: + for (var ii = 0; ii < sourceData.length; ++ii) { + for (var jj = 0; jj < numIterations; ++jj) { + array[jj] = sourceData[ii]; + assertEq('Storing ' + sourceData[ii], expectedResults[ii], array[jj]); + } + } + break; + case Uint8Array: + for (var ii = 0; ii < sourceData.length; ++ii) { + for (var jj = 0; jj < numIterations; ++jj) { + array[jj] = sourceData[ii]; + assertEq('Storing ' + sourceData[ii], expectedResults[ii], array[jj]); + } + } + break; + case Uint16Array: + for (var ii = 0; ii < sourceData.length; ++ii) { + for (var jj = 0; jj < numIterations; ++jj) { + array[jj] = sourceData[ii]; + assertEq('Storing ' + sourceData[ii], expectedResults[ii], array[jj]); + } + } + break; + case Uint32Array: + for (var ii = 0; ii < sourceData.length; ++ii) { + for (var jj = 0; jj < numIterations; ++jj) { + array[jj] = sourceData[ii]; + assertEq('Storing ' + sourceData[ii], expectedResults[ii], array[jj]); + } + } + break; + default: + fail("Unhandled type"); + break; + } + + pass(); + } catch (e) { + fail(e); + } +} + + // // Test cases for both signed and unsigned types // @@ -314,8 +403,8 @@ function negativeTestSetFromArray(type, name) { } } -function testSlice(type, name) { - running('test ' + name + ' Slice'); +function testSubarray(type, name) { + running('test ' + name + ' Subarray'); try { var array = new type([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); var subarray = array.subarray(0, 5); @@ -334,8 +423,8 @@ function testSlice(type, name) { } } -function negativeTestSlice(type, name) { - running('negativeTest ' + name + ' Slice'); +function negativeTestSubarray(type, name) { + running('negativeTest ' + name + ' Subarray'); try { var array = new type([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); subarray = array.subarray(5, 11); @@ -354,17 +443,31 @@ function negativeTestSlice(type, name) { } } -function testBoundaryConditions(type, name, lowValue, expectedLowValue, highValue, expectedHighValue) { - running('test ' + name + ' BoundaryConditions(' + - lowValue + ', ' + expectedLowValue + ', ' + - highValue + ', ' + expectedHighValue + ')'); +function testSetBoundaryConditions(type, name, testValues, expectedValues) { + running('test ' + name + ' SetBoundaryConditions'); try { var array = new type(1); assertEq('Array length', 1, array.length); - array[0] = lowValue; - assertEq('Element 0', expectedLowValue, array[0]); - array[0] = highValue; - assertEq('Element 0', expectedHighValue, array[0]); + for (var ii = 0; ii < testValues.length; ++ii) { + for (var jj = 0; jj < 10; ++jj) { + array[0] = testValues[ii]; + assertEq('Element 0', expectedValues[ii], array[0]); + } + } + pass(); + } catch (e) { + fail(e); + } +} + +function testConstructionBoundaryConditions(type, name, testValues, expectedValues) { + running('test ' + name + ' ConstructionBoundaryConditions'); + try { + var array = new type(testValues); + assertEq('Array length', testValues.length, array.length); + for (var ii = 0; ii < testValues.length; ++ii) { + assertEq('Element ' + ii, expectedValues[ii], array[ii]); + } pass(); } catch (e) { fail(e); @@ -476,8 +579,8 @@ function testConstructionWithBothArrayBufferAndLength(type, name, elementSizeInB var array; var typeSize; -function testSlicingWithOutOfRangeValues(type, name, sz) { - debug("Testing slicing of " + name); +function testSubarrayWithOutOfRangeValues(type, name, sz) { + debug("Testing subarray of " + name); try { var buffer = new ArrayBuffer(32); array = new type(buffer); @@ -497,15 +600,15 @@ function testSlicingWithOutOfRangeValues(type, name, sz) { shouldBe("array.length", "0"); } } catch (e) { - testFailed("Slicing of " + name + " threw exception"); + testFailed("Subarray of " + name + " threw exception"); } } catch (e) { testFailed("Exception: " + e); } } -function testSlicingWithDefaultValues(type, name, sz) { - debug("Testing slicing with default inputs of " + name); +function testSubarrayWithDefaultValues(type, name, sz) { + debug("Testing subarray with default inputs of " + name); try { var buffer = new ArrayBuffer(32); array = new type(buffer); @@ -517,7 +620,7 @@ function testSlicingWithDefaultValues(type, name, sz) { shouldBe("array.subarray(-2).length", "2"); shouldBe("array.subarray(-2147483648).length", "(32 / typeSize)"); } catch (e) { - testFailed("Slicing of " + name + " threw exception"); + testFailed("Subarray of " + name + " threw exception"); } } catch (e) { testFailed("Exception: " + e); @@ -584,6 +687,81 @@ function negativeTestGetAndSetMethods(type, name) { } } +function testNaNConversion(type, name) { + running('test storing NaN in ' + name); + + var array = new type([1, 1]); + var results = []; + + // The code block in each of the case statements below is identical, but some + // JavaScript engines need separate copies in order to exercise all of + // their optimized code paths. + try { + switch (type) { + case Float32Array: + for (var i = 0; i < array.length; ++i) { + array[i] = NaN; + results[i] = array[i]; + } + break; + case Int8Array: + for (var i = 0; i < array.length; ++i) { + array[i] = NaN; + results[i] = array[i]; + } + break; + case Int16Array: + for (var i = 0; i < array.length; ++i) { + array[i] = NaN; + results[i] = array[i]; + } + break; + case Int32Array: + for (var i = 0; i < array.length; ++i) { + array[i] = NaN; + results[i] = array[i]; + } + break; + case Uint8Array: + for (var i = 0; i < array.length; ++i) { + array[i] = NaN; + results[i] = array[i]; + } + break; + case Uint16Array: + for (var i = 0; i < array.length; ++i) { + array[i] = NaN; + results[i] = array[i]; + } + break; + case Uint32Array: + for (var i = 0; i < array.length; ++i) { + array[i] = NaN; + results[i] = array[i]; + } + break; + default: + fail("Unhandled type"); + break; + } + + // Some types preserve NaN values; all other types convert NaN to zero. + if (type === Float32Array) { + assert('initial NaN preserved', isNaN(new type([NaN])[0])); + for (var i = 0; i < array.length; ++i) + assert('NaN preserved via setter', isNaN(results[i])); + } else { + assertEq('initial NaN converted to zero', 0, new type([NaN])[0]); + for (var i = 0; i < array.length; ++i) + assertEq('NaN converted to zero by setter', 0, results[i]); + } + + pass(); + } catch (e) { + fail(e); + } +} + // // Test driver // @@ -596,54 +774,54 @@ function runTests() { var testCases = [ {name: "Float32Array", unsigned: false, + integral: false, elementSizeInBytes: 4, - low: -500.5, - expectedLow: -500.5, - high: 500.5, - expectedHigh: 500.5}, + testValues: [ -500.5, 500.5 ], + expectedValues: [ -500.5, 500.5 ] + }, {name: "Int8Array", unsigned: false, + integral: true, elementSizeInBytes: 1, - low: -128, - expectedLow: -128, - high: 127, - expectedHigh: 127}, + testValues: [ -128, 127, -129, 128 ], + expectedValues: [ -128, 127, 127, -128 ] + }, {name: "Int16Array", unsigned: false, + integral: true, elementSizeInBytes: 2, - low: -32768, - expectedLow: -32768, - high: 32767, - expectedHigh: 32767}, + testValues: [ -32768, 32767, -32769, 32768 ], + expectedValues: [ -32768, 32767, 32767, -32768 ] + }, {name: "Int32Array", unsigned: false, + integral: true, elementSizeInBytes: 4, - low: -2147483648, - expectedLow: -2147483648, - high: 2147483647, - expectedHigh: 2147483647}, + testValues: [ -2147483648, 2147483647, -2147483649, 2147483648 ], + expectedValues: [ -2147483648, 2147483647, 2147483647, -2147483648 ] + }, {name: "Uint8Array", unsigned: true, + integral: true, elementSizeInBytes: 1, - low: 0, - expectedLow: 0, - high: 255, - expectedHigh: 255}, + testValues: [ 0, 255, -1, 256 ], + expectedValues: [ 0, 255, 255, 0 ] + }, {name: "Uint16Array", unsigned: true, + integral: true, elementSizeInBytes: 2, - low: 0, - expectedLow: 0, - high: 65535, - expectedHigh: 65535}, + testValues: [ 0, 65535, -1, 65536 ], + expectedValues: [ 0, 65535, 65535, 0 ] + }, {name: "Uint32Array", unsigned: true, + integral: true, elementSizeInBytes: 4, - low: 0, - expectedLow: 0, - high: 4294967295, - expectedHigh: 4294967295} ]; - + testValues: [ 0, 4294967295, -1, 4294967296 ], + expectedValues: [ 0, 4294967295, 4294967295, 0 ] + } + ]; for (var i = 0; i < testCases.length; i++) { var testCase = testCases[i]; running(testCase.name); @@ -662,20 +840,25 @@ function runTests() { testConstructWithArrayOfSignedValues(type, name); testConstructWithTypedArrayOfSignedValues(type, name); } + if (testCase.integral) { + testIntegralArrayTruncationBehavior(type, name, testCase.unsigned); + } testGetWithOutOfRangeIndices(type, name); testOffsetsAndSizes(type, name, testCase.elementSizeInBytes); testSetFromTypedArray(type, name); negativeTestSetFromTypedArray(type, name); testSetFromArray(type, name); negativeTestSetFromArray(type, name); - testSlice(type, name); - negativeTestSlice(type, name); - testBoundaryConditions(type, - name, - testCase.low, - testCase.expectedLow, - testCase.high, - testCase.expectedHigh); + testSubarray(type, name); + negativeTestSubarray(type, name); + testSetBoundaryConditions(type, + name, + testCase.testValues, + testCase.expectedValues); + testConstructionBoundaryConditions(type, + name, + testCase.testValues, + testCase.expectedValues); testConstructionWithNullBuffer(type, name); testConstructionWithOutOfRangeValues(type, name); testConstructionWithNegativeOutOfRangeValues(type, name); @@ -683,12 +866,13 @@ function runTests() { testConstructionWithUnalignedLength(type, name, testCase.elementSizeInBytes); testConstructionOfHugeArray(type, name, testCase.elementSizeInBytes); testConstructionWithBothArrayBufferAndLength(type, name, testCase.elementSizeInBytes); - testSlicingWithOutOfRangeValues(type, name, testCase.elementSizeInBytes); - testSlicingWithDefaultValues(type, name, testCase.elementSizeInBytes); + testSubarrayWithOutOfRangeValues(type, name, testCase.elementSizeInBytes); + testSubarrayWithDefaultValues(type, name, testCase.elementSizeInBytes); testSettingFromArrayWithOutOfRangeOffset(type, name); testSettingFromFakeArrayWithOutOfRangeLength(type, name); testSettingFromTypedArrayWithOutOfRangeOffset(type, name); negativeTestGetAndSetMethods(type, name); + testNaNConversion(type, name); } printSummary(); diff --git a/content/canvas/test/webgl/conformance/buffer-data-array-buffer.html b/content/canvas/test/webgl/conformance/buffer-data-array-buffer.html index 0be24dc7fb59..f4ac10b1c7bc 100644 --- a/content/canvas/test/webgl/conformance/buffer-data-array-buffer.html +++ b/content/canvas/test/webgl/conformance/buffer-data-array-buffer.html @@ -33,6 +33,9 @@ glErrorShouldBe(gl, gl.INVALID_OPERATION); gl.bindBuffer(gl.ARRAY_BUFFER, buf); glErrorShouldBe(gl, gl.NO_ERROR); +gl.bufferData(gl.ARRAY_BUFFER, -10, gl.STATIC_DRAW); +glErrorShouldBe(gl, gl.INVALID_VALUE); + // This should not crash, but the selection of the overload is ambiguous per Web IDL. gl.bufferData(gl.ARRAY_BUFFER, null, gl.STATIC_DRAW); gl.getError(); @@ -42,6 +45,12 @@ glErrorShouldBe(gl, gl.NO_ERROR); array = new ArrayBuffer(64); +gl.bufferSubData(gl.ARRAY_BUFFER, -10, array); +glErrorShouldBe(gl, gl.INVALID_VALUE); + +gl.bufferSubData(gl.ARRAY_BUFFER, -10, new Float32Array(8)); +glErrorShouldBe(gl, gl.INVALID_VALUE); + gl.bufferSubData(gl.ARRAY_BUFFER, 10, array); glErrorShouldBe(gl, gl.NO_ERROR); diff --git a/content/canvas/test/webgl/conformance/buffer-preserve-test.html b/content/canvas/test/webgl/conformance/buffer-preserve-test.html new file mode 100644 index 000000000000..2e869a351fac --- /dev/null +++ b/content/canvas/test/webgl/conformance/buffer-preserve-test.html @@ -0,0 +1,85 @@ + + + +WebGL required buffer clear behaviour test + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/content/canvas/test/webgl/conformance/canvas-test.html b/content/canvas/test/webgl/conformance/canvas-test.html old mode 100755 new mode 100644 index 8a0c740a851d..412bf69780c3 --- a/content/canvas/test/webgl/conformance/canvas-test.html +++ b/content/canvas/test/webgl/conformance/canvas-test.html @@ -29,6 +29,7 @@ description("This test ensures WebGL implementations interact correctly with the debug(""); debug("Canvas.getContext"); +var err; var canvas = document.getElementById("canvas"); var canvas2d = document.getElementById("canvas2d"); var ctx2d = canvas2d.getContext("2d"); @@ -158,40 +159,34 @@ if (!gl) { gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); checkCanvasContentIs(64, 128, 192, 255); gl.colorMask(0,0,0,0); + glErrorShouldBe(gl, gl.NO_ERROR, "No GL errors before resizing the canvas"); canvas.width = 400; canvas.height = 10; - - var v = gl.getParameter(gl.COLOR_CLEAR_VALUE); - assertMsg(isAboutEqual(v[0], 0.25) && - isAboutEqual(v[1], 0.5) && - isAboutEqual(v[2], 0.75) && - isAboutEqual(v[3], 1), - "gl.clearColor should not change after canvas resize"); - v = gl.getParameter(gl.COLOR_WRITEMASK); - assertMsg(isAboutEqual(v[0], 0) && - isAboutEqual(v[1], 0) && - isAboutEqual(v[2], 0) && - isAboutEqual(v[3], 0), - "gl.colorMask should not change after canvas resize"); - shouldBe('getViewport()', '"0,0,300,150"'); - checkCanvasContentIs(0, 0, 0, 0); + err = gl.getError(); + // Some implementations might lost the context when resizing + if (err != gl.CONTEXT_LOST_WEBGL) { + shouldBe("err", "gl.NO_ERROR"); + var v = gl.getParameter(gl.COLOR_CLEAR_VALUE); + assertMsg(isAboutEqual(v[0], 0.25) && + isAboutEqual(v[1], 0.5) && + isAboutEqual(v[2], 0.75) && + isAboutEqual(v[3], 1), + "gl.clearColor should not change after canvas resize"); + v = gl.getParameter(gl.COLOR_WRITEMASK); + assertMsg(isAboutEqual(v[0], 0) && + isAboutEqual(v[1], 0) && + isAboutEqual(v[2], 0) && + isAboutEqual(v[3], 0), + "gl.colorMask should not change after canvas resize"); + shouldBe('getViewport()', '"0,0,300,150"'); + checkCanvasContentIs(0, 0, 0, 0); + } debug(""); - successfullyParsed = true; - var epilogue = document.createElement("script"); - epilogue.onload = finish; - epilogue.src = "../resources/js-test-post.js"; - document.body.appendChild(epilogue); + finishTest(); } }, 1000/30); } - -function finish() { - if (window.nonKhronosFrameworkNotifyDone) { - window.nonKhronosFrameworkNotifyDone(); - } -} - diff --git a/content/canvas/test/webgl/conformance/constants.html b/content/canvas/test/webgl/conformance/constants.html index 380092b9abda..33a0222e352e 100644 --- a/content/canvas/test/webgl/conformance/constants.html +++ b/content/canvas/test/webgl/conformance/constants.html @@ -245,9 +245,7 @@ LINK_STATUS : 0x8B82, VALIDATE_STATUS : 0x8B83, ATTACHED_SHADERS : 0x8B85, ACTIVE_UNIFORMS : 0x8B86, -ACTIVE_UNIFORM_MAX_LENGTH : 0x8B87, ACTIVE_ATTRIBUTES : 0x8B89, -ACTIVE_ATTRIBUTE_MAX_LENGTH : 0x8B8A, SHADING_LANGUAGE_VERSION : 0x8B8C, CURRENT_PROGRAM : 0x8B8D, @@ -275,7 +273,6 @@ DECR_WRAP : 0x8508, VENDOR : 0x1F00, RENDERER : 0x1F01, VERSION : 0x1F02, -EXTENSIONS : 0x1F03, /* TextureMagFilter */ NEAREST : 0x2600, @@ -377,8 +374,6 @@ VERTEX_ATTRIB_ARRAY_BUFFER_BINDING : 0x889F, /* Shader Source */ COMPILE_STATUS : 0x8B81, -INFO_LOG_LENGTH : 0x8B84, -SHADER_SOURCE_LENGTH : 0x8B88, SHADER_COMPILER : 0x8DFA, /* Shader Precision-Specified Types */ diff --git a/content/canvas/test/webgl/conformance/context-attributes-alpha-depth-stencil-antialias.html b/content/canvas/test/webgl/conformance/context-attributes-alpha-depth-stencil-antialias.html index e97025f9ab4d..67e7a00d3f22 100644 --- a/content/canvas/test/webgl/conformance/context-attributes-alpha-depth-stencil-antialias.html +++ b/content/canvas/test/webgl/conformance/context-attributes-alpha-depth-stencil-antialias.html @@ -212,18 +212,9 @@ function runTest() testAntialias(true); testAntialias(false); - successfullyParsed = true; - var epilogue = document.createElement("script"); - epilogue.onload = finish; - epilogue.src = "../resources/js-test-post.js"; - document.body.appendChild(epilogue); + finishTest() } -function finish() { - if (window.nonKhronosFrameworkNotifyDone) { - window.nonKhronosFrameworkNotifyDone(); - } -} diff --git a/content/canvas/test/webgl/conformance/context-lost-restored.html b/content/canvas/test/webgl/conformance/context-lost-restored.html new file mode 100644 index 000000000000..56443a477998 --- /dev/null +++ b/content/canvas/test/webgl/conformance/context-lost-restored.html @@ -0,0 +1,130 @@ + + + + + + + + + +
+
+ + + diff --git a/content/canvas/test/webgl/conformance/context-lost.html b/content/canvas/test/webgl/conformance/context-lost.html new file mode 100644 index 000000000000..07305bbc7a59 --- /dev/null +++ b/content/canvas/test/webgl/conformance/context-lost.html @@ -0,0 +1,318 @@ + + + + + + + + + +
+
+ + + diff --git a/content/canvas/test/webgl/conformance/copy-tex-image-and-sub-image-2d.html b/content/canvas/test/webgl/conformance/copy-tex-image-and-sub-image-2d.html index fb0dfa7c3cb7..cc48ce91fa86 100644 --- a/content/canvas/test/webgl/conformance/copy-tex-image-and-sub-image-2d.html +++ b/content/canvas/test/webgl/conformance/copy-tex-image-and-sub-image-2d.html @@ -8,30 +8,7 @@ found in the LICENSE file. - - - + diff --git a/content/canvas/test/webgl/conformance/draw-elements-out-of-bounds.html b/content/canvas/test/webgl/conformance/draw-elements-out-of-bounds.html index 1084899f533f..7104d085a96a 100644 --- a/content/canvas/test/webgl/conformance/draw-elements-out-of-bounds.html +++ b/content/canvas/test/webgl/conformance/draw-elements-out-of-bounds.html @@ -117,13 +117,14 @@ context.enableVertexAttribArray(1); var ebo = context.createBuffer(); context.bindBuffer(context.ELEMENT_ARRAY_BUFFER, ebo); -context.bufferData(context.ELEMENT_ARRAY_BUFFER, new Uint16Array([ 0, 1, 2, - 1, 2, 0, - 2, 0, 1, - 200, 200, 200, - 0x7fff, 0x7fff, 0x7fff, - 0xffff, 0xffff, 0xffff ]), - context.STATIC_DRAW); +context.bufferData(context.ELEMENT_ARRAY_BUFFER, new Uint16Array( + [ 0, 1, 2, + 1, 2, 0, + 2, 0, 1, + 200, 200, 200, + 0x7fff, 0x7fff, 0x7fff, + 0xffff, 0xffff, 0xffff ]), + context.STATIC_DRAW); shouldGenerateGLError(context, context.NO_ERROR, "context.drawElements(context.TRIANGLES, 9, context.UNSIGNED_SHORT, 0)"); @@ -144,6 +145,27 @@ shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawElements( shouldGenerateGLError(context, context.NO_ERROR, "context.drawElements(context.TRIANGLES, 0, context.UNSIGNED_SHORT, 0)"); +// invalid operation with offset that's not a multiple of the type size +shouldGenerateGLError(context, context.NO_ERROR, "context.drawElements(context.TRIANGLES, 6, context.UNSIGNED_SHORT, 0)"); +shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawElements(context.TRIANGLES, 6, context.UNSIGNED_SHORT, 1)"); +shouldGenerateGLError(context, context.NO_ERROR, "context.drawElements(context.TRIANGLES, 6, context.UNSIGNED_SHORT, 2)"); + +// invalid operation if no buffer is bound to ELEMENT_ARRAY_BUFFER +context.bindBuffer(context.ELEMENT_ARRAY_BUFFER, null); +shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawElements(context.TRIANGLES, 6, context.UNSIGNED_SHORT, 0)"); +context.bindBuffer(context.ELEMENT_ARRAY_BUFFER, ebo); + +debug("") +debug("Test buffer setting attrib 0 to a buffer too small and disable it."); +var smallVBO = context.createBuffer(); +shouldBeNonNull('smallVBO'); +context.bindBuffer(context.ARRAY_BUFFER, smallVBO); +context.bufferData(context.ARRAY_BUFFER, 1, context.STATIC_DRAW); +context.vertexAttribPointer(0, 3, context.FLOAT, false, 0, 0x10); +context.disableVertexAttribArray(0); +shouldGenerateGLError(context, context.NO_ERROR, "context.drawElements(context.TRIANGLES, 6, context.UNSIGNED_SHORT, 2)"); +context.bindBuffer(context.ELEMENT_ARRAY_BUFFER, null); +shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawElements(context.TRIANGLES, 6, context.UNSIGNED_SHORT, 2)"); debug("") successfullyParsed = true; diff --git a/content/canvas/test/webgl/conformance/gl-bind-attrib-location-test.html b/content/canvas/test/webgl/conformance/gl-bind-attrib-location-test.html old mode 100755 new mode 100644 index de9836dc6b16..c947fea9b761 --- a/content/canvas/test/webgl/conformance/gl-bind-attrib-location-test.html +++ b/content/canvas/test/webgl/conformance/gl-bind-attrib-location-test.html @@ -125,7 +125,7 @@ function setBindLocations(colorLocation, positionLocation) { debug("vPosition:" + gl.getAttribLocation(program, "vPosition")) debug("vColor :" + gl.getAttribLocation(program, "vColor")) assertMsg(gl.getAttribLocation(program, "vPosition") == positionLocation, - "location of vPositon should be " + positionLocation); + "location of vPosition should be " + positionLocation); assertMsg(gl.getAttribLocation(program, "vColor") == colorLocation, "location of vColor should be " + colorLocation); diff --git a/content/canvas/test/webgl/conformance/gl-drawelements.html b/content/canvas/test/webgl/conformance/gl-drawelements.html old mode 100755 new mode 100644 diff --git a/content/canvas/test/webgl/conformance/gl-enable-enum-test.html b/content/canvas/test/webgl/conformance/gl-enable-enum-test.html old mode 100755 new mode 100644 diff --git a/content/canvas/test/webgl/conformance/gl-enum-tests.html b/content/canvas/test/webgl/conformance/gl-enum-tests.html old mode 100755 new mode 100644 index bfd8b8ff5bd6..7647883ef9f9 --- a/content/canvas/test/webgl/conformance/gl-enum-tests.html +++ b/content/canvas/test/webgl/conformance/gl-enum-tests.html @@ -55,7 +55,6 @@ if (!gl) { "gl.isEnabled(desktopGL['CLIP_PLANE0'])", "gl.isEnabled(desktopGL['POINT_SPRITE'])", "gl.pixelStorei(desktopGL['PACK_SWAP_BYTES'], 1)", - "gl.readPixels(0, 0, 1, 1, gl.ALPHA, gl.SHORT, buf)", ]; for (var ii = 0; ii < tests.length; ++ii) { eval(tests[ii]); diff --git a/content/canvas/test/webgl/conformance/gl-get-calls.html b/content/canvas/test/webgl/conformance/gl-get-calls.html index eacfd4c71407..894f6a1fd33e 100644 --- a/content/canvas/test/webgl/conformance/gl-get-calls.html +++ b/content/canvas/test/webgl/conformance/gl-get-calls.html @@ -122,10 +122,23 @@ else { shouldBe('context.getParameter(context.UNPACK_FLIP_Y_WEBGL)', 'false'); shouldBe('context.getParameter(context.UNPACK_PREMULTIPLY_ALPHA_WEBGL)', 'false'); shouldBe('context.getParameter(context.VIEWPORT)', '[0, 0, 2, 2]'); - shouldBeTrue('context.getParameter(context.MAX_FRAGMENT_UNIFORM_VECTORS) >= 16'); - shouldBeTrue('context.getParameter(context.MAX_VERTEX_UNIFORM_VECTORS) >= 128'); - shouldBeTrue('context.getParameter(context.MAX_VARYING_VECTORS) >= 8'); shouldBe('context.getParameter(context.NUM_COMPRESSED_TEXTURE_FORMATS)', '0'); + + shouldBeTrue('context.getParameter(context.MAX_COMBINED_TEXTURE_IMAGE_UNITS) >= 8'); + shouldBeTrue('context.getParameter(context.MAX_CUBE_MAP_TEXTURE_SIZE) >= 16'); + shouldBeTrue('context.getParameter(context.MAX_FRAGMENT_UNIFORM_VECTORS) >= 16'); + shouldBeTrue('context.getParameter(context.MAX_RENDERBUFFER_SIZE) >= 1'); + shouldBeTrue('context.getParameter(context.MAX_TEXTURE_IMAGE_UNITS) >= 8'); + shouldBeTrue('context.getParameter(context.MAX_TEXTURE_SIZE) >= 64'); + shouldBeTrue('context.getParameter(context.MAX_VARYING_VECTORS) >= 8'); + shouldBeTrue('context.getParameter(context.MAX_VERTEX_ATTRIBS) >= 8'); + shouldBeTrue('context.getParameter(context.MAX_VERTEX_TEXTURE_IMAGE_UNITS) >= 0'); + shouldBeTrue('context.getParameter(context.MAX_VERTEX_UNIFORM_VECTORS) >= 128'); + // Note: This requirement should be removed from the spec IMO. Many impelementations + // will be based on FBOs and FBOs might have a restriction smaller than the current screen size. + // especially if there are multiple screens. + shouldBeTrue('context.getParameter(context.MAX_VIEWPORT_DIMS)[0] >= window.screen.width'); + shouldBeTrue('context.getParameter(context.MAX_VIEWPORT_DIMS)[1] >= window.screen.height'); } debug(""); diff --git a/content/canvas/test/webgl/conformance/gl-getshadersource.html b/content/canvas/test/webgl/conformance/gl-getshadersource.html new file mode 100644 index 000000000000..073a5f4eabcb --- /dev/null +++ b/content/canvas/test/webgl/conformance/gl-getshadersource.html @@ -0,0 +1,45 @@ + + + + + + WebGL getShaderSource conformance test. + + + + + + + +
+
+ + + + + + + + + + + + diff --git a/content/canvas/test/webgl/conformance/gl-min-attribs.html b/content/canvas/test/webgl/conformance/gl-min-attribs.html new file mode 100644 index 000000000000..2dd128de85fa --- /dev/null +++ b/content/canvas/test/webgl/conformance/gl-min-attribs.html @@ -0,0 +1,91 @@ + + + + +WebGL the minimum number of attributes are supported. + + + + + + + +
+
+ + + + + + + + + + + + + diff --git a/content/canvas/test/webgl/conformance/gl-min-textures-unroll.html b/content/canvas/test/webgl/conformance/gl-min-textures-unroll.html new file mode 100644 index 000000000000..2783087ccde5 --- /dev/null +++ b/content/canvas/test/webgl/conformance/gl-min-textures-unroll.html @@ -0,0 +1,86 @@ + + + + +WebGL the minimum number of uniforms are supported. + + + + + + + +
+
+ + + + + + + + + + + + + diff --git a/content/canvas/test/webgl/conformance/gl-min-textures.html b/content/canvas/test/webgl/conformance/gl-min-textures.html new file mode 100644 index 000000000000..ab18e3427ae4 --- /dev/null +++ b/content/canvas/test/webgl/conformance/gl-min-textures.html @@ -0,0 +1,81 @@ + + + + +WebGL the minimum number of uniforms are supported. + + + + + + + +
+
+ + + + + + + + + + + + + diff --git a/content/canvas/test/webgl/conformance/gl-min-uniforms.html b/content/canvas/test/webgl/conformance/gl-min-uniforms.html new file mode 100644 index 000000000000..e3a1e8ad3e9c --- /dev/null +++ b/content/canvas/test/webgl/conformance/gl-min-uniforms.html @@ -0,0 +1,120 @@ + + + + +WebGL the minimum number of uniforms are supported. + + + + + + + +
+
+ + + + + + + + + + + + + + + + diff --git a/content/canvas/test/webgl/conformance/gl-object-get-calls.html b/content/canvas/test/webgl/conformance/gl-object-get-calls.html index da08bdc42d19..c2c966e45baf 100644 --- a/content/canvas/test/webgl/conformance/gl-object-get-calls.html +++ b/content/canvas/test/webgl/conformance/gl-object-get-calls.html @@ -10,7 +10,7 @@ are met: notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY +THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR @@ -116,12 +116,9 @@ shouldBe('gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_ATTACHME shouldBe('gl.getProgramParameter(standardProgram, gl.DELETE_STATUS)', 'false'); shouldBe('gl.getProgramParameter(standardProgram, gl.LINK_STATUS)', 'true'); shouldBe('typeof gl.getProgramParameter(standardProgram, gl.VALIDATE_STATUS)', '"boolean"'); -shouldBe('typeof gl.getProgramParameter(standardProgram, gl.INFO_LOG_LENGTH)', '"number"'); shouldBe('gl.getProgramParameter(standardProgram, gl.ATTACHED_SHADERS)', '2'); shouldBe('gl.getProgramParameter(standardProgram, gl.ACTIVE_ATTRIBUTES)', '2'); -shouldBeNonZero('gl.getProgramParameter(standardProgram, gl.ACTIVE_ATTRIBUTE_MAX_LENGTH)'); shouldBe('gl.getProgramParameter(standardProgram, gl.ACTIVE_UNIFORMS)', '1'); -shouldBeNonZero('gl.getProgramParameter(standardProgram, gl.ACTIVE_UNIFORM_MAX_LENGTH)'); // Test getRenderbufferParameter shouldBe('gl.getRenderbufferParameter(gl.RENDERBUFFER, gl.RENDERBUFFER_WIDTH)', '2'); @@ -144,8 +141,6 @@ shouldBeNonZero('gl.getRenderbufferParameter(gl.RENDERBUFFER, gl.RENDERBUFFER_AL shouldBe('gl.getShaderParameter(standardVert, gl.SHADER_TYPE)', 'gl.VERTEX_SHADER'); shouldBe('gl.getShaderParameter(standardVert, gl.DELETE_STATUS)', 'false'); shouldBe('gl.getShaderParameter(standardVert, gl.COMPILE_STATUS)', 'true'); -shouldBe('typeof gl.getShaderParameter(standardVert, gl.INFO_LOG_LENGTH)', '"number"'); -shouldBeNonZero('gl.getShaderParameter(standardVert, gl.SHADER_SOURCE_LENGTH)'); // Test getTexParameter gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); @@ -211,6 +206,17 @@ shouldBe('gl.getUniform(floatProgram, fvalLoc)', '11'); shouldBe('gl.getUniform(floatProgram, fval2Loc)', '[12, 13]'); shouldBe('gl.getUniform(floatProgram, fval3Loc)', '[14, 15, 16]'); shouldBe('gl.getUniform(floatProgram, fval4Loc)', '[17, 18, 19, 20]'); +// Sampler uniform variables +var samplerProgram = loadProgram(gl, "resources/noopUniformShader.vert", "resources/samplerUniformShader.frag"); +shouldBe('gl.getProgramParameter(samplerProgram, gl.LINK_STATUS)', 'true'); +var s2DValLoc = gl.getUniformLocation(samplerProgram, "s2D"); +var sCubeValLoc = gl.getUniformLocation(samplerProgram, "sCube"); +gl.useProgram(samplerProgram); +gl.uniform1i(s2DValLoc, 0); +gl.uniform1i(sCubeValLoc, 1); +glErrorShouldBe(gl, gl.NO_ERROR); +shouldBe('gl.getUniform(samplerProgram, s2DValLoc)', '0'); +shouldBe('gl.getUniform(samplerProgram, sCubeValLoc)', '1'); // Matrix uniform variables var matProgram = loadProgram(gl, "resources/matUniformShader.vert", "resources/noopUniformShader.frag"); shouldBe('gl.getProgramParameter(matProgram, gl.LINK_STATUS)', 'true'); diff --git a/content/canvas/test/webgl/conformance/gl-pixelstorei.html b/content/canvas/test/webgl/conformance/gl-pixelstorei.html old mode 100755 new mode 100644 diff --git a/content/canvas/test/webgl/conformance/gl-teximage.html b/content/canvas/test/webgl/conformance/gl-teximage.html old mode 100755 new mode 100644 index b16967301e25..b101a9addd3b --- a/content/canvas/test/webgl/conformance/gl-teximage.html +++ b/content/canvas/test/webgl/conformance/gl-teximage.html @@ -39,6 +39,7 @@ var imgURLs = [ 'resources/zero-alpha.png', 'resources/3x3.png', 'resources/blue-1x1.jpg', + 'resources/red-indexed.png', 'resources/green-2x2-16bit.png', 'resources/small-square-with-colorspin-profile.jpg', 'resources/small-square-with-colorspin-profile.png', @@ -89,19 +90,23 @@ function runTests(imgs) { color[0] + ", " + color[1] + ", " + color[2] + ", " + - color[3] + " was " + + color[3]; + var subMsg = " was " + buf[off + 0] + ", " + buf[off + 1] + ", " + buf[off + 2] + ", " + buf[off + 3]; - + // When running in WebKit's test harness, we don't want to print the + // pixel value when the test passes, because different machines might + // have different results and we record the text output. + var inDumpRenderTree = window.layoutTestController; for (var ii = 0; ii < 4; ++ii) { if (Math.abs(buf[off + ii] - color[ii]) > allowedRange) { - testFailed(msg); + testFailed(msg + subMsg); return; } } - testPassed(msg); + testPassed(msg + (inDumpRenderTree ? "" : subMsg)); } var tex = gl.createTexture(); @@ -207,44 +212,72 @@ function runTests(imgs) { debug(""); debug("check pixels are UN pre-multiplied"); - var canvas2d = document.createElement("canvas"); - canvas2d.width = 256; - canvas2d.height = 1; - //canvas2d.style.height = "40px"; - //var description = document.getElementById("description"); - //description.appendChild(canvas2d); - var ctx = canvas2d.getContext("2d"); - ctx.fillRect(0, 0, 256, 1); - ctx.drawImage(imgs['resources/gray-ramp-256-with-128-alpha.png'], 0, 0); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, canvas2d); - glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup."); - wtu.drawQuad(gl); - var ref = new Uint8Array(width * height * 4); - gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, ref); - var lt128Count = [0, 0, 0]; - var ge128Count = [0, 0, 0]; - for (var jj = 0; jj < width; ++jj) { - var off = jj * 4; - for (var cc = 0; cc < 3; ++cc) { - if (buf[off + cc] < 128) { - ++lt128Count[cc]; - } else { - ++ge128Count[cc]; + for (var ii = 0; ii < 2; ++ii) { + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + if (ii == 0) { + var canvas2d = document.createElement("canvas"); + canvas2d.width = 256; + canvas2d.height = 1; + var ctx = canvas2d.getContext("2d"); + ctx.drawImage(imgs['resources/gray-ramp-256-with-128-alpha.png'], 0, 0); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, canvas2d); + } else { + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, + imgs['resources/gray-ramp-256-with-128-alpha.png']); + } + glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup."); + wtu.drawQuad(gl); + var buf = new Uint8Array(width * height * 4); + gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf); + var lt128Count = [0, 0, 0]; + var ge128Count = [0, 0, 0]; + for (var jj = 0; jj < width; ++jj) { + var off = jj * 4; + for (var cc = 0; cc < 3; ++cc) { + if (buf[off + cc] < 128) { + ++lt128Count[cc]; + } else { + ++ge128Count[cc]; + } } } + // Not sure the exact count here because gamma does effect drawing into the + // canvas but it should be close to 50% so I'll pass 45% + for (var jj = 0; jj < 3; ++jj) { + assertMsg(ge128Count[jj] > 256 * 0.45, + "Half the pixels in channel " + jj + + " should be >= 128,128,128. found " + + ((ge128Count[jj] / 256) * 100).toFixed() + "%"); + assertMsg(lt128Count[jj] > 256 * 0.45, + "Half the pixels in channel " + jj + + " should be < 128,128,128. found " + + ((lt128Count[jj] / 256) * 100).toFixed() + "%"); + } } - // Not sure the exact count here because gamma does effect drawing into the - // canvas but it should be close to 50% so I'll pass 45% - for (var jj = 0; jj < 3; ++jj) { - assertMsg(ge128Count[jj] > 256 * 0.45, - "Half the pixels in channel " + jj + - " should be >= 128,128,128. found " + - ((ge128Count[jj] / 256) * 100).toFixed() + "%"); - assertMsg(lt128Count[jj] > 256 * 0.45, - "Half the pixels in channel " + jj + - " should be < 128,128,128. found " + - ((lt128Count[jj] / 256) * 100).toFixed() + "%"); - } + + debug(""); + debug("check canvas pixels are UN pre-multiplied"); + var canvas2d = document.createElement("canvas"); + canvas2d.width = 1; + canvas2d.height = 1; + var ctx = canvas2d.getContext("2d"); + ctx.fillStyle ="rgba(255,255,255,0.5)"; + ctx.fillRect(0, 0, 256, 1); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas2d); + wtu.drawQuad(gl); + gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf); + glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup."); + checkPixelRange(buf, 0, 0, [255, 255, 255, 127], 4); + + debug(""); + debug("check canvas pixels are pre-multiplied"); + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas2d); + wtu.drawQuad(gl); + gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf); + glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup."); + checkPixelRange(buf, 0, 0, [127, 127, 127, 127], 4); + debug(""); debug("check pixels are pre-multiplied"); @@ -355,6 +388,16 @@ function runTests(imgs) { assertMsg(same, "uploading PNGs with same data but various ICC profiles should generate the same results"); } + debug(""); + debug("check uploading of indexed PNG images"); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, + imgs['resources/red-indexed.png']); + glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup"); + wtu.drawQuad(gl); + gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf); + // The image should be red. + checkPixelRange(buf, middle, center, [ 255, 0, 0, 255 ], 10); + debug(""); successfullyParsed = true; shouldBeTrue("successfullyParsed"); diff --git a/content/canvas/test/webgl/conformance/gl-uniform-arrays.html b/content/canvas/test/webgl/conformance/gl-uniform-arrays.html index d2a790655677..3f939551ab6b 100644 --- a/content/canvas/test/webgl/conformance/gl-uniform-arrays.html +++ b/content/canvas/test/webgl/conformance/gl-uniform-arrays.html @@ -108,13 +108,14 @@ var typeInfos = [ return value === null ? 'null' : value.toString(); }, checkType: function(value) { - return typeof values === 'number'; + return typeof value === 'number'; }, checkValue: function(typeInfo, index, value) { return typeInfo.srcValues[index] == value; }, srcValues: [16, 15, 14], - srcValuesBad: [], + srcValuesLess: [], + srcValuesNonMultiple: null, }, { type: 'vec2', jsTypeOf: 'Float32Array', @@ -135,8 +136,9 @@ var typeInfos = [ return value === null ? 'null' : ("[" + value[0] + ", " + value[1] + "]"); }, checkType: function(value) { - return typeof values.length === 'number' && - values.length == 2; + return value && + typeof value.length === 'number' && + value.length == 2; }, checkValue: function(typeInfo, index, value) { return value !== null && @@ -144,7 +146,8 @@ var typeInfos = [ typeInfo.srcValues[index * 2 + 1] == value[1]; }, srcValues: [16, 15, 14, 13, 12, 11], - srcValuesBad: [16], + srcValuesLess: [16], + srcValuesNonMultiple: [16, 15, 14, 13, 12, 11, 10], }, { type: 'vec3', jsTypeOf: 'Float32Array', @@ -167,8 +170,9 @@ var typeInfos = [ ("[" + value[0] + ", " + value[1] + ", " + value[2] + "]"); }, checkType: function(value) { - return typeof values.length === 'number' && - values.length == 3; + return value && + typeof value.length === 'number' && + value.length == 3; }, checkValue: function(typeInfo, index, value) { return value !== null && @@ -177,7 +181,8 @@ var typeInfos = [ typeInfo.srcValues[index * 3 + 2] == value[2]; }, srcValues: [16, 15, 14, 13, 12, 11, 10, 9, 8], - srcValuesBad: [16, 15], + srcValuesLess: [16, 15], + srcValuesNonMultiple: [16, 15, 14, 13, 12, 11, 10, 9, 8, 7], }, { type: 'vec4', jsTypeOf: 'Float32Array', @@ -202,8 +207,9 @@ var typeInfos = [ ", " + value[2] + ", " + value[3] + "]"); }, checkType: function(value) { - return typeof values.length === 'number' && - values.length == 4; + return value && + typeof value.length === 'number' && + value.length == 4; }, checkValue: function(typeInfo, index, value) { return value !== null && @@ -213,7 +219,8 @@ var typeInfos = [ typeInfo.srcValues[index * 4 + 3] == value[3]; }, srcValues: [16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5], - srcValuesBad: [16, 15, 14], + srcValuesLess: [16, 15, 14], + srcValuesNonMultiple: [16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4], } ]; @@ -233,33 +240,39 @@ for (var tt = 0; tt < typeInfos.length; ++tt) { "uniform name is 'color[0]' not 'color' as per OpenGL ES 2.0.24 section 2.10"); var loc = gl.getUniformLocation(program, "color[0]"); var srcValues = typeInfo.srcValues; - var srcValuesBad = typeInfo.srcValuesBad; + var srcValuesLess = typeInfo.srcValuesLess; + var srcValuesNonMultiple = typeInfo.srcValuesNonMultiple; // Try setting the value before using the program gl[typeInfo.setter](loc, srcValues); glErrorShouldBe(gl, gl.INVALID_OPERATION, - "should fail if there is no current program"); + "should fail if there is no current program"); gl.useProgram(program); - gl[typeInfo.setter](loc, srcValuesBad); + gl[typeInfo.setter](loc, srcValuesLess); glErrorShouldBe(gl, gl.INVALID_VALUE, - "should fail with insufficient array size with gl." + typeInfo.setter); + "should fail with insufficient array size with gl." + typeInfo.setter); + if (srcValuesNonMultiple) { + gl[typeInfo.setter](loc, srcValuesNonMultiple); + glErrorShouldBe(gl, gl.INVALID_VALUE, + "should fail with non-multiple array size with gl." + typeInfo.setter); + } gl[typeInfo.setter](loc, srcValues); glErrorShouldBe(gl, gl.NO_ERROR, - "can set an array of uniforms with gl." + typeInfo.setter); + "can set an array of uniforms with gl." + typeInfo.setter); var values = gl.getUniform(program, loc); glErrorShouldBe(gl, gl.NO_ERROR, - "can call gl.getUniform"); + "can call gl.getUniform"); assertMsg(typeInfo.checkType(values), "gl.getUniform returns the correct type."); for (var ii = 0; ii < typeInfo.numSrcValues; ++ii) { var elemLoc = gl.getUniformLocation(program, "color[" + ii + "]"); glErrorShouldBe(gl, gl.NO_ERROR, - "can get location of element " + ii + - " of array from gl.getUniformLocation"); + "can get location of element " + ii + + " of array from gl.getUniformLocation"); var value = gl.getUniform(program, elemLoc); glErrorShouldBe(gl, gl.NO_ERROR, - "can get value of element " + ii + " of array from gl.getUniform"); + "can get value of element " + ii + " of array from gl.getUniform"); assertMsg(typeInfo.checkValue(typeInfo, ii, value), "value put in (" + typeInfo.srcValueAsString(ii, srcValues) + ") matches value pulled out (" + @@ -267,7 +280,7 @@ for (var tt = 0; tt < typeInfos.length; ++tt) { } typeInfo.invalidSet(loc); glErrorShouldBe(gl, gl.INVALID_OPERATION, - "using the wrong size of gl.Uniform fails"); + "using the wrong size of gl.Uniform fails"); var exceptionCaught = false; if (typeInfo.illegalSet) { try { @@ -280,7 +293,7 @@ for (var tt = 0; tt < typeInfos.length; ++tt) { gl.useProgram(null); glErrorShouldBe(gl, gl.NO_ERROR, - "can call gl.useProgram(null)"); + "can call gl.useProgram(null)"); } debug(""); successfullyParsed = true; diff --git a/content/canvas/test/webgl/conformance/gl-uniform-bool.html b/content/canvas/test/webgl/conformance/gl-uniform-bool.html index ed93024951ef..f757f48b7595 100644 --- a/content/canvas/test/webgl/conformance/gl-uniform-bool.html +++ b/content/canvas/test/webgl/conformance/gl-uniform-bool.html @@ -45,7 +45,7 @@ gl = initWebGL("example", "vshader", "fshader", [ "vPosition"], [ 0, 0, 0, 1 ], var loc = gl.getUniformLocation(gl.program, "color"); gl.uniform1f(loc, 1); glErrorShouldBe(gl, gl.NO_ERROR, - "should be able to set bool with gl.uniform1f"); + "should be able to set bool with gl.uniform1f"); debug(""); successfullyParsed = true; diff --git a/content/canvas/test/webgl/conformance/gl-uniformmatrix4fv.html b/content/canvas/test/webgl/conformance/gl-uniformmatrix4fv.html old mode 100755 new mode 100644 index 854df3e9a2c7..614bc62af466 --- a/content/canvas/test/webgl/conformance/gl-uniformmatrix4fv.html +++ b/content/canvas/test/webgl/conformance/gl-uniformmatrix4fv.html @@ -45,17 +45,24 @@ debug("Checking gl.uniformMatrix."); gl = initWebGL("example", "vshader", "fshader", [ "vPosition"], [ 0, 0, 0, 1 ], 1); for (var ii = 2; ii <= 4; ++ii) { var loc = gl.getUniformLocation(gl.program, "world" + ii); - var mat = []; + var matLess = []; for (var jj = 0; jj < ii; ++jj) { for (var ll = 0; ll < ii; ++ll) { if (jj == ii - 1 && ll == ii - 1) continue; - mat[jj * ii + ll] = (jj == ll) ? 1 : 0; + matLess[jj * ii + ll] = (jj == ll) ? 1 : 0; } } + var mat = matLess.concat([1]); + var matMore = mat.concat([1]); name = "uniformMatrix" + ii + "fv"; - gl[name](loc, false, mat); + gl[name](loc, false, matLess); glErrorShouldBe(gl, gl.INVALID_VALUE, "should fail with insufficient array size for " + name); + gl[name](loc, false, mat); + glErrorShouldBe(gl, gl.NO_ERROR, "should succeed with correct array size for " + name); + gl[name](loc, false, matMore); + glErrorShouldBe(gl, gl.INVALID_VALUE, "should fail with more than 1 array size for " + name); + mat[ii * ii - 1] = 1; gl[name](loc, false, mat); glErrorShouldBe(gl, gl.NO_ERROR, "can call " + name + "with transpose = false"); diff --git a/content/canvas/test/webgl/conformance/gl-vertex-attrib-zero-issues.html b/content/canvas/test/webgl/conformance/gl-vertex-attrib-zero-issues.html new file mode 100644 index 000000000000..fda08ac428c4 --- /dev/null +++ b/content/canvas/test/webgl/conformance/gl-vertex-attrib-zero-issues.html @@ -0,0 +1,97 @@ + + + + +WebGL Enable Vertex Attrib Zero Test + + + + + + + + +
+
+ + + + + + + + + + + + diff --git a/content/canvas/test/webgl/conformance/gl-vertexattribpointer.html b/content/canvas/test/webgl/conformance/gl-vertexattribpointer.html old mode 100755 new mode 100644 index 9822485b16b8..87991b18c538 --- a/content/canvas/test/webgl/conformance/gl-vertexattribpointer.html +++ b/content/canvas/test/webgl/conformance/gl-vertexattribpointer.html @@ -13,6 +13,7 @@ found in the LICENSE file. +
@@ -24,6 +25,7 @@ description("This test checks vertexAttribPointer behaviors in WebGL."); debug(""); debug("Canvas.getContext"); +var wtu = WebGLTestUtils; var gl = create3DContext(document.getElementById("canvas")); if (!gl) { testFailed("context does not exist"); @@ -33,19 +35,93 @@ if (!gl) { debug(""); debug("Checking gl.vertexAttribPointer."); + if (!gl.FIXED) { + gl.FIXED = 0x140C; + } + gl.vertexAttribPointer(0, 3, gl.FLOAT, 0, 0, 12); glErrorShouldBe(gl, gl.INVALID_OPERATION, "vertexAttribPointer should fail if no buffer is bound"); var vertexObject = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject); - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(512), gl.STATIC_DRAW); - gl.vertexAttribPointer(0, 1, gl.FLOAT, 0, 256, 0); - glErrorShouldBe(gl, gl.INVALID_VALUE, - "WebGL API supports vertex attribute data strides up to 255 bytes"); - gl.vertexAttribPointer(0, 1, gl.FLOAT, 0, 255, 0); - glErrorShouldBe(gl, gl.NO_ERROR, - "vertexAttribPointer with stride <= 255 should succeed"); + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(0), gl.STATIC_DRAW); + + gl.vertexAttribPointer(0, 1, gl.INT, 0, 0, 0); + glErrorShouldBe(gl, gl.INVALID_ENUM, + "vertexAttribPointer should not support INT"); + gl.vertexAttribPointer(0, 1, gl.UNSIGNED_INT, 0, 0, 0); + glErrorShouldBe(gl, gl.INVALID_ENUM, + "vertexAttribPointer should not support UNSIGNED_INT"); + gl.vertexAttribPointer(0, 1, gl.FIXED, 0, 0, 0); + glErrorShouldBe(gl, gl.INVALID_ENUM, + "vertexAttribPointer should not support FIXED"); + + function checkVertexAttribPointer( + gl, err, reason, size, type, normalize, stride, offset) { + gl.vertexAttribPointer(0, size, type, normalize, stride, offset); + glErrorShouldBe(gl, err, + "gl.vertexAttribPointer(0, " + size + + ", gl." + wtu.glEnumToString(gl, type) + + ", " + normalize + + ", " + stride + + ", " + offset + + ") should " + (err == gl.NO_ERROR ? "succeed " : "fail ") + reason); + } + + var types = [ + { type:gl.BYTE, bytesPerComponent: 1 }, + { type:gl.UNSIGNED_BYTE, bytesPerComponent: 1 }, + { type:gl.SHORT, bytesPerComponent: 2 }, + { type:gl.UNSIGNED_SHORT, bytesPerComponent: 2 }, + { type:gl.FLOAT, bytesPerComponent: 4 }, + ]; + + for (var ii = 0; ii < types.length; ++ii) { + var info = types[ii]; + debug(""); + for (var size = 1; size <= 4; ++size) { + debug(""); + debug("checking: " + wtu.glEnumToString(gl, info.type) + " with size " + size); + var bytesPerElement = size * info.bytesPerComponent; + var offsetSet = [ + 0, + 1, + info.bytesPerComponent - 1, + info.bytesPerComponent, + info.bytesPerComponent + 1, + info.bytesPerComponent * 2]; + for (var jj = 0; jj < offsetSet.length; ++jj) { + var offset = offsetSet[jj]; + for (var kk = 0; kk < offsetSet.length; ++kk) { + var stride = offsetSet[kk]; + var err = gl.NO_ERROR; + var reason = "" + if (offset % info.bytesPerComponent != 0) { + reason = "because offset is bad"; + err = gl.INVALID_OPERATION; + } + if (stride % info.bytesPerComponent != 0) { + reason = "because stride is bad"; + err = gl.INVALID_OPERATION; + } + checkVertexAttribPointer( + gl, err, reason, size, info.type, false, stride, offset); + } + var stride = Math.floor(255 / info.bytesPerComponent) * info.bytesPerComponent; + + if (offset == 0) { + checkVertexAttribPointer( + gl, gl.NO_ERROR, "at stride limit", + size, info.type, false, stride, offset); + checkVertexAttribPointer( + gl, gl.INVALID_VALUE, "over stride limit", + size, info.type, false, + stride + info.bytesPerComponent, offset); + } + } + } + } } debug(""); diff --git a/content/canvas/test/webgl/conformance/glsl-conformance.html b/content/canvas/test/webgl/conformance/glsl-conformance.html old mode 100755 new mode 100644 index f97eb1eb9296..f72a17e9c224 --- a/content/canvas/test/webgl/conformance/glsl-conformance.html +++ b/content/canvas/test/webgl/conformance/glsl-conformance.html @@ -100,6 +100,17 @@ void main() foo #endif + + + + + + diff --git a/content/canvas/test/webgl/conformance/instanceof-test.html b/content/canvas/test/webgl/conformance/instanceof-test.html new file mode 100644 index 000000000000..3e5aee4cce16 --- /dev/null +++ b/content/canvas/test/webgl/conformance/instanceof-test.html @@ -0,0 +1,97 @@ + + + + +WebGL instanceof test. + + + + + + + +
+
+ + + + + + + + + + + + + diff --git a/content/canvas/test/webgl/conformance/invalid-passed-params.html b/content/canvas/test/webgl/conformance/invalid-passed-params.html index 8eb23e79f041..c88a2dec8e05 100644 --- a/content/canvas/test/webgl/conformance/invalid-passed-params.html +++ b/content/canvas/test/webgl/conformance/invalid-passed-params.html @@ -38,18 +38,21 @@ description("Test for invalid passed parameters"); var context = create3DContext(); +debug(""); debug("Test createShader()"); shouldGenerateGLError(context, context.NO_ERROR, "context.createShader(context.FRAGMENT_SHADER)"); shouldGenerateGLError(context, context.NO_ERROR, "context.createShader(context.VERTEX_SHADER)"); shouldGenerateGLError(context, context.INVALID_ENUM, "context.createShader(0)"); shouldGenerateGLError(context, context.INVALID_ENUM, "context.createShader(context.TRIANGLES)"); +debug(""); debug("Test clear()"); shouldGenerateGLError(context, context.INVALID_VALUE, "context.clear(desktopGL['ACCUM_BUFFER_BIT'])"); shouldGenerateGLError(context, context.INVALID_VALUE, "context.clear(desktopGL['ACCUM_BUFFER_BIT'] | context.COLOR_BUFFER_BIT)"); shouldGenerateGLError(context, context.INVALID_VALUE, "context.clear(desktopGL['ACCUM_BUFFER_BIT'] | context.COLOR_BUFFER_BIT | context.DEPTH_BUFFER_BIT | context.STENCIL_BUFFER_BIT)"); shouldGenerateGLError(context, context.NO_ERROR, "context.clear(context.COLOR_BUFFER_BIT | context.DEPTH_BUFFER_BIT | context.STENCIL_BUFFER_BIT)"); +debug(""); debug("Test bufferData()"); var buffer = context.createBuffer(); shouldGenerateGLError(context, context.NO_ERROR, "context.bindBuffer(context.ARRAY_BUFFER, buffer)"); @@ -63,6 +66,119 @@ shouldGenerateGLError(context, context.INVALID_ENUM, "context.bufferData(context shouldGenerateGLError(context, context.INVALID_ENUM, "context.bufferData(context.ARRAY_BUFFER, 16, desktopGL['DYNAMIC_READ'])"); shouldGenerateGLError(context, context.INVALID_ENUM, "context.bufferData(context.ARRAY_BUFFER, 16, desktopGL['DYNAMIC_COPY'])"); +debug(""); +debug("Test {copy}Tex{Sub}Image2D with negative offset/width/height"); +var tex = context.createTexture(); +var pixels = new Uint8Array(2 * 2 * 4); +shouldGenerateGLError(context, context.NO_ERROR, "context.bindTexture(context.TEXTURE_2D, tex)"); +shouldGenerateGLError(context, context.INVALID_VALUE, "context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, -16, -16, 0, context.RGBA, context.UNSIGNED_BYTE, null)"); +shouldGenerateGLError(context, context.NO_ERROR, "context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 16, 16, 0, context.RGBA, context.UNSIGNED_BYTE, null)"); +shouldGenerateGLError(context, context.INVALID_VALUE, "context.texSubImage2D(context.TEXTURE_2D, 0, -1, -1, 2, 2, context.RGBA, context.UNSIGNED_BYTE, pixels)"); +shouldGenerateGLError(context, context.INVALID_VALUE, "context.texSubImage2D(context.TEXTURE_2D, 0, 0, 0, -1, -1, context.RGBA, context.UNSIGNED_BYTE, pixels)"); +shouldGenerateGLError(context, context.NO_ERROR, "context.texSubImage2D(context.TEXTURE_2D, 0, 0, 0, 2, 2, context.RGBA, context.UNSIGNED_BYTE, pixels)"); +shouldGenerateGLError(context, context.INVALID_VALUE, "context.copyTexImage2D(context.TEXTURE_2D, 0, context.RGBA, 0, 0, -1, -1, 0)"); +shouldGenerateGLError(context, context.NO_ERROR, "context.copyTexImage2D(context.TEXTURE_2D, 0, context.RGBA, 0, 0, 16, 16, 0)"); +shouldGenerateGLError(context, context.INVALID_VALUE, "context.copyTexSubImage2D(context.TEXTURE_2D, 0, -1, -1, 0, 0, 2, 2)"); +shouldGenerateGLError(context, context.INVALID_VALUE, "context.copyTexSubImage2D(context.TEXTURE_2D, 0, 0, 0, 0, 0, -1, -1)"); +shouldGenerateGLError(context, context.NO_ERROR, "context.copyTexSubImage2D(context.TEXTURE_2D, 0, 0, 0, 0, 0, 2, 2)"); + +debug(""); +debug("Test renderbufferStorage() with negative width/height"); +var renderbuffer = context.createRenderbuffer(); +shouldGenerateGLError(context, context.NO_ERROR, "context.bindRenderbuffer(context.RENDERBUFFER, renderbuffer)"); +shouldGenerateGLError(context, context.INVALID_VALUE, "context.renderbufferStorage(context.RENDERBUFFER, context.RGBA4, -2, -2)"); +shouldGenerateGLError(context, context.NO_ERROR, "context.renderbufferStorage(context.RENDERBUFFER, context.RGBA4, 16, 16)"); + +debug(""); +debug("Test scissor() with negative width/height"); +shouldGenerateGLError(context, context.INVALID_VALUE, "context.scissor(0, 0, -2, -2)"); +shouldGenerateGLError(context, context.NO_ERROR, "context.scissor(0, 0, 16, 16)"); + +debug(""); +debug("Test viewport() with negative width/height"); +shouldGenerateGLError(context, context.INVALID_VALUE, "context.viewport(0, 0, -2, -2)"); +shouldGenerateGLError(context, context.NO_ERROR, "context.viewport(0, 0, 16, 16)"); + +debug(""); +debug("Set up a program to test invalid characters"); +var invalidSet = ['"', '$', '`', '@', '\\', "'"]; +var validUniformName = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_1234567890"; +var validAttribName = "abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; +function generateShaderSource(opt_invalidIdentifierChar, opt_invalidCommentChar) { + var invalidIdentifierString = ""; + var invalidCommentString = ""; + if (opt_invalidIdentifierChar != undefined) { + invalidIdentifierString += opt_invalidIdentifierChar; + } + if (opt_invalidCommentChar != undefined) { + invalidCommentString += opt_invalidCommentChar; + } + return "uniform float " + validUniformName + invalidIdentifierString + ";\n" + + "varying float " + validAttribName + ";\n" + + "void main() {\n" + + validAttribName + " = " + validUniformName + ";\n" + + "gl_Position = vec4(0.0, 0.0, 0.0, 1.0); }\n"; + + "//.+-/*%<>[](){}^|&~=!:;,?# " + invalidCommentString; +} +var vShader = context.createShader(context.VERTEX_SHADER); +context.shaderSource(vShader, generateShaderSource()); +context.compileShader(vShader); +shouldBe("context.getError()", "context.NO_ERROR"); +var fShader = context.createShader(context.FRAGMENT_SHADER); +context.shaderSource(fShader, "precision highp float;\n" + + "varying float " + validAttribName + ";\n" + + "void main() {\n" + + "gl_FragColor = vec4(" + validAttribName + ", 0.0, 0.0, 1.0); }"); +context.compileShader(fShader); +shouldBe("context.getError()", "context.NO_ERROR"); +var program = context.createProgram(); +context.attachShader(program, vShader); +context.attachShader(program, fShader); +context.linkProgram(program); +shouldBeTrue("context.getProgramParameter(program, context.LINK_STATUS)"); +shouldBe("context.getError()", "context.NO_ERROR"); +context.bindAttribLocation(program, 1, validAttribName); +shouldBe("context.getError()", "context.NO_ERROR"); +context.getAttribLocation(program, validAttribName); +shouldBe("context.getError()", "context.NO_ERROR"); +context.getUniformLocation(program, validUniformName); +shouldBe("context.getError()", "context.NO_ERROR"); + +debug(""); +debug("Test shaderSource() with invalid characters"); +for (var i = 0; i < invalidSet.length; ++i) { + var validShaderSource = generateShaderSource(undefined, invalidSet[i]); + context.shaderSource(vShader, validShaderSource); + shouldBe("context.getError()", "context.NO_ERROR"); + var invalidShaderSource = generateShaderSource(invalidSet[i], undefined); + context.shaderSource(vShader, invalidShaderSource); + shouldBe("context.getError()", "context.INVALID_VALUE"); +} + +debug(""); +debug("Test bindAttribLocation() with invalid characters"); +for (var i = 0; i < invalidSet.length; ++i) { + var invalidName = validAttribName + invalidSet[i]; + context.bindAttribLocation(program, 1, invalidName); + shouldBe("context.getError()", "context.INVALID_VALUE"); +} + +debug(""); +debug("Test getAttribLocation() with invalid characters"); +for (var i = 0; i < invalidSet.length; ++i) { + var invalidName = validAttribName + invalidSet[i]; + context.getAttribLocation(program, invalidName); + shouldBe("context.getError()", "context.INVALID_VALUE"); +} + +debug(""); +debug("Test getUniformLocation() with invalid characters"); +for (var i = 0; i < invalidSet.length; ++i) { + var invalidName = validUniformName + invalidSet[i]; + context.getUniformLocation(program, invalidName); + shouldBe("context.getError()", "context.INVALID_VALUE"); +} + debug("") successfullyParsed = true; diff --git a/content/canvas/test/webgl/more/00_test_list.txt b/content/canvas/test/webgl/conformance/more/00_test_list.txt similarity index 86% rename from content/canvas/test/webgl/more/00_test_list.txt rename to content/canvas/test/webgl/conformance/more/00_test_list.txt index 529e70287b37..abed9da9c7aa 100644 --- a/content/canvas/test/webgl/more/00_test_list.txt +++ b/content/canvas/test/webgl/conformance/more/00_test_list.txt @@ -1,10 +1,7 @@ -conformance/badArgsArityLessThanArgc.html conformance/constants.html -# conformance/fuzzTheAPI.html // No interactive tests. conformance/getContext.html conformance/methods.html -conformance/quickCheckAPI.html -conformance/quickCheckAPIBadArgs.html +#conformance/quickCheckAPI.html conformance/webGLArrays.html functions/bindBuffer.html functions/bindBufferBadArgs.html @@ -22,8 +19,6 @@ functions/drawArrays.html functions/drawArraysOutOfBounds.html functions/drawElements.html functions/drawElementsBadArgs.html -functions/getImageData.html -functions/getImageDataBadArgs.html functions/isTests.html functions/readPixels.html functions/readPixelsBadArgs.html @@ -37,6 +32,7 @@ functions/texSubImage2DHTML.html functions/texSubImage2DHTMLBadArgs.html functions/uniformf.html functions/uniformfBadArgs.html +functions/uniformfArrayLen1.html functions/uniformi.html functions/uniformiBadArgs.html functions/uniformMatrix.html diff --git a/content/canvas/test/webgl/more/README.md b/content/canvas/test/webgl/conformance/more/README.md similarity index 100% rename from content/canvas/test/webgl/more/README.md rename to content/canvas/test/webgl/conformance/more/README.md diff --git a/content/canvas/test/webgl/more/all_tests.html b/content/canvas/test/webgl/conformance/more/all_tests.html similarity index 100% rename from content/canvas/test/webgl/more/all_tests.html rename to content/canvas/test/webgl/conformance/more/all_tests.html diff --git a/content/canvas/test/webgl/more/all_tests_linkonly.html b/content/canvas/test/webgl/conformance/more/all_tests_linkonly.html similarity index 100% rename from content/canvas/test/webgl/more/all_tests_linkonly.html rename to content/canvas/test/webgl/conformance/more/all_tests_linkonly.html diff --git a/content/canvas/test/webgl/more/all_tests_sequential.html b/content/canvas/test/webgl/conformance/more/all_tests_sequential.html similarity index 100% rename from content/canvas/test/webgl/more/all_tests_sequential.html rename to content/canvas/test/webgl/conformance/more/all_tests_sequential.html diff --git a/content/canvas/test/webgl/more/conformance/badArgsArityLessThanArgc.html b/content/canvas/test/webgl/conformance/more/conformance/badArgsArityLessThanArgc.html similarity index 100% rename from content/canvas/test/webgl/more/conformance/badArgsArityLessThanArgc.html rename to content/canvas/test/webgl/conformance/more/conformance/badArgsArityLessThanArgc.html diff --git a/content/canvas/test/webgl/more/conformance/constants.html b/content/canvas/test/webgl/conformance/more/conformance/constants.html similarity index 97% rename from content/canvas/test/webgl/more/conformance/constants.html rename to content/canvas/test/webgl/conformance/more/conformance/constants.html index bd4a684bbe51..df3ae870524c 100644 --- a/content/canvas/test/webgl/more/conformance/constants.html +++ b/content/canvas/test/webgl/conformance/more/conformance/constants.html @@ -165,7 +165,7 @@ UNSIGNED_SHORT : 0x1403, INT : 0x1404, UNSIGNED_INT : 0x1405, FLOAT : 0x1406, -FIXED : 0x140C, +//FIXED : 0x140C, DEPTH_COMPONENT : 0x1902, ALPHA : 0x1906, RGB : 0x1907, @@ -190,9 +190,7 @@ LINK_STATUS : 0x8B82, VALIDATE_STATUS : 0x8B83, ATTACHED_SHADERS : 0x8B85, ACTIVE_UNIFORMS : 0x8B86, -ACTIVE_UNIFORM_MAX_LENGTH : 0x8B87, ACTIVE_ATTRIBUTES : 0x8B89, -ACTIVE_ATTRIBUTE_MAX_LENGTH : 0x8B8A, SHADING_LANGUAGE_VERSION : 0x8B8C, CURRENT_PROGRAM : 0x8B8D, NEVER : 0x0200, @@ -213,7 +211,7 @@ DECR_WRAP : 0x8508, VENDOR : 0x1F00, RENDERER : 0x1F01, VERSION : 0x1F02, -EXTENSIONS : 0x1F03, +//EXTENSIONS : 0x1F03, NEAREST : 0x2600, LINEAR : 0x2601, NEAREST_MIPMAP_NEAREST : 0x2700, @@ -292,11 +290,9 @@ VERTEX_ATTRIB_ARRAY_TYPE : 0x8625, VERTEX_ATTRIB_ARRAY_NORMALIZED : 0x886A, VERTEX_ATTRIB_ARRAY_POINTER : 0x8645, VERTEX_ATTRIB_ARRAY_BUFFER_BINDING : 0x889F, -IMPLEMENTATION_COLOR_READ_TYPE : 0x8B9A, -IMPLEMENTATION_COLOR_READ_FORMAT : 0x8B9B, +//IMPLEMENTATION_COLOR_READ_TYPE : 0x8B9A, +//IMPLEMENTATION_COLOR_READ_FORMAT : 0x8B9B, COMPILE_STATUS : 0x8B81, -INFO_LOG_LENGTH : 0x8B84, -SHADER_SOURCE_LENGTH : 0x8B88, SHADER_COMPILER : 0x8DFA, LOW_FLOAT : 0x8DF0, MEDIUM_FLOAT : 0x8DF1, @@ -340,8 +336,8 @@ FRAMEBUFFER_BINDING : 0x8CA6, RENDERBUFFER_BINDING : 0x8CA7, MAX_RENDERBUFFER_SIZE : 0x84E8, INVALID_FRAMEBUFFER_OPERATION : 0x0506, -FALSE : 0, -TRUE : 1, +//FALSE : 0, +//TRUE : 1, UNPACK_FLIP_Y_WEBGL : 0x9240, UNPACK_PREMULTIPLY_ALPHA_WEBGL : 0x9241 } @@ -364,7 +360,7 @@ Tests.testOES20Constants = function(gl) { } } } - + Tests.startUnit = function() { var canvas = document.getElementById('gl'); var gl = wrapGLContext(canvas.getContext(GL_CONTEXT_ID)); diff --git a/content/canvas/test/webgl/more/conformance/fuzzTheAPI.html b/content/canvas/test/webgl/conformance/more/conformance/fuzzTheAPI.html similarity index 100% rename from content/canvas/test/webgl/more/conformance/fuzzTheAPI.html rename to content/canvas/test/webgl/conformance/more/conformance/fuzzTheAPI.html diff --git a/content/canvas/test/webgl/more/conformance/getContext.html b/content/canvas/test/webgl/conformance/more/conformance/getContext.html similarity index 65% rename from content/canvas/test/webgl/more/conformance/getContext.html rename to content/canvas/test/webgl/conformance/more/conformance/getContext.html index 0132974fc5d7..094cd7311e82 100644 --- a/content/canvas/test/webgl/more/conformance/getContext.html +++ b/content/canvas/test/webgl/conformance/more/conformance/getContext.html @@ -11,16 +11,18 @@ Tests.testGetWebGL = function() { var canvas = document.getElementById('webgl'); var gl; assertOk(function(){gl = canvas.getContext(GL_CONTEXT_ID)}); - assertFail("Shouldn't be able to get 2D context after getting WebGL context", function(){canvas.getContext('2d')}); - assertOk(function(){canvas.getContext(GL_CONTEXT_ID)}); + assertEquals("ctx.canvas === canvas", gl.canvas, canvas); + assertOk(function(){g2d = canvas.getContext('2d')}); + assert("Should get a null 2d context after getting webgl context", g2d === null); } Tests.testGet2D = function() { var canvas = document.getElementById('2d'); - var ctx; - assertOk(function(){ctx = canvas.getContext('2d')}); - assertFail("Shouldn't be able to get WebGL context after getting 2D context", function(){canvas.getContext(GL_CONTEXT_ID)}); - assertOk(function(){canvas.getContext('2d')}); + var g2d; + var gl; + assertOk(function(){g2d = canvas.getContext('2d')}); + assertOk(function(){gl = canvas.getContext(GL_CONTEXT_ID)}); + assert("Should get a null WebGL context after getting 2D context", gl === null); } diff --git a/content/canvas/test/webgl/more/conformance/methods.html b/content/canvas/test/webgl/conformance/more/conformance/methods.html similarity index 98% rename from content/canvas/test/webgl/more/conformance/methods.html rename to content/canvas/test/webgl/conformance/more/conformance/methods.html index 0e095f7ffa5c..2b904df1106a 100644 --- a/content/canvas/test/webgl/more/conformance/methods.html +++ b/content/canvas/test/webgl/conformance/more/conformance/methods.html @@ -98,6 +98,8 @@ var methods = ['canvas', "getAttribLocation", "getBufferParameter", "getError", +"getExtension", +"getSupportedExtensions", "getFramebufferAttachmentParameter", "getProgramInfoLog", "getRenderbufferParameter", @@ -106,6 +108,7 @@ var methods = ['canvas', "getUniformLocation", "hint", "isBuffer", +"isContextLost", "isEnabled", "isFramebuffer", "isProgram", @@ -185,7 +188,7 @@ Tests.testOES20Methods = function(gl) { } } } - + Tests.startUnit = function() { var canvas = document.getElementById('gl'); var gl = wrapGLContext(canvas.getContext(GL_CONTEXT_ID)); diff --git a/content/canvas/test/webgl/more/conformance/quickCheckAPI.html b/content/canvas/test/webgl/conformance/more/conformance/quickCheckAPI.html similarity index 100% rename from content/canvas/test/webgl/more/conformance/quickCheckAPI.html rename to content/canvas/test/webgl/conformance/more/conformance/quickCheckAPI.html diff --git a/content/canvas/test/webgl/more/conformance/quickCheckAPI.js b/content/canvas/test/webgl/conformance/more/conformance/quickCheckAPI.js similarity index 100% rename from content/canvas/test/webgl/more/conformance/quickCheckAPI.js rename to content/canvas/test/webgl/conformance/more/conformance/quickCheckAPI.js diff --git a/content/canvas/test/webgl/more/conformance/quickCheckAPIBadArgs.html b/content/canvas/test/webgl/conformance/more/conformance/quickCheckAPIBadArgs.html similarity index 100% rename from content/canvas/test/webgl/more/conformance/quickCheckAPIBadArgs.html rename to content/canvas/test/webgl/conformance/more/conformance/quickCheckAPIBadArgs.html diff --git a/content/canvas/test/webgl/more/conformance/webGLArrays.html b/content/canvas/test/webgl/conformance/more/conformance/webGLArrays.html similarity index 100% rename from content/canvas/test/webgl/more/conformance/webGLArrays.html rename to content/canvas/test/webgl/conformance/more/conformance/webGLArrays.html diff --git a/content/canvas/test/webgl/more/demos/opengl_web.html b/content/canvas/test/webgl/conformance/more/demos/opengl_web.html similarity index 100% rename from content/canvas/test/webgl/more/demos/opengl_web.html rename to content/canvas/test/webgl/conformance/more/demos/opengl_web.html diff --git a/content/canvas/test/webgl/more/demos/video.html b/content/canvas/test/webgl/conformance/more/demos/video.html similarity index 100% rename from content/canvas/test/webgl/more/demos/video.html rename to content/canvas/test/webgl/conformance/more/demos/video.html diff --git a/content/canvas/test/webgl/more/functions/bindBuffer.html b/content/canvas/test/webgl/conformance/more/functions/bindBuffer.html similarity index 100% rename from content/canvas/test/webgl/more/functions/bindBuffer.html rename to content/canvas/test/webgl/conformance/more/functions/bindBuffer.html diff --git a/content/canvas/test/webgl/more/functions/bindBufferBadArgs.html b/content/canvas/test/webgl/conformance/more/functions/bindBufferBadArgs.html similarity index 100% rename from content/canvas/test/webgl/more/functions/bindBufferBadArgs.html rename to content/canvas/test/webgl/conformance/more/functions/bindBufferBadArgs.html diff --git a/content/canvas/test/webgl/more/functions/bindFramebufferLeaveNonZero.html b/content/canvas/test/webgl/conformance/more/functions/bindFramebufferLeaveNonZero.html similarity index 100% rename from content/canvas/test/webgl/more/functions/bindFramebufferLeaveNonZero.html rename to content/canvas/test/webgl/conformance/more/functions/bindFramebufferLeaveNonZero.html diff --git a/content/canvas/test/webgl/more/functions/bufferData.html b/content/canvas/test/webgl/conformance/more/functions/bufferData.html similarity index 100% rename from content/canvas/test/webgl/more/functions/bufferData.html rename to content/canvas/test/webgl/conformance/more/functions/bufferData.html diff --git a/content/canvas/test/webgl/more/functions/bufferDataBadArgs.html b/content/canvas/test/webgl/conformance/more/functions/bufferDataBadArgs.html similarity index 94% rename from content/canvas/test/webgl/more/functions/bufferDataBadArgs.html rename to content/canvas/test/webgl/conformance/more/functions/bufferDataBadArgs.html index ddec11930f02..e624f57581de 100644 --- a/content/canvas/test/webgl/more/functions/bufferDataBadArgs.html +++ b/content/canvas/test/webgl/conformance/more/functions/bufferDataBadArgs.html @@ -21,8 +21,8 @@ Tests.testBufferData = function(gl) { function(){gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(0), gl.STATIC_DRAW);}); assertFail("bad target", function(){gl.bufferData(gl.TEXTURE_2D, new Float32Array([1,2,3]), gl.STATIC_DRAW);}); - assertFail("array for data", - function(){gl.bufferData(gl.ARRAY_BUFFER, [1,2,3], gl.STATIC_DRAW);}); +// assertFail("array for data", +// function(){gl.bufferData(gl.ARRAY_BUFFER, [1,2,3], gl.STATIC_DRAW);}); assertFail("bad usage", function(){gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1,2,3]), gl.TEXTURE_2D);}); assertOk(function(){gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Float32Array([1,2,3]), gl.STATIC_DRAW);}); diff --git a/content/canvas/test/webgl/more/functions/bufferSubData.html b/content/canvas/test/webgl/conformance/more/functions/bufferSubData.html similarity index 100% rename from content/canvas/test/webgl/more/functions/bufferSubData.html rename to content/canvas/test/webgl/conformance/more/functions/bufferSubData.html diff --git a/content/canvas/test/webgl/more/functions/bufferSubDataBadArgs.html b/content/canvas/test/webgl/conformance/more/functions/bufferSubDataBadArgs.html similarity index 100% rename from content/canvas/test/webgl/more/functions/bufferSubDataBadArgs.html rename to content/canvas/test/webgl/conformance/more/functions/bufferSubDataBadArgs.html diff --git a/content/canvas/test/webgl/more/functions/copyTexImage2D.html b/content/canvas/test/webgl/conformance/more/functions/copyTexImage2D.html similarity index 100% rename from content/canvas/test/webgl/more/functions/copyTexImage2D.html rename to content/canvas/test/webgl/conformance/more/functions/copyTexImage2D.html diff --git a/content/canvas/test/webgl/more/functions/copyTexImage2DBadArgs.html b/content/canvas/test/webgl/conformance/more/functions/copyTexImage2DBadArgs.html similarity index 100% rename from content/canvas/test/webgl/more/functions/copyTexImage2DBadArgs.html rename to content/canvas/test/webgl/conformance/more/functions/copyTexImage2DBadArgs.html diff --git a/content/canvas/test/webgl/more/functions/copyTexSubImage2D.html b/content/canvas/test/webgl/conformance/more/functions/copyTexSubImage2D.html similarity index 100% rename from content/canvas/test/webgl/more/functions/copyTexSubImage2D.html rename to content/canvas/test/webgl/conformance/more/functions/copyTexSubImage2D.html diff --git a/content/canvas/test/webgl/more/functions/copyTexSubImage2DBadArgs.html b/content/canvas/test/webgl/conformance/more/functions/copyTexSubImage2DBadArgs.html similarity index 100% rename from content/canvas/test/webgl/more/functions/copyTexSubImage2DBadArgs.html rename to content/canvas/test/webgl/conformance/more/functions/copyTexSubImage2DBadArgs.html diff --git a/content/canvas/test/webgl/more/functions/deleteBufferBadArgs.html b/content/canvas/test/webgl/conformance/more/functions/deleteBufferBadArgs.html similarity index 94% rename from content/canvas/test/webgl/more/functions/deleteBufferBadArgs.html rename to content/canvas/test/webgl/conformance/more/functions/deleteBufferBadArgs.html index 2e383c28bbe8..c04fd6579dae 100644 --- a/content/canvas/test/webgl/more/functions/deleteBufferBadArgs.html +++ b/content/canvas/test/webgl/conformance/more/functions/deleteBufferBadArgs.html @@ -14,7 +14,7 @@ Tests.startUnit = function () { Tests.testDeleteBuffer = function(gl) { assertThrowNoGLError(gl, "number ", function(){ gl.deleteBuffer(1); }); - assertThrowNoGLError(gl, "null", function(){ gl.deleteBuffer(null); }); + assertGLError(gl, gl.NO_ERROR, "null", function(){ gl.deleteBuffer(null); }); assertThrowNoGLError(gl, "0", function(){ gl.deleteBuffer(0); }); assertThrowNoGLError(gl, "false", function(){ gl.deleteBuffer(false); }); assertThrowNoGLError(gl, "true", function(){ gl.deleteBuffer(true); }); diff --git a/content/canvas/test/webgl/more/functions/drawArrays.html b/content/canvas/test/webgl/conformance/more/functions/drawArrays.html similarity index 100% rename from content/canvas/test/webgl/more/functions/drawArrays.html rename to content/canvas/test/webgl/conformance/more/functions/drawArrays.html diff --git a/content/canvas/test/webgl/more/functions/drawArraysOutOfBounds.html b/content/canvas/test/webgl/conformance/more/functions/drawArraysOutOfBounds.html similarity index 97% rename from content/canvas/test/webgl/more/functions/drawArraysOutOfBounds.html rename to content/canvas/test/webgl/conformance/more/functions/drawArraysOutOfBounds.html index 5829a375132a..1e16fa18b70a 100644 --- a/content/canvas/test/webgl/more/functions/drawArraysOutOfBounds.html +++ b/content/canvas/test/webgl/conformance/more/functions/drawArraysOutOfBounds.html @@ -93,13 +93,13 @@ Tests.testDrawArraysOutOfBounds = function(gl, prog, v,n,t) { assertGLError(gl, gl.INVALID_VALUE, "negative offset", function(){gl.drawArrays(gl.TRIANGLES, 0, -1);}); assertGLError(gl, gl.INVALID_OPERATION, "count out of range", - function(){gl.drawArrays(gl.TRIANGLES, 1, 0);}); + function(){gl.drawArrays(gl.TRIANGLES, 0, 1);}); assertGLError(gl, gl.INVALID_VALUE, "negative count", - function(){gl.drawArrays(gl.TRIANGLES, -1, 0);}); + function(){gl.drawArrays(gl.TRIANGLES, 0, -1);}); assertGLError(gl, gl.INVALID_VALUE, "positive count, negative offset", - function(){gl.drawArrays(gl.TRIANGLES, 1, -1);}); - assertGLError(gl, gl.INVALID_VALUE, "negative count, positive offset", function(){gl.drawArrays(gl.TRIANGLES, -1, 1);}); + assertGLError(gl, gl.INVALID_VALUE, "negative count, positive offset", + function(){gl.drawArrays(gl.TRIANGLES, 1, -1);}); gl.deleteBuffer(b); } @@ -121,13 +121,13 @@ Tests.testDrawArraysWithDataOutOfBounds = function(gl, prog, v,n,t) { assertGLError(gl, gl.INVALID_VALUE, "negative offset", function(){gl.drawArrays(gl.TRIANGLES, 0, -1);}); assertGLError(gl, gl.INVALID_OPERATION, "count out of range", - function(){gl.drawArrays(gl.TRIANGLES, 4, 0);}); + function(){gl.drawArrays(gl.TRIANGLES, 0, 4);}); assertGLError(gl, gl.INVALID_VALUE, "negative count", - function(){gl.drawArrays(gl.TRIANGLES, -1, 0);}); + function(){gl.drawArrays(gl.TRIANGLES, 0, -1);}); assertGLError(gl, gl.INVALID_VALUE, "positive count, negative offset", - function(){gl.drawArrays(gl.TRIANGLES, 2, -1);}); + function(){gl.drawArrays(gl.TRIANGLES, -1, 2);}); assertGLError(gl, gl.INVALID_VALUE, "negative count, positive offset", - function(){gl.drawArrays(gl.TRIANGLES, -1, 1);}); + function(){gl.drawArrays(gl.TRIANGLES, 1, -1);}); gl.deleteBuffer(b); } @@ -221,7 +221,7 @@ Tests.testDrawArraysVBOOutOfBounds = function(gl, prog, v,n,t) { assertGLError(gl, gl.INVALID_OPERATION, "1", function(){gl.drawArrays(gl.TRIANGLES, 6, 1);}); assertGLError(gl, gl.INVALID_VALUE, "negative count", - function(){gl.drawArrays(gl.TRIANGLES, -1, 2);}); + function(){gl.drawArrays(gl.TRIANGLES, 2, -1);}); assertGLError(gl, gl.INVALID_OPERATION, "3", function(){gl.drawArrays(gl.TRIANGLES, 0, 7);}); assertGLError(gl, gl.INVALID_OPERATION, "4", @@ -240,7 +240,7 @@ Tests.testDrawArraysVBOMultiOutOfBounds = function(gl, prog, v,n,t) { assertGLError(gl, gl.INVALID_OPERATION, "1", function(){gl.drawArrays(gl.TRIANGLES, 6, 1);}); assertGLError(gl, gl.INVALID_VALUE, "negative count", - function(){gl.drawArrays(gl.TRIANGLES, -1, 2);}); + function(){gl.drawArrays(gl.TRIANGLES, 2, -1);}); assertGLError(gl, gl.INVALID_OPERATION, "2", function(){gl.drawArrays(gl.TRIANGLES, 0, 7);}); assertGLError(gl, gl.INVALID_OPERATION, "3", diff --git a/content/canvas/test/webgl/more/functions/drawElements.html b/content/canvas/test/webgl/conformance/more/functions/drawElements.html similarity index 100% rename from content/canvas/test/webgl/more/functions/drawElements.html rename to content/canvas/test/webgl/conformance/more/functions/drawElements.html diff --git a/content/canvas/test/webgl/more/functions/drawElementsBadArgs.html b/content/canvas/test/webgl/conformance/more/functions/drawElementsBadArgs.html similarity index 93% rename from content/canvas/test/webgl/more/functions/drawElementsBadArgs.html rename to content/canvas/test/webgl/conformance/more/functions/drawElementsBadArgs.html index 70d68cbc3df5..2b90b367fa6d 100644 --- a/content/canvas/test/webgl/more/functions/drawElementsBadArgs.html +++ b/content/canvas/test/webgl/conformance/more/functions/drawElementsBadArgs.html @@ -174,19 +174,7 @@ Tests.testSharedBuffers = function(gl, prog, v,n,t) { var vertsArr = new Uint16Array([0,1,3,3,4,5,6,7,8]); gl.bindBuffer(gl.ARRAY_BUFFER, vbo); gl.bufferData(gl.ARRAY_BUFFER, vertsArr, gl.STATIC_DRAW); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, vbo); - gl.enableVertexAttribArray(v); - gl.vertexAttribPointer(v, 3, gl.UNSIGNED_SHORT, false, 0, 0); - assertFail('buffer data is shared between indexes and verts', function() { - gl.drawElements(gl.TRIANGLES, 3, gl.UNSIGNED_SHORT, 0); - }); - var vertsArr2 = new Uint16Array([2]); - gl.bufferSubData(gl.ARRAY_BUFFER, 4, vertsArr2); // replace the first 3 with a 2 - assertOk('buffer data is shared between indexes and verts', function() { - gl.drawElements(gl.TRIANGLES, 3, gl.UNSIGNED_SHORT, 0); - }); - gl.bindBuffer(gl.ARRAY_BUFFER, null); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null); + assertFail(function(){gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, vbo)}); gl.deleteBuffer(vbo); } diff --git a/content/canvas/test/webgl/more/functions/isTests.html b/content/canvas/test/webgl/conformance/more/functions/isTests.html similarity index 100% rename from content/canvas/test/webgl/more/functions/isTests.html rename to content/canvas/test/webgl/conformance/more/functions/isTests.html diff --git a/content/canvas/test/webgl/more/functions/readPixels.html b/content/canvas/test/webgl/conformance/more/functions/readPixels.html similarity index 92% rename from content/canvas/test/webgl/more/functions/readPixels.html rename to content/canvas/test/webgl/conformance/more/functions/readPixels.html index 573ad6ce199a..4bbf3ef058dc 100644 --- a/content/canvas/test/webgl/more/functions/readPixels.html +++ b/content/canvas/test/webgl/conformance/more/functions/readPixels.html @@ -44,9 +44,6 @@ Tests.testReadPixels = function(gl) { assertOk(function(){gl.readPixels(0,0,1,1,gl.RGBA, gl.UNSIGNED_BYTE, id);}); assertOk(function(){gl.readPixels(0,0,16,16,gl.RGBA, gl.UNSIGNED_BYTE, id);}); assertOk(function(){gl.readPixels(15,15,1,1,gl.RGBA, gl.UNSIGNED_BYTE, id);}); - var format = gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_FORMAT); - var type = gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_TYPE); - assertOk(function(){gl.readPixels(15,15,1,1, format, type, id);}); } Tests.testReadPixelsRGBA = function(gl) { gl.clearColor(1, 0, 1, 0); diff --git a/content/canvas/test/webgl/more/functions/readPixelsBadArgs.html b/content/canvas/test/webgl/conformance/more/functions/readPixelsBadArgs.html similarity index 100% rename from content/canvas/test/webgl/more/functions/readPixelsBadArgs.html rename to content/canvas/test/webgl/conformance/more/functions/readPixelsBadArgs.html diff --git a/content/canvas/test/webgl/more/functions/texImage2D.html b/content/canvas/test/webgl/conformance/more/functions/texImage2D.html similarity index 100% rename from content/canvas/test/webgl/more/functions/texImage2D.html rename to content/canvas/test/webgl/conformance/more/functions/texImage2D.html diff --git a/content/canvas/test/webgl/more/functions/texImage2DBadArgs.html b/content/canvas/test/webgl/conformance/more/functions/texImage2DBadArgs.html similarity index 100% rename from content/canvas/test/webgl/more/functions/texImage2DBadArgs.html rename to content/canvas/test/webgl/conformance/more/functions/texImage2DBadArgs.html diff --git a/content/canvas/test/webgl/more/functions/texImage2DHTML.html b/content/canvas/test/webgl/conformance/more/functions/texImage2DHTML.html similarity index 100% rename from content/canvas/test/webgl/more/functions/texImage2DHTML.html rename to content/canvas/test/webgl/conformance/more/functions/texImage2DHTML.html diff --git a/content/canvas/test/webgl/more/functions/texImage2DHTMLBadArgs.html b/content/canvas/test/webgl/conformance/more/functions/texImage2DHTMLBadArgs.html similarity index 100% rename from content/canvas/test/webgl/more/functions/texImage2DHTMLBadArgs.html rename to content/canvas/test/webgl/conformance/more/functions/texImage2DHTMLBadArgs.html diff --git a/content/canvas/test/webgl/more/functions/texSubImage2D.html b/content/canvas/test/webgl/conformance/more/functions/texSubImage2D.html similarity index 100% rename from content/canvas/test/webgl/more/functions/texSubImage2D.html rename to content/canvas/test/webgl/conformance/more/functions/texSubImage2D.html diff --git a/content/canvas/test/webgl/more/functions/texSubImage2DBadArgs.html b/content/canvas/test/webgl/conformance/more/functions/texSubImage2DBadArgs.html similarity index 96% rename from content/canvas/test/webgl/more/functions/texSubImage2DBadArgs.html rename to content/canvas/test/webgl/conformance/more/functions/texSubImage2DBadArgs.html index e351aacdc924..ecd8d0a4c504 100644 --- a/content/canvas/test/webgl/more/functions/texSubImage2DBadArgs.html +++ b/content/canvas/test/webgl/conformance/more/functions/texSubImage2DBadArgs.html @@ -91,10 +91,10 @@ Tests.testTexImage2D = function(gl) { assertGLError(gl, gl.INVALID_OPERATION, "not enough data", function(){ gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, 1,1,gl.RGBA,gl.UNSIGNED_BYTE, new Uint8Array([0,0,0])); }); - assertGLError(gl, gl.INVALID_VALUE, "format does not match internal format", function(){ + assertGLError(gl, gl.INVALID_OPERATION, "format does not match internal format", function(){ gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, 1,1,gl.RGB,gl.UNSIGNED_BYTE, new Uint8Array([0,0,0])); }); - assertGLError(gl, gl.INVALID_VALUE, "type does not match original", function(){ + assertGLError(gl, gl.INVALID_OPERATION, "type does not match original", function(){ gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, 1,1,gl.RGBA,gl.UNSIGNED_SHORT_4_4_4_4, new Uint16Array([0])); }); } diff --git a/content/canvas/test/webgl/more/functions/texSubImage2DHTML.html b/content/canvas/test/webgl/conformance/more/functions/texSubImage2DHTML.html similarity index 100% rename from content/canvas/test/webgl/more/functions/texSubImage2DHTML.html rename to content/canvas/test/webgl/conformance/more/functions/texSubImage2DHTML.html diff --git a/content/canvas/test/webgl/more/functions/texSubImage2DHTMLBadArgs.html b/content/canvas/test/webgl/conformance/more/functions/texSubImage2DHTMLBadArgs.html similarity index 89% rename from content/canvas/test/webgl/more/functions/texSubImage2DHTMLBadArgs.html rename to content/canvas/test/webgl/conformance/more/functions/texSubImage2DHTMLBadArgs.html index b1f20e868c4d..6bcf9d28053d 100644 --- a/content/canvas/test/webgl/more/functions/texSubImage2DHTMLBadArgs.html +++ b/content/canvas/test/webgl/conformance/more/functions/texSubImage2DHTMLBadArgs.html @@ -42,25 +42,25 @@ Tests.testTexImage2D = function(gl) { function() {gl.texSubImage2D(gl.FLOAT, 0, 0,0, gl.RGBA, gl.UNSIGNED_BYTE, c); }); assertOk("good args", function() {gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, c); }); - assertGLError(gl, gl.INVALID_VALUE, "format not same as original", + assertGLError(gl, gl.INVALID_OPERATION, "format not same as original", function() {gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGB, gl.UNSIGNED_BYTE, c); }); - assertGLError(gl, gl.INVALID_VALUE, "type not same as original", + assertGLError(gl, gl.INVALID_OPERATION, "type not same as original", function() {gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGBA, gl.UNSIGNED_SHORT_4_4_4_4, c); }); assertOk("make texture RGB", function() {gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, c); }); assertOk("format same as original RGB", function() {gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGB, gl.UNSIGNED_BYTE, c); }); - assertGLError(gl, gl.INVALID_VALUE, "format not same as original RGB", + assertGLError(gl, gl.INVALID_OPERATION, "format not same as original RGB", function() {gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGBA, gl.UNSIGNED_BYTE, c); }); - assertGLError(gl, gl.INVALID_VALUE, "type not same as original RGB", + assertGLError(gl, gl.INVALID_OPERATION, "type not same as original RGB", function() {gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGB, gl.UNSIGNED_SHORT_5_6_5, c); }); assertOk("make texture RGBA 4_4_4_4", function() {gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_SHORT_4_4_4_4, c); }); assertOk("format same as original RGBA 4_4_4_4", function() {gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGBA, gl.UNSIGNED_SHORT_4_4_4_4, c); }); - assertGLError(gl, gl.INVALID_VALUE, "format not same as original RGBA 4_4_4_4", + assertGLError(gl, gl.INVALID_OPERATION, "format not same as original RGBA 4_4_4_4", function() {gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGB, gl.UNSIGNED_BYTE, c); }); - assertGLError(gl, gl.INVALID_VALUE, "type not same as original RGBA 4_4_4_4", + assertGLError(gl, gl.INVALID_OPERATION, "type not same as original RGBA 4_4_4_4", function() {gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGBA, gl.UNSIGNED_BYTE, c); }); } diff --git a/content/canvas/test/webgl/more/functions/uniformMatrix.html b/content/canvas/test/webgl/conformance/more/functions/uniformMatrix.html similarity index 100% rename from content/canvas/test/webgl/more/functions/uniformMatrix.html rename to content/canvas/test/webgl/conformance/more/functions/uniformMatrix.html diff --git a/content/canvas/test/webgl/more/functions/uniformMatrixBadArgs.html b/content/canvas/test/webgl/conformance/more/functions/uniformMatrixBadArgs.html similarity index 84% rename from content/canvas/test/webgl/more/functions/uniformMatrixBadArgs.html rename to content/canvas/test/webgl/conformance/more/functions/uniformMatrixBadArgs.html index eb1773313048..1146e8ade128 100644 --- a/content/canvas/test/webgl/more/functions/uniformMatrixBadArgs.html +++ b/content/canvas/test/webgl/conformance/more/functions/uniformMatrixBadArgs.html @@ -29,11 +29,11 @@ Tests.testUniformf = function(gl, unwrappedGL) { function(){gl.uniformMatrix4fv(588939, false, [1,0,0,0, 0,2,0,0, 0,0,3,0, 0,0,0,4]);}); assertThrowNoGLError(gl, "bad location (negative)", function(){gl.uniformMatrix4fv(-588939, false, [1,0,0,0, 0,2,0,0, 0,0,3,0, 0,0,0,4]);}); - assertOk("too many values to 4fv", + assertGLError(gl, gl.INVALID_VALUE, "17 values to 4fv", function(){gl.uniformMatrix4fv(fm4, false, [0,1,0,0,0, 0,2,0,0, 0,0,3,0, 0,0,0,4]);}); - assertOk("too many values to 2fv", + assertGLError(gl, gl.INVALID_VALUE, "5 values to 2fv", function(){gl.uniformMatrix2fv(fm2, false, [0,2,1, 2,2]);}); - assertOk("too many values to 3fv", + assertGLError(gl, gl.INVALID_VALUE, "10 values to 3fv", function(){gl.uniformMatrix3fv(fm3, false, [0,2,2,2, 2,2,2, 2,1,2]);}); assertGLError(gl, gl.INVALID_VALUE, "too few values to 4fv", function(){gl.uniformMatrix4fv(fm4, false, [0,0,0, 0,2,0,0, 0,0,3,0, 0,0,0,4]);}); @@ -67,10 +67,11 @@ Tests.testUniformf = function(gl, unwrappedGL) { var loc1Name = 'am' + ii + '[1]'; var loc0 = f.uniform(loc0Name); var loc1 = f.uniform(loc1Name); + var fname = "uniformMatrix" + ii + "fv"; assert(loc0Name, loc0 != null); assert(loc1Name, loc1 != null); - assertOk("set array of 2 matrices " + ii + "2fv", - function(){gl.uniformMatrix2fv(loc0, false, all);}); + assertOk("set array of 2 matrices " + ii + "fv", + function(){gl[fname].call(gl,loc0, false, all);}); var actual = unwrappedGL.getUniform(sh.shader.program, loc0); assert("got value for loc0", gl.NO_ERROR == checkError(gl, "getUniform loc0")); @@ -80,22 +81,14 @@ Tests.testUniformf = function(gl, unwrappedGL) { gl.NO_ERROR == checkError(gl, "getUniform loc1")); assertArrayEquals(mats[1], actual); assertOk("set array of second array of 2 matrixes", - function(){gl.uniformMatrix2fv(loc1, false, mats[0]);}); + function(){gl[fname].call(gl, loc1, false, mats[0]);}); var actual = unwrappedGL.getUniform(sh.shader.program, loc1); assert("got value for loc1", gl.NO_ERROR == checkError(gl, "getUniform loc1")); assertArrayEquals(mats[0], actual); var big = mats[1].concat([3]); - assertOk("set array of first array of 2 matrixes plus 1 value", - function(){gl.uniformMatrix2fv(loc0, false, big);}); - var actual = unwrappedGL.getUniform(sh.shader.program, loc0); - assert("got value for loc0", - gl.NO_ERROR == checkError(gl, "getUniform loc0")); - assertArrayEquals(mats[1], actual); - var actual = unwrappedGL.getUniform(sh.shader.program, loc1); - assert("got value for loc1", - gl.NO_ERROR == checkError(gl, "getUniform loc1")); - assertArrayEquals(mats[0], actual); + assertGLError(gl, gl.INVALID_VALUE, "set array of first array of 2 matrixes plus 1 value", + function(){gl[fname].call(gl, loc0, false, big);}); } }); var d = new Uint8Array(4); @@ -122,7 +115,8 @@ varying vec4 texCoord0; void main() { texCoord0 = vec4(Tex.s, 1.0-Tex.t, fm2[0][1]+fm3[2][1], 0.0); - float d = am2[1][1][1] + am3[1][2][2] + am4[1][3][3]; + float d = am2[0][1][1] + am3[0][2][2] + am4[0][3][3] + + am2[1][1][1] + am3[1][2][2] + am4[1][3][3]; gl_Position = vec4(Vertex, 1.0 + d * 0.0001); } diff --git a/content/canvas/test/webgl/more/functions/uniformf.html b/content/canvas/test/webgl/conformance/more/functions/uniformf.html similarity index 100% rename from content/canvas/test/webgl/more/functions/uniformf.html rename to content/canvas/test/webgl/conformance/more/functions/uniformf.html diff --git a/content/canvas/test/webgl/conformance/more/functions/uniformfArrayLen1.html b/content/canvas/test/webgl/conformance/more/functions/uniformfArrayLen1.html new file mode 100644 index 000000000000..b3aa79233be1 --- /dev/null +++ b/content/canvas/test/webgl/conformance/more/functions/uniformfArrayLen1.html @@ -0,0 +1,95 @@ + + + + + + + + + + + + + diff --git a/content/canvas/test/webgl/more/functions/uniformfBadArgs.html b/content/canvas/test/webgl/conformance/more/functions/uniformfBadArgs.html similarity index 89% rename from content/canvas/test/webgl/more/functions/uniformfBadArgs.html rename to content/canvas/test/webgl/conformance/more/functions/uniformfBadArgs.html index 57a7f1b70c65..a516c92ebb63 100644 --- a/content/canvas/test/webgl/more/functions/uniformfBadArgs.html +++ b/content/canvas/test/webgl/conformance/more/functions/uniformfBadArgs.html @@ -21,15 +21,18 @@ Tests.testUniformf = function(gl) { function(){gl.uniform4fv(58882929, [1,2,3,4]);}); assertThrowNoGLError(gl, "negative number for location", function(){gl.uniform4fv(-58882929, [1,2,3,4]);}); - assertGLError(gl, gl.INVALID_OPERATION, "??", - function(){gl.uniform1fv(uniV4, [1,2,3,4,5]);}); - // for non arrays you must pass in exactly 1 value. + assertGLError(gl, gl.INVALID_OPERATION, "1fv on 4fv", + function(){gl.uniform1fv(uniV4, [1,2,3,4]);}); assertGLError(gl, gl.INVALID_OPERATION, "more than enough values 1fv", function(){gl.uniform1fv(uniFloat, [2,3,4,5,6]);}); assertGLError(gl, gl.INVALID_OPERATION, "4fv on float", function(){gl.uniform4fv(uniFloat, [2,3,4,5]);}); assertOk("4fv on 4fv", function(){gl.uniform4fv(uniV4, [1, 2, 3, 4]);}); + assertGLError(gl, gl.INVALID_VALUE, "5 values on 4fv", + function(){gl.uniform4fv(uniV4, [1, 2, 3, 4, 5]);}); + assertGLError(gl, gl.INVALID_OPERATION, "8 values on 4fv", + function(){gl.uniform4fv(uniV4, [1, 2, 3, 4, 5, 6, 7, 8]);}); assertGLError(gl, gl.INVALID_OPERATION, "3fv on float", function(){gl.uniform3fv(uniFloat, [2,3,4]);}); assertGLError(gl, gl.INVALID_OPERATION, "2fv on float", diff --git a/content/canvas/test/webgl/more/functions/uniformi.html b/content/canvas/test/webgl/conformance/more/functions/uniformi.html similarity index 100% rename from content/canvas/test/webgl/more/functions/uniformi.html rename to content/canvas/test/webgl/conformance/more/functions/uniformi.html diff --git a/content/canvas/test/webgl/more/functions/uniformiBadArgs.html b/content/canvas/test/webgl/conformance/more/functions/uniformiBadArgs.html similarity index 89% rename from content/canvas/test/webgl/more/functions/uniformiBadArgs.html rename to content/canvas/test/webgl/conformance/more/functions/uniformiBadArgs.html index 6c452aff85be..bbc0379d5dde 100644 --- a/content/canvas/test/webgl/more/functions/uniformiBadArgs.html +++ b/content/canvas/test/webgl/conformance/more/functions/uniformiBadArgs.html @@ -21,13 +21,16 @@ Tests.testUniformf = function(gl) { function(){gl.uniform4iv(58882929, [1,2,3,4]);}); assertThrowNoGLError(gl, "negative number as location", function(){gl.uniform4iv(-58882929, [1,2,3,4]);}); - assertOk("more than enough values 4iv", - function(){gl.uniform4iv(uniIV4, [1,2,3,4,5]);}); - // For non arrays you must pass in only 1 value. assertGLError(gl, gl.INVALID_OPERATION, "more than 1 value to 1iv", function(){gl.uniform1iv(uniInt, [2,3,4,5,6]);}); assertGLError(gl, gl.INVALID_OPERATION, "4iv on int", function(){gl.uniform4iv(uniInt, [2,3,4,5]);}); + assertOk("4iv on 4iv", + function(){gl.uniform4iv(uniIV4, [1, 2, 3, 4]);}); + assertGLError(gl, gl.INVALID_VALUE, "5 values on 4iv", + function(){gl.uniform4iv(uniIV4, [1, 2, 3, 4, 5]);}); + assertGLError(gl, gl.INVALID_OPERATION, "8 values on 4iv", + function(){gl.uniform4iv(uniIV4, [1, 2, 3, 4, 5, 6, 7, 8]);}); assertGLError(gl, gl.INVALID_OPERATION, "3iv on int", function(){gl.uniform3iv(uniInt, [2,3,4]);}); assertGLError(gl, gl.INVALID_OPERATION, "2iv on int", diff --git a/content/canvas/test/webgl/more/functions/vertexAttrib.html b/content/canvas/test/webgl/conformance/more/functions/vertexAttrib.html similarity index 100% rename from content/canvas/test/webgl/more/functions/vertexAttrib.html rename to content/canvas/test/webgl/conformance/more/functions/vertexAttrib.html diff --git a/content/canvas/test/webgl/more/functions/vertexAttribBadArgs.html b/content/canvas/test/webgl/conformance/more/functions/vertexAttribBadArgs.html similarity index 95% rename from content/canvas/test/webgl/more/functions/vertexAttribBadArgs.html rename to content/canvas/test/webgl/conformance/more/functions/vertexAttribBadArgs.html index c2fe9f65b2a9..1d8fe4e33dad 100644 --- a/content/canvas/test/webgl/more/functions/vertexAttribBadArgs.html +++ b/content/canvas/test/webgl/conformance/more/functions/vertexAttribBadArgs.html @@ -78,10 +78,6 @@ Tests.testVertexAttrib = function(gl, prog, v,n,t) { function(){gl.vertexAttrib1f(-69092342, 1);}); assertFail("bad index (big positive)", function(){gl.vertexAttrib1f(58928938, 1);}); - assertFail("wrong number of args", - function(){gl.vertexAttrib4f(v, 1,4,5);}); - assertFail("wrong number of args, none", - function(){gl.vertexAttrib1f(v);}); assertOk("array too large", function(){gl.vertexAttrib1fv(v, [1,2,3,4,5]);}); assertFail("array too small", diff --git a/content/canvas/test/webgl/more/functions/vertexAttribPointer.html b/content/canvas/test/webgl/conformance/more/functions/vertexAttribPointer.html similarity index 100% rename from content/canvas/test/webgl/more/functions/vertexAttribPointer.html rename to content/canvas/test/webgl/conformance/more/functions/vertexAttribPointer.html diff --git a/content/canvas/test/webgl/more/functions/vertexAttribPointerBadArgs.html b/content/canvas/test/webgl/conformance/more/functions/vertexAttribPointerBadArgs.html similarity index 100% rename from content/canvas/test/webgl/more/functions/vertexAttribPointerBadArgs.html rename to content/canvas/test/webgl/conformance/more/functions/vertexAttribPointerBadArgs.html diff --git a/content/canvas/test/webgl/more/glsl/arrayOutOfBounds.html b/content/canvas/test/webgl/conformance/more/glsl/arrayOutOfBounds.html similarity index 89% rename from content/canvas/test/webgl/more/glsl/arrayOutOfBounds.html rename to content/canvas/test/webgl/conformance/more/glsl/arrayOutOfBounds.html index ed3ec0105af9..856477856a97 100644 --- a/content/canvas/test/webgl/more/glsl/arrayOutOfBounds.html +++ b/content/canvas/test/webgl/conformance/more/glsl/arrayOutOfBounds.html @@ -78,7 +78,10 @@ arr.forEach(function(e){ void main() { TexCoord = Tex; - float x[3] = float[](1.0, 2.0, 3.0); + float x[3]; + x[0] = 1.0; + x[1] = 2.0; + x[2] = 3.0; gl_Position = vec4(Vertex, x[2]); } @@ -91,7 +94,10 @@ arr.forEach(function(e){ void main() { TexCoord = Tex; - float x[3] = float[](1.0, 2.0, 3.0); + float x[3]; + x[0] = 1.0; + x[1] = 2.0; + x[2] = 3.0; gl_Position = vec4(Vertex, x[4]); } @@ -104,7 +110,10 @@ arr.forEach(function(e){ void main() { TexCoord = Tex; - float x[3] = float[](1.0, 2.0, 3.0); + float x[3]; + x[0] = 1.0; + x[1] = 2.0; + x[2] = 3.0; x[4] = Vertex.z; gl_Position = vec4(Vertex, x[4]); } @@ -118,7 +127,10 @@ arr.forEach(function(e){ void main() { TexCoord = Tex; - float x[3] = float[](1.0, 2.0, 3.0); + float x[3]; + x[0] = 1.0; + x[1] = 2.0; + x[2] = 3.0; int idx = 4 * int(max(1.0, Vertex.x*20.0)); gl_Position = vec4(Vertex, x[idx]); } @@ -132,7 +144,10 @@ arr.forEach(function(e){ void main() { TexCoord = Tex; - float x[3] = float[](1.0, 2.0, 3.0); + float x[3]; + x[0] = 1.0; + x[1] = 2.0; + x[2] = 3.0; int idx = 4 * int(max(1.0, Vertex.x*20.0)); x[idx] = Vertex.z; gl_Position = vec4(Vertex, x[idx]); @@ -161,7 +176,10 @@ precision highp float; void main() { - float x[3] = float[](1.0, 2.0, 3.0); + float x[3]; + x[0] = 1.0; + x[1] = 2.0; + x[2] = 3.0; gl_FragColor = vec4(1.0, 0.0, TexCoord.s, x[2]); } @@ -175,7 +193,10 @@ precision highp float; void main() { - float x[3] = float[](1.0, 2.0, 3.0); + float x[3]; + x[0] = 1.0; + x[1] = 2.0; + x[2] = 3.0; gl_FragColor = vec4(1.0, 0.0, TexCoord.s, x[4]); } @@ -189,7 +210,10 @@ precision highp float; void main() { - float x[3] = float[](1.0, 2.0, 3.0); + float x[3]; + x[0] = 1.0; + x[1] = 2.0; + x[2] = 3.0; x[4] = 6.0; gl_FragColor = vec4(1.0, 0.0, TexCoord.s, x[4]); @@ -205,7 +229,10 @@ precision highp float; void main() { - float x[3] = float[](1.0, 2.0, 3.0); + float x[3]; + x[0] = 1.0; + x[1] = 2.0; + x[2] = 3.0; int idx = 4 * int(max(1.0, TexCoord.x*20.0)); gl_FragColor = vec4(1.0, 0.0, TexCoord.s, x[idx]); @@ -221,7 +248,10 @@ precision highp float; void main() { - float x[3] = float[](1.0, 2.0, 3.0); + float x[3]; + x[0] = 1.0; + x[1] = 2.0; + x[2] = 3.0; int idx = 4 * int(max(1.0, TexCoord.x*20.0)); x[idx] = 6.0; diff --git a/content/canvas/test/webgl/more/glsl/longLoops.html b/content/canvas/test/webgl/conformance/more/glsl/longLoops.html similarity index 100% rename from content/canvas/test/webgl/more/glsl/longLoops.html rename to content/canvas/test/webgl/conformance/more/glsl/longLoops.html diff --git a/content/canvas/test/webgl/more/glsl/uniformOutOfBounds.html b/content/canvas/test/webgl/conformance/more/glsl/uniformOutOfBounds.html similarity index 100% rename from content/canvas/test/webgl/more/glsl/uniformOutOfBounds.html rename to content/canvas/test/webgl/conformance/more/glsl/uniformOutOfBounds.html diff --git a/content/canvas/test/webgl/more/glsl/unusedAttribsUniforms.html b/content/canvas/test/webgl/conformance/more/glsl/unusedAttribsUniforms.html similarity index 100% rename from content/canvas/test/webgl/more/glsl/unusedAttribsUniforms.html rename to content/canvas/test/webgl/conformance/more/glsl/unusedAttribsUniforms.html diff --git a/content/canvas/test/webgl/more/index.html b/content/canvas/test/webgl/conformance/more/index.html similarity index 100% rename from content/canvas/test/webgl/more/index.html rename to content/canvas/test/webgl/conformance/more/index.html diff --git a/content/canvas/test/webgl/more/performance/CPUvsGPU.html b/content/canvas/test/webgl/conformance/more/performance/CPUvsGPU.html similarity index 100% rename from content/canvas/test/webgl/more/performance/CPUvsGPU.html rename to content/canvas/test/webgl/conformance/more/performance/CPUvsGPU.html diff --git a/content/canvas/test/webgl/more/performance/bandwidth.html b/content/canvas/test/webgl/conformance/more/performance/bandwidth.html similarity index 100% rename from content/canvas/test/webgl/more/performance/bandwidth.html rename to content/canvas/test/webgl/conformance/more/performance/bandwidth.html diff --git a/content/canvas/test/webgl/more/performance/jsGCPause.html b/content/canvas/test/webgl/conformance/more/performance/jsGCPause.html similarity index 100% rename from content/canvas/test/webgl/more/performance/jsGCPause.html rename to content/canvas/test/webgl/conformance/more/performance/jsGCPause.html diff --git a/content/canvas/test/webgl/more/performance/jsMatrixMult.html b/content/canvas/test/webgl/conformance/more/performance/jsMatrixMult.html similarity index 100% rename from content/canvas/test/webgl/more/performance/jsMatrixMult.html rename to content/canvas/test/webgl/conformance/more/performance/jsMatrixMult.html diff --git a/content/canvas/test/webgl/more/performance/jsToGLOverhead.html b/content/canvas/test/webgl/conformance/more/performance/jsToGLOverhead.html similarity index 100% rename from content/canvas/test/webgl/more/performance/jsToGLOverhead.html rename to content/canvas/test/webgl/conformance/more/performance/jsToGLOverhead.html diff --git a/content/canvas/test/webgl/more/unit.css b/content/canvas/test/webgl/conformance/more/unit.css similarity index 95% rename from content/canvas/test/webgl/more/unit.css rename to content/canvas/test/webgl/conformance/more/unit.css index 694fc474e064..0758b43bd9dd 100644 --- a/content/canvas/test/webgl/more/unit.css +++ b/content/canvas/test/webgl/conformance/more/unit.css @@ -26,14 +26,15 @@ OTHER DEALINGS IN THE SOFTWARE. */ .ok { - background-color: #8f8; + color: green; } .fail { - background-color: #f88; + color: red; +} +canvas { + display: none; } - #test-status { - color: black; font-size: large; } diff --git a/content/canvas/test/webgl/more/unit.js b/content/canvas/test/webgl/conformance/more/unit.js similarity index 89% rename from content/canvas/test/webgl/more/unit.js rename to content/canvas/test/webgl/conformance/more/unit.js index 8ef0184d3054..1396523d3cba 100644 --- a/content/canvas/test/webgl/more/unit.js +++ b/content/canvas/test/webgl/conformance/more/unit.js @@ -36,6 +36,7 @@ Tests = { } var __testSuccess__ = true; +var __testFailCount__ = 0; var __testLog__; var __backlog__ = []; @@ -147,11 +148,12 @@ function runTests() { testFailed(i, e.name, formatError(e)); } if (__testSuccess__ == false) { - var h = document.createElement('h2'); - h.textContent = i; - __testLog__.insertBefore(h, __testLog__.firstChild); - log.appendChild(__testLog__); + ++__testFailCount__; } + var h = document.createElement('h2'); + h.textContent = i; + __testLog__.insertBefore(h, __testLog__.firstChild); + log.appendChild(__testLog__); allTestsSuccessful = allTestsSuccessful && __testSuccess__ == true; reportTestResultsToHarness(__testSuccess__, i); doTestNotify (i+"--"+(__testSuccess__?"OK":"FAIL")); @@ -184,7 +186,12 @@ function doTestNotify(name) { function testFailed(assertName, name) { var d = document.createElement('div'); var h = document.createElement('h3'); - h.textContent = name==null ? assertName : name + " (in " + assertName + ")"; + var d1 = document.createElement("span"); + h.appendChild(d1); + d1.appendChild(document.createTextNode("FAIL: ")); + d1.style.color = "red"; + h.appendChild(document.createTextNode( + name==null ? assertName : name + " (in " + assertName + ")")); d.appendChild(h); var args = [] for (var i=2; i diff --git a/content/canvas/test/webgl/conformance/oes-standard-derivatives.html b/content/canvas/test/webgl/conformance/oes-standard-derivatives.html new file mode 100644 index 000000000000..552f74b24a43 --- /dev/null +++ b/content/canvas/test/webgl/conformance/oes-standard-derivatives.html @@ -0,0 +1,376 @@ + + + + + +WebGL OES_standard_derivatives Conformance Tests + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/content/canvas/test/webgl/conformance/oes-texture-float.html b/content/canvas/test/webgl/conformance/oes-texture-float.html new file mode 100644 index 000000000000..50df927019e3 --- /dev/null +++ b/content/canvas/test/webgl/conformance/oes-texture-float.html @@ -0,0 +1,226 @@ + + + + + +WebGL OES_texture_float Conformance Tests + + + + + + + +
+ +
+ + + + + + + + + + + diff --git a/content/canvas/test/webgl/conformance/oes-vertex-array-object.html b/content/canvas/test/webgl/conformance/oes-vertex-array-object.html new file mode 100644 index 000000000000..e5313f8971a7 --- /dev/null +++ b/content/canvas/test/webgl/conformance/oes-vertex-array-object.html @@ -0,0 +1,400 @@ + + + + + +WebGL OES_vertex_array_object Conformance Tests + + + + + + + +
+ +
+ + + + + + + + diff --git a/content/canvas/test/webgl/conformance/program-test.html b/content/canvas/test/webgl/conformance/program-test.html index f37260114d02..eb7603b8109a 100644 --- a/content/canvas/test/webgl/conformance/program-test.html +++ b/content/canvas/test/webgl/conformance/program-test.html @@ -35,6 +35,32 @@ function go() { gl.clearColor(0.0, 0.0, 0.0, 0.0); gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); + function doArraysHaveSameContents(a, b) { + var flags = []; + function hasUnusedValue(a, value) { + for (var ii = 0; ii < a.length; ++ii) { + if (a[ii] === value && !flags[ii]) { + flags[ii] = true; + return true; + } + } + return false; + } + + try { + if (a.length !== b.length) { + return false; + } + for (var ii = 0; ii < a.length; ii++) { + if (!hasUnusedValue(b, a[ii])) { + return false; + } + } + } catch (ex) { + return false; + } + return true; + } /////// Check compileShader() ///////////////////////////// @@ -136,7 +162,7 @@ function go() { gl.detachShader(prog, shaders_to_detach[i]); if(gl.getError() != gl.NO_ERROR) assertMsg(false, "unexpected error in detachShader()"); - assertMsg(areArraysEqual(gl.getAttachedShaders(prog), expected_shaders), errmsg); + assertMsg(doArraysHaveSameContents(gl.getAttachedShaders(prog), expected_shaders), errmsg); } checkGetAttachedShaders([], [], [], "getAttachedShaders should return an empty list by default"); checkGetAttachedShaders([fs], [], [fs], "attaching a single shader should give the expected list"); diff --git a/content/canvas/test/webgl/conformance/read-pixels-test.html b/content/canvas/test/webgl/conformance/read-pixels-test.html index 76af9a296986..93300b3bcf6a 100644 --- a/content/canvas/test/webgl/conformance/read-pixels-test.html +++ b/content/canvas/test/webgl/conformance/read-pixels-test.html @@ -25,171 +25,200 @@ var canvas = document.getElementById("example"); var gl = create3DContext(canvas); if (window.initNonKhronosFramework) { - window.initNonKhronosFramework(false); + window.initNonKhronosFramework(true); } +var actual; +var expected; var width = 2; var height = 2; +var continueTestFunc = continueTestPart1; gl.clearColor(1, 1, 1, 1); gl.clear(gl.COLOR_BUFFER_BIT); // Resize the canvas to 2x2. This is an attempt to get stuff in the backbuffer. // that shouldn't be there. +canvas.addEventListener("webglcontextrestored", continueTestAfterContextRestored, false); canvas.width = width; canvas.height = height; - -gl.clearColor(0.5, 0.7, 1.0, 1); -gl.clear(gl.COLOR_BUFFER_BIT); - -var innerColor = [0.5, 0.7, 1.0, 1]; -var outerColor = [0, 0, 0, 0]; - -var tests = [ - { msg: 'in range', checkColor: innerColor, x: 0, y: 0, - oneColor: innerColor, oneX: 0, oneY: 0}, - { msg: 'off top left', checkColor: outerColor, x: -1, y: -1, - oneColor: innerColor, oneX: 1, oneY: 1}, - { msg: 'off bottom right', checkColor: outerColor, x: 1, y: 1, - oneColor: innerColor, oneX: 0, oneY: 0}, - { msg: 'completely off top ', checkColor: outerColor, x: 0, y: -2, - oneColor: outerColor, oneX: 0, oneY: 0}, - { msg: 'completely off bottom', checkColor: outerColor, x: 0, y: 2, - oneColor: outerColor, oneX: 0, oneY: 0}, - { msg: 'completely off left', checkColor: outerColor, x: -2, y: 0, - oneColor: outerColor, oneX: 0, oneY: 0}, - { msg: 'completeley off right', checkColor: outerColor, x: 2, y: 0, - oneColor: outerColor, oneX: 0, oneY: 0} -]; - -for (var tt = 0; tt < tests.length; ++tt) { - var test = tests[tt]; - debug(""); - debug("checking: " + test.msg); - checkBuffer(test.checkColor, test.x, test.y, - test.oneColor, test.oneX, test.oneY); +if (gl.getError() != gl.CONTEXT_LOST_WEBGL) { + continueTestPart1(); } -glErrorShouldBe(gl, gl.NO_ERROR, "there should be no GL errors"); +function continueTestAfterContextRestored() { + window.gl = create3DContext(canvas); + var func = continueTestFunc; + window.continueTestFunc = function() { testFailed("should not be here"); }; + func(); +} -function checkBuffer(checkColor, x, y, oneColor, oneX, oneY) { - var buf = new Uint8Array(width * height * 4); - gl.readPixels(x, y, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf); - for (var yy = 0; yy < height; ++yy) { - for (var xx = 0; xx < width; ++xx) { - var offset = (yy * width + xx) * 4; - var expectedColors = (oneX == xx && oneY == yy) ? oneColor : checkColor; - for (var cc = 0; cc < 4; ++cc) { - var expectedColor = expectedColors[cc] * 255; - var color = buf[offset + cc]; - var diff = Math.abs(expectedColor - color); - assertMsg(diff < 3, - "color pixel at " + xx + ", " + yy + " should be about " + expectedColor); +function continueTestPart1() { + gl.clearColor(0.5, 0.7, 1.0, 1); + gl.clear(gl.COLOR_BUFFER_BIT); + + var innerColor = [0.5, 0.7, 1.0, 1]; + var outerColor = [0, 0, 0, 0]; + + var tests = [ + { msg: 'in range', checkColor: innerColor, x: 0, y: 0, + oneColor: innerColor, oneX: 0, oneY: 0}, + { msg: 'off top left', checkColor: outerColor, x: -1, y: -1, + oneColor: innerColor, oneX: 1, oneY: 1}, + { msg: 'off bottom right', checkColor: outerColor, x: 1, y: 1, + oneColor: innerColor, oneX: 0, oneY: 0}, + { msg: 'completely off top ', checkColor: outerColor, x: 0, y: -2, + oneColor: outerColor, oneX: 0, oneY: 0}, + { msg: 'completely off bottom', checkColor: outerColor, x: 0, y: 2, + oneColor: outerColor, oneX: 0, oneY: 0}, + { msg: 'completely off left', checkColor: outerColor, x: -2, y: 0, + oneColor: outerColor, oneX: 0, oneY: 0}, + { msg: 'completeley off right', checkColor: outerColor, x: 2, y: 0, + oneColor: outerColor, oneX: 0, oneY: 0} + ]; + + for (var tt = 0; tt < tests.length; ++tt) { + var test = tests[tt]; + debug(""); + debug("checking: " + test.msg); + checkBuffer(test.checkColor, test.x, test.y, + test.oneColor, test.oneX, test.oneY); + } + + glErrorShouldBe(gl, gl.NO_ERROR, "there should be no GL errors"); + + function checkBuffer(checkColor, x, y, oneColor, oneX, oneY) { + var buf = new Uint8Array(width * height * 4); + gl.readPixels(x, y, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf); + for (var yy = 0; yy < height; ++yy) { + for (var xx = 0; xx < width; ++xx) { + var offset = (yy * width + xx) * 4; + var expectedColors = (oneX == xx && oneY == yy) ? oneColor : checkColor; + for (var cc = 0; cc < 4; ++cc) { + var expectedColor = expectedColors[cc] * 255; + var color = buf[offset + cc]; + var diff = Math.abs(expectedColor - color); + assertMsg(diff < 3, + "color pixel at " + xx + ", " + yy + " should be about " + expectedColor); + } } } } -} -var badFormats = [ - { - format: gl.RGB, - type: gl.UNSIGNED_BYTE, - dest: new Uint8Array(3) - }, - { - format: gl.RGB, - type: gl.UNSIGNED_SHORT_5_6_5, - dest: new Uint8Array(3) - }, - { - format: gl.RGBA, - type: gl.UNSIGNED_SHORT_5_5_5_1, - dest: new Uint16Array(1) - }, - { - format: gl.RGBA, - type: gl.UNSIGNED_SHORT_4_4_4_4, - dest: new Uint16Array(1) - }, - { - format: gl.ALPHA, - type: gl.UNSIGNED_BYTE, - dest: new Uint8Array(1) - }, - { - format: gl.LUMINANCE, - type: gl.UNSIGNED_BYTE, - dest: new Uint8Array(1) }, - { - format: gl.LUMINANCE_ALPHA, - type: gl.UNSIGNED_BYTE, - dest: new Uint8Array(2) + var badFormats = [ + { + format: gl.RGB, + type: gl.UNSIGNED_BYTE, + dest: new Uint8Array(3), + error: gl.INVALID_OPERATION + }, + { + format: gl.RGB, + type: gl.UNSIGNED_SHORT_5_6_5, + dest: new Uint8Array(3), + error: gl.INVALID_OPERATION + }, + { + format: gl.RGBA, + type: gl.UNSIGNED_SHORT_5_5_5_1, + dest: new Uint16Array(1), + error: gl.INVALID_OPERATION + }, + { + format: gl.RGBA, + type: gl.UNSIGNED_SHORT_4_4_4_4, + dest: new Uint16Array(1), + error: gl.INVALID_OPERATION + }, + { + format: gl.ALPHA, + type: gl.UNSIGNED_BYTE, + dest: new Uint8Array(1), + error: gl.INVALID_OPERATION + }, + { + format: gl.LUMINANCE, + type: gl.UNSIGNED_BYTE, + dest: new Uint8Array(1), + error: gl.INVALID_ENUM + }, + { + format: gl.LUMINANCE_ALPHA, + type: gl.UNSIGNED_BYTE, + dest: new Uint8Array(2), + error: gl.INVALID_ENUM + } + ]; + debug(""); + debug("check disallowed formats"); + for (var tt = 0; tt < badFormats.length; ++ tt) { + var info = badFormats[tt] + var format = info.format; + var type = info.type; + var dest = info.dest; + var error = info.error; + gl.readPixels(0, 0, 1, 1, format, type, dest); + // note that the GL error is INVALID_OPERATION if both format and type are invalid, but + // INVALID_ENUM if only one is. + glErrorShouldBe( + gl, error, + "Should not be able to read as " + wtu.glEnumToString(gl, format) + + " / " + wtu.glEnumToString(gl, type)); } -]; -debug(""); -debug("check disallowed formats"); -for (var tt = 0; tt < badFormats.length; ++ tt) { - var info = badFormats[tt] - var format = info.format; - var type = info.type; - var dest = info.dest; - gl.readPixels(0, 0, 1, 1, format, type, dest); - // note that the GL error is INVALID_OPERATION if both format and type are invalid, but - // INVALID_ENUM if only one is. - glErrorShouldBe( - gl, (format == gl.RGBA || type == gl.UNSIGNED_BYTE) ? gl.INVALID_ENUM : gl.INVALID_OPERATION, - "Should not be able to read as " + wtu.glEnumToString(gl, format) + - " / " + wtu.glEnumToString(gl, type)); -} -debug(""); -debug("check reading with lots of drawing"); -width = 1024; -height = 1024; -canvas.width = width; -canvas.height = height; -gl.viewport(0, 0, 1024, 1024); -var program = wtu.setupTexturedQuad(gl); -var loc = gl.getUniformLocation(program, "tex"); -gl.disable(gl.BLEND); -gl.disable(gl.DEPTH_TEST); -var colors = [[255, 0, 0, 1], [0, 255, 0, 1], [0, 0, 255, 1]]; -var textures = []; -var results = []; -for (var ii = 0; ii < colors.length; ++ii) { - gl.activeTexture(gl.TEXTURE0 + ii); - var tex = gl.createTexture(); - wtu.fillTexture(gl, tex, 1, 1, colors[ii]); - textures.push(tex); -} -for (var ii = 0; ii < colors.length; ++ii) { - for (var jj = 0; jj < 300 + ii + 1; ++jj) { - gl.uniform1i(loc, jj % 3); - gl.drawArrays(gl.TRIANGLES, 0, 6); - } - var buf = new Uint8Array(4); - gl.readPixels(512, 512, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, buf); - results.push(buf); - for (var kk = 0; kk < 99; ++kk) { - gl.uniform1i(loc, (jj + kk) % 3); - gl.drawArrays(gl.TRIANGLES, 0, 6); + debug(""); + debug("check reading with lots of drawing"); + continueTestFunc = continueTestPart2; + width = 1024; + height = 1024; + canvas.width = width; + canvas.height = height; + if (gl.getError() != gl.CONTEXT_LOST_WEBGL) { + continueTestPart2(); } } -var actual; -var expected; -for (var ii = 0; ii < colors.length; ++ii) { - var buf = results[ii]; - var color = colors[ii]; - actual = [buf[0], buf[1], buf[2], buf[3]]; - expected = [color[0], color[1], color[2], color[3] * 255]; - shouldBe("actual", "expected"); -} -glErrorShouldBe(gl, gl.NO_ERROR, "there should be no GL errors"); -debug(""); -successfullyParsed = true; +function continueTestPart2() { + gl.viewport(0, 0, 1024, 1024); + var program = wtu.setupTexturedQuad(gl); + var loc = gl.getUniformLocation(program, "tex"); + gl.disable(gl.BLEND); + gl.disable(gl.DEPTH_TEST); + var colors = [[255, 0, 0, 255], [0, 255, 0, 255], [0, 0, 255, 255]]; + var textures = []; + var results = []; + for (var ii = 0; ii < colors.length; ++ii) { + gl.activeTexture(gl.TEXTURE0 + ii); + var tex = gl.createTexture(); + wtu.fillTexture(gl, tex, 1, 1, colors[ii]); + textures.push(tex); + } + for (var ii = 0; ii < colors.length; ++ii) { + for (var jj = 0; jj < 300 + ii + 1; ++jj) { + gl.uniform1i(loc, jj % 3); + gl.drawArrays(gl.TRIANGLES, 0, 6); + } + var buf = new Uint8Array(4); + gl.readPixels(512, 512, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, buf); + results.push(buf); + for (var kk = 0; kk < 99; ++kk) { + gl.uniform1i(loc, (jj + kk) % 3); + gl.drawArrays(gl.TRIANGLES, 0, 6); + } + } + for (var ii = 0; ii < colors.length; ++ii) { + var buf = results[ii]; + var color = colors[ii]; + actual = [buf[0], buf[1], buf[2], buf[3]]; + expected = [color[0], color[1], color[2], color[3]]; + shouldBe("actual", "expected"); + } + glErrorShouldBe(gl, gl.NO_ERROR, "there should be no GL errors"); + + debug(""); + finishTest(); +} - diff --git a/content/canvas/test/webgl/conformance/resource-sharing-test.html b/content/canvas/test/webgl/conformance/resource-sharing-test.html old mode 100755 new mode 100644 diff --git a/content/canvas/test/webgl/conformance/resources/boolUniformShader.vert b/content/canvas/test/webgl/conformance/resources/boolUniformShader.vert index 87a3339d5632..9226b3b5c0fa 100644 --- a/content/canvas/test/webgl/conformance/resources/boolUniformShader.vert +++ b/content/canvas/test/webgl/conformance/resources/boolUniformShader.vert @@ -16,7 +16,7 @@ * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, diff --git a/content/canvas/test/webgl/conformance/resources/floatUniformShader.vert b/content/canvas/test/webgl/conformance/resources/floatUniformShader.vert index 28de4afb6e30..58991b474164 100644 --- a/content/canvas/test/webgl/conformance/resources/floatUniformShader.vert +++ b/content/canvas/test/webgl/conformance/resources/floatUniformShader.vert @@ -16,7 +16,7 @@ * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, diff --git a/content/canvas/test/webgl/conformance/resources/fragmentShader.frag b/content/canvas/test/webgl/conformance/resources/fragmentShader.frag index e3528726c661..250d0cf1c917 100644 --- a/content/canvas/test/webgl/conformance/resources/fragmentShader.frag +++ b/content/canvas/test/webgl/conformance/resources/fragmentShader.frag @@ -10,7 +10,7 @@ are met: notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY +THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR diff --git a/content/canvas/test/webgl/conformance/resources/gray-ramp-default-gamma.png b/content/canvas/test/webgl/conformance/resources/gray-ramp-default-gamma.png old mode 100755 new mode 100644 diff --git a/content/canvas/test/webgl/conformance/resources/gray-ramp-gamma0.1.png b/content/canvas/test/webgl/conformance/resources/gray-ramp-gamma0.1.png old mode 100755 new mode 100644 diff --git a/content/canvas/test/webgl/conformance/resources/gray-ramp-gamma1.0.png b/content/canvas/test/webgl/conformance/resources/gray-ramp-gamma1.0.png old mode 100755 new mode 100644 diff --git a/content/canvas/test/webgl/conformance/resources/gray-ramp-gamma2.0.png b/content/canvas/test/webgl/conformance/resources/gray-ramp-gamma2.0.png old mode 100755 new mode 100644 diff --git a/content/canvas/test/webgl/conformance/resources/gray-ramp-gamma4.0.png b/content/canvas/test/webgl/conformance/resources/gray-ramp-gamma4.0.png old mode 100755 new mode 100644 diff --git a/content/canvas/test/webgl/conformance/resources/gray-ramp-gamma9.0.png b/content/canvas/test/webgl/conformance/resources/gray-ramp-gamma9.0.png old mode 100755 new mode 100644 diff --git a/content/canvas/test/webgl/conformance/resources/gray-ramp.png b/content/canvas/test/webgl/conformance/resources/gray-ramp.png old mode 100755 new mode 100644 diff --git a/content/canvas/test/webgl/conformance/resources/intUniformShader.vert b/content/canvas/test/webgl/conformance/resources/intUniformShader.vert index f334663b7703..051c05e2b858 100644 --- a/content/canvas/test/webgl/conformance/resources/intUniformShader.vert +++ b/content/canvas/test/webgl/conformance/resources/intUniformShader.vert @@ -16,7 +16,7 @@ * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, diff --git a/content/canvas/test/webgl/conformance/resources/matUniformShader.vert b/content/canvas/test/webgl/conformance/resources/matUniformShader.vert index ddd6d1f3563f..123a4be03bc8 100644 --- a/content/canvas/test/webgl/conformance/resources/matUniformShader.vert +++ b/content/canvas/test/webgl/conformance/resources/matUniformShader.vert @@ -16,7 +16,7 @@ * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, diff --git a/content/canvas/test/webgl/conformance/resources/noopUniformShader.frag b/content/canvas/test/webgl/conformance/resources/noopUniformShader.frag index 96c6c2050fa7..b2dfc9f1d4ed 100644 --- a/content/canvas/test/webgl/conformance/resources/noopUniformShader.frag +++ b/content/canvas/test/webgl/conformance/resources/noopUniformShader.frag @@ -16,7 +16,7 @@ * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, diff --git a/content/canvas/test/webgl/conformance/resources/noopUniformShader.vert b/content/canvas/test/webgl/conformance/resources/noopUniformShader.vert new file mode 100644 index 000000000000..821e440d4c26 --- /dev/null +++ b/content/canvas/test/webgl/conformance/resources/noopUniformShader.vert @@ -0,0 +1,4 @@ +void main() +{ + gl_Position = vec4(0.0, 0.0, 0.0, 1.0); +} diff --git a/content/canvas/test/webgl/conformance/resources/red-indexed.png b/content/canvas/test/webgl/conformance/resources/red-indexed.png new file mode 100644 index 0000000000000000000000000000000000000000..3188d2d75b470db8f73861ca7159f7f4d8e82121 GIT binary patch literal 168 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga%mF?juKyVrBp-2_1G$_99+AZi z4BWyX%*Zfnjs#Fpsl+v+#5q4VH#M(>!MP|ku_QG`p**uBL&4qCH$WjjPa#pkH!-<= zMY%IjHG7GtuPgg)Mj0_H(ZjJx-9RBOPZ!4!j_b(@KsFNt<0HjA#y}Q>r>mdKI;Vst E0FX5%{Qv*} literal 0 HcmV?d00001 diff --git a/content/canvas/test/webgl/conformance/resources/samplerUniformShader.frag b/content/canvas/test/webgl/conformance/resources/samplerUniformShader.frag new file mode 100644 index 000000000000..11cba127460f --- /dev/null +++ b/content/canvas/test/webgl/conformance/resources/samplerUniformShader.frag @@ -0,0 +1,8 @@ +precision mediump float; +uniform sampler2D s2D; +uniform samplerCube sCube; +void main() +{ + gl_FragColor = texture2D(s2D, vec2(0.5, 0.5)) + + textureCube(sCube, vec3(0.5, 0.5, 0.5)); +} diff --git a/content/canvas/test/webgl/conformance/resources/structUniformShader.vert b/content/canvas/test/webgl/conformance/resources/structUniformShader.vert index f0a9d9ae6c52..59c719a0014a 100644 --- a/content/canvas/test/webgl/conformance/resources/structUniformShader.vert +++ b/content/canvas/test/webgl/conformance/resources/structUniformShader.vert @@ -16,7 +16,7 @@ * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, diff --git a/content/canvas/test/webgl/conformance/resources/testrunner.js b/content/canvas/test/webgl/conformance/resources/testrunner.js deleted file mode 100644 index 6d8e9ab31c08..000000000000 --- a/content/canvas/test/webgl/conformance/resources/testrunner.js +++ /dev/null @@ -1,101 +0,0 @@ -/* - * testrunner.js: simple object-oriented test runner for WebGL. - * - * Copyright (c) 2010 Cedric Vivier . - * Use of this source code is governed by a MIT license. - * - * Example usage: - * - * var testsuite = { - * "enable an invalid capability should generate INVALID_VALUE" : function () { - * this.setup = function () { - * gl.enable(0x666); - * }; - * this.expects = gl.INVALID_VALUE; - * }, - * "not using correct parameter type should throw a TypeError" : function () { - * this.setup = function () { - * gl.enable("not a number"); - * }; - * this.expects = "TypeError"; - * }, - * "check that correct image is drawn" : function () { - * this.setup = function () { - * //draw something - * }; - * this.expects = function () { - * //read pixels - * //return true if pixels are okay, false otherwise - * }; - * } - * }; - * runTestsuite(testsuite); - * - */ - -function runTestsuite(testsuite) { - var testname; - function testFatal(message) { - testFailed("FATAL: " + testname + " :: " + message); - } - - var n = 0; - for (testname in testsuite) { -try { - if (testname === "setup" || testname === "teardown") //special functions - continue; - - var test = new testsuite[testname](); - - if (n > 0 && typeof(testsuite.teardown) === "function") - testsuite.teardown(); // teardown code run _after_ EACH test - if (typeof(testsuite.setup) === "function") - testsuite.setup(); // setup code run _before_ EACH test - - n++; - - if (typeof(test.setup) !== "function") { - testFatal("`setup' is not a function."); - continue; - } - test.setup(); - - var err = gl.getError(); - switch (typeof(test.expects)) { - case "number": // expect a GL error - if (err !== test.expects) { - testFailed(testname + " :: got GL error `" + getGLErrorAsString(gl, err) + "' instead of expected `" + getGLErrorAsString(gl, test.expects) + "'."); - continue; - } - break; - case "string": // expect an exception starting with given string - testFailed(testname + " :: expected a `" + test.expects + "' exception but no exception has been caught."); - continue; - case "function": // expect no error and the function to return true - if (err !== gl.NO_ERROR) { - testFailed(testname + " :: got GL error `" + getGLErrorAsString(gl, err) + "' when none was expected."); - continue; - } - if (test.expects() !== true) { - testFailed(testname); - continue; - } - break; - default: - testFatal("`expects' is neither a function or a number (GL error) but `" + typeof(test.expects) + "'."); - continue; - } - testPassed(testname); -} catch (e) { - if (test && typeof(test.expects) === "string") { // an exception was expected - if (e.toString().indexOf(test.expects) === 0) // got expected exception - testPassed(testname); - else // got another exception - testFailed(testname + " :: caught exception `" + e + "' when a `" + test.expects + "' exception was expected."); - continue; - } - testFailed(testname + " :: caught unexpected exception `" + e + "'."); -} - } -} - diff --git a/content/canvas/test/webgl/conformance/resources/vertexShader.vert b/content/canvas/test/webgl/conformance/resources/vertexShader.vert index ad32e71a3734..555a6b007561 100644 --- a/content/canvas/test/webgl/conformance/resources/vertexShader.vert +++ b/content/canvas/test/webgl/conformance/resources/vertexShader.vert @@ -10,7 +10,7 @@ are met: notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY +THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR diff --git a/content/canvas/test/webgl/conformance/resources/webgl-test-utils.js b/content/canvas/test/webgl/conformance/resources/webgl-test-utils.js index fa5c65984920..c5328e134d2b 100644 --- a/content/canvas/test/webgl/conformance/resources/webgl-test-utils.js +++ b/content/canvas/test/webgl/conformance/resources/webgl-test-utils.js @@ -106,7 +106,7 @@ var simpleTextureFragmentShader = '' + 'uniform sampler2D tex;\n' + 'varying vec2 texCoord;\n' + 'void main() {\n' + - ' gl_FragColor = texture2D(tex, texCoord);\n' + + ' gl_FragData[0] = texture2D(tex, texCoord);\n' + '}\n'; /** @@ -262,16 +262,21 @@ var setupTexturedQuad = function( */ var fillTexture = function(gl, tex, width, height, color, opt_level) { opt_level = opt_level || 0; - var canvas = document.createElement('canvas'); - canvas.width = width; - canvas.height = height; - var ctx2d = canvas.getContext('2d'); - ctx2d.fillStyle = "rgba(" + color[0] + "," + color[1] + "," + color[2] + "," + color[3] + ")"; - ctx2d.fillRect(0, 0, width, height); + var numPixels = width * height; + var size = numPixels * 4; + var buf = new Uint8Array(size); + for (var ii = 0; ii < numPixels; ++ii) { + var off = ii * 4; + buf[off + 0] = color[0]; + buf[off + 1] = color[1]; + buf[off + 2] = color[2]; + buf[off + 3] = color[3]; + } gl.bindTexture(gl.TEXTURE_2D, tex); gl.texImage2D( - gl.TEXTURE_2D, opt_level, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas); -}; + gl.TEXTURE_2D, opt_level, gl.RGBA, width, height, 0, + gl.RGBA, gl.UNSIGNED_BYTE, buf); + }; /** * Creates a textures and fills it with a solid color @@ -316,14 +321,17 @@ var drawQuad = function(gl, opt_color) { * @param {!Array.} color The color to fill clear with before drawing. A * 4 element array where each element is in the range 0 to 255. * @param {string} msg Message to associate with success. Eg ("should be red"). + * @param {number} errorRange Optional. Acceptable error in + * color checking. 0 by default. */ -var checkCanvasRect = function(gl, x, y, width, height, color, msg) { +var checkCanvasRect = function(gl, x, y, width, height, color, msg, errorRange) { + errorRange = errorRange || 0; var buf = new Uint8Array(width * height * 4); gl.readPixels(x, y, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf); for (var i = 0; i < width * height; ++i) { var offset = i * 4; for (var j = 0; j < color.length; ++j) { - if (buf[offset + j] != color[j]) { + if (Math.abs(buf[offset + j] - color[j]) > errorRange) { testFailed(msg); var was = buf[offset + 0].toString(); for (j = 1; j < color.length; ++j) { @@ -639,6 +647,11 @@ var loadShader = function(gl, shaderSource, shaderType) { // Load the shader source gl.shaderSource(shader, shaderSource); + var err = gl.getError(); + if (err != gl.NO_ERROR) { + error("*** Error loading shader '" + shader + "':" + glEnumToString(gl, err)); + return null; + } // Compile the shader gl.compileShader(shader); diff --git a/content/canvas/test/webgl/conformance/resources/zero-alpha.png b/content/canvas/test/webgl/conformance/resources/zero-alpha.png old mode 100755 new mode 100644 diff --git a/content/canvas/test/webgl/conformance/shaders/00_shaders.txt b/content/canvas/test/webgl/conformance/shaders/00_shaders.txt index 31dcaeafdc61..32dfe2ded8f1 100644 --- a/content/canvas/test/webgl/conformance/shaders/00_shaders.txt +++ b/content/canvas/test/webgl/conformance/shaders/00_shaders.txt @@ -1,3 +1,4 @@ implicit/00_shaders.txt +misc/00_shaders.txt reserved/00_shaders.txt diff --git a/content/canvas/test/webgl/conformance/shaders/misc/00_shaders.txt b/content/canvas/test/webgl/conformance/shaders/misc/00_shaders.txt new file mode 100644 index 000000000000..3bcf92e5ba47 --- /dev/null +++ b/content/canvas/test/webgl/conformance/shaders/misc/00_shaders.txt @@ -0,0 +1,3 @@ +non-ascii.vert +non-ascii-comments.vert + diff --git a/content/canvas/test/webgl/conformance/shaders/misc/non-ascii-comments.vert b/content/canvas/test/webgl/conformance/shaders/misc/non-ascii-comments.vert new file mode 100644 index 000000000000..2f906a808769 --- /dev/null +++ b/content/canvas/test/webgl/conformance/shaders/misc/non-ascii-comments.vert @@ -0,0 +1,9 @@ +// Non ascii comments in source should succeed +// ‚±‚ê‚Í‚`‚r‚b‚h‚h‚Å‚Í‚È‚¢‚Å‚·B +// ‚s‚ˆ‚‰‚“@‚h‚“@‚m‚‚”@‚`‚r‚b‚h‚h +/* + * ‚s‚ˆ‚‰‚“@‚h‚“@‚m‚‚”@‚`‚r‚b‚h‚h + */ +void main() { + gl_Position = vec4(1,1,1,1); +} diff --git a/content/canvas/test/webgl/conformance/shaders/misc/non-ascii.vert b/content/canvas/test/webgl/conformance/shaders/misc/non-ascii.vert new file mode 100644 index 000000000000..cc80bc4032b0 --- /dev/null +++ b/content/canvas/test/webgl/conformance/shaders/misc/non-ascii.vert @@ -0,0 +1,8 @@ +// Non ascii data in source should fail +// See GLSL ES Spec 1.0.17 section 3.1 and 3.2 +// ‚±‚ê‚Í‚`‚r‚b‚h‚h‚Å‚Í‚È‚¢‚Å‚·B +// ‚s‚ˆ‚‰‚“@‚h‚“@‚m‚‚”@‚`‚r‚b‚h‚h +uniform mat4 ‚m‚‚”‚`‚r‚b‚h‚h; +void main() { + gl_Position = vec4(1,1,1,1); +} diff --git a/content/canvas/test/webgl/conformance/tex-image-and-sub-image-2d-with-image-data.html b/content/canvas/test/webgl/conformance/tex-image-and-sub-image-2d-with-image-data.html index 608f0f902f2c..0fba1a09bd3d 100644 --- a/content/canvas/test/webgl/conformance/tex-image-and-sub-image-2d-with-image-data.html +++ b/content/canvas/test/webgl/conformance/tex-image-and-sub-image-2d-with-image-data.html @@ -122,17 +122,7 @@ function runTest() runOneIteration(true, false, true, greenPremultiplyAlpha, redPremultiplyAlpha); - successfullyParsed = true; - var epilogue = document.createElement("script"); - epilogue.onload = finish; - epilogue.src = "../resources/js-test-post.js"; - document.body.appendChild(epilogue); -} - -function finish() { - if (window.nonKhronosFrameworkNotifyDone) { - window.nonKhronosFrameworkNotifyDone(); - } + finishTest(); } diff --git a/content/canvas/test/webgl/conformance/tex-image-and-sub-image-2d-with-image.html b/content/canvas/test/webgl/conformance/tex-image-and-sub-image-2d-with-image.html index 477d076e780f..7d9b7b62e9df 100644 --- a/content/canvas/test/webgl/conformance/tex-image-and-sub-image-2d-with-image.html +++ b/content/canvas/test/webgl/conformance/tex-image-and-sub-image-2d-with-image.html @@ -57,6 +57,7 @@ function runOneIteration(image, useTexSubImage2D, flipY, topColor, bottomColor) // Set up pixel store parameters gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipY); gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false); + gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.NONE); // Upload the image into the texture if (useTexSubImage2D) { // Initialize the texture to black first @@ -90,18 +91,9 @@ function runTest(image) runOneIteration(image, true, true, red, green); runOneIteration(image, true, false, green, red); - successfullyParsed = true; - var epilogue = document.createElement("script"); - epilogue.onload = finish; - epilogue.src = "../resources/js-test-post.js"; - document.body.appendChild(epilogue); + finishTest(); } -function finish() { - if (window.nonKhronosFrameworkNotifyDone) { - window.nonKhronosFrameworkNotifyDone(); - } -} diff --git a/content/canvas/test/webgl/conformance/tex-image-and-sub-image-2d-with-video.html b/content/canvas/test/webgl/conformance/tex-image-and-sub-image-2d-with-video.html index 7ab405275928..c87ffc172e6a 100644 --- a/content/canvas/test/webgl/conformance/tex-image-and-sub-image-2d-with-video.html +++ b/content/canvas/test/webgl/conformance/tex-image-and-sub-image-2d-with-video.html @@ -15,12 +15,12 @@ var gl = null; var textureLoc = null; var successfullyParsed = false; +if (window.initNonKhronosFramework) { + window.initNonKhronosFramework(true); +} + function init() { - if (window.initNonKhronosFramework) { - window.initNonKhronosFramework(true); - } - description('Verify texImage2D and texSubImage2D code paths taking Video Elements'); var canvas = document.getElementById("example"); @@ -104,17 +104,7 @@ function runTest(videoElement) runOneIteration(videoElement, true, true, red, green); runOneIteration(videoElement, true, false, green, red); - successfullyParsed = true; - var epilogue = document.createElement("script"); - epilogue.onload = finish; - epilogue.src = "../resources/js-test-post.js"; - document.body.appendChild(epilogue); -} - -function finish() { - if (window.nonKhronosFrameworkNotifyDone) { - window.nonKhronosFrameworkNotifyDone(); - } + finishTest(); } @@ -129,8 +119,3 @@ function finish() { - - - - - diff --git a/content/canvas/test/webgl/conformance/tex-image-with-format-and-type.html b/content/canvas/test/webgl/conformance/tex-image-with-format-and-type.html index 4a286c0cd4ec..8f56a3d80e5d 100644 --- a/content/canvas/test/webgl/conformance/tex-image-with-format-and-type.html +++ b/content/canvas/test/webgl/conformance/tex-image-with-format-and-type.html @@ -358,11 +358,7 @@ function maybeRunTests() for (var i = 0; i < testCases.length; ++i) runOneTest(testCases[i]); - successfullyParsed = true; - var epilogue = document.createElement("script"); - epilogue.onload = finish; - epilogue.src = "../resources/js-test-post.js"; - document.body.appendChild(epilogue); + finishTest(); } function testCaseToString(testCase) @@ -434,12 +430,6 @@ function runOneTest(testCase) testFailed(testCase.description); } -function finish() { - if (window.nonKhronosFrameworkNotifyDone) { - window.nonKhronosFrameworkNotifyDone(); - } -} - //---------------------------------------------------------------------- // Wrappers for programmatic construction of Image, ImageData and raw texture data // diff --git a/content/canvas/test/webgl/conformance/tex-input-validation.html b/content/canvas/test/webgl/conformance/tex-input-validation.html index a64774a4ddfc..1ec16031f209 100644 --- a/content/canvas/test/webgl/conformance/tex-input-validation.html +++ b/content/canvas/test/webgl/conformance/tex-input-validation.html @@ -8,25 +8,37 @@ found in the LICENSE file. +
diff --git a/content/canvas/test/webgl/conformance/tex-sub-image-2d-bad-args.html b/content/canvas/test/webgl/conformance/tex-sub-image-2d-bad-args.html new file mode 100644 index 000000000000..d197777844e9 --- /dev/null +++ b/content/canvas/test/webgl/conformance/tex-sub-image-2d-bad-args.html @@ -0,0 +1,65 @@ + + + + + + + + + + +
+
+ + + + diff --git a/content/canvas/test/webgl/conformance/texture-active-bind-2.html b/content/canvas/test/webgl/conformance/texture-active-bind-2.html index c6ddddb4ed54..b7e15acc060c 100644 --- a/content/canvas/test/webgl/conformance/texture-active-bind-2.html +++ b/content/canvas/test/webgl/conformance/texture-active-bind-2.html @@ -57,7 +57,7 @@ function init() window.initNonKhronosFramework(false); } - debug("Tests that binding both TEXTURE_2D and TEXTURE_3D to the same"); + debug("Tests that binding both TEXTURE_2D and TEXTURE_CUBE_MAP to the same"); debug("active texture unit works as long as they are not used"); debug("simultaneously in the same shader program."); debug(""); @@ -66,11 +66,12 @@ function init() var ctx2d = canvas2d.getContext("2d"); ctx2d.globalCompositeOperation = "copy"; - gl = initWebGL("example", "vshader", "fshader2d", [ "vPosition", "texCoord0"], + gl = initWebGL("example", "vshader", "fshader2d", ["vPosition", "texCoord0"], [ 0, 0, 0, 1 ], 1); var program2d = gl.program; - var programCube = loadProgram(gl, "vshader", "fshaderCube", false); + var programCube = createProgram( + gl, "vshader", "fshaderCube", ["vPosition", "texCoord0"]); gl.disable(gl.DEPTH_TEST); gl.disable(gl.BLEND); diff --git a/content/canvas/test/webgl/conformance/texture-active-bind.html b/content/canvas/test/webgl/conformance/texture-active-bind.html old mode 100755 new mode 100644 diff --git a/content/canvas/test/webgl/conformance/texture-complete.html b/content/canvas/test/webgl/conformance/texture-complete.html old mode 100755 new mode 100644 index 240b08293039..0b4b3c748bb9 --- a/content/canvas/test/webgl/conformance/texture-complete.html +++ b/content/canvas/test/webgl/conformance/texture-complete.html @@ -31,7 +31,7 @@ function init() var canvas2d = document.getElementById("canvas2d"); var ctx2d = canvas2d.getContext("2d"); - ctx2d.fillStyle = "rgba(0,192,128,255)"; + ctx2d.fillStyle = "rgba(0,192,128,1)"; ctx2d.fillRect(0, 0, 16, 16); var wtu = WebGLTestUtils; diff --git a/content/canvas/test/webgl/conformance/texture-formats-test.html b/content/canvas/test/webgl/conformance/texture-formats-test.html old mode 100755 new mode 100644 diff --git a/content/canvas/test/webgl/conformance/texture-npot.html b/content/canvas/test/webgl/conformance/texture-npot.html old mode 100755 new mode 100644 diff --git a/content/canvas/test/webgl/conformance/texture-transparent-pixels-initialized.html b/content/canvas/test/webgl/conformance/texture-transparent-pixels-initialized.html index c4d3962eb118..fb9733273d4b 100644 --- a/content/canvas/test/webgl/conformance/texture-transparent-pixels-initialized.html +++ b/content/canvas/test/webgl/conformance/texture-transparent-pixels-initialized.html @@ -101,17 +101,7 @@ function runTest() wtu.checkCanvasRect(gl, 1, 1, 2, 2, color, "shouldBe " + color); - successfullyParsed = true; - var epilogue = document.createElement("script"); - epilogue.onload = finish; - epilogue.src = "../resources/js-test-post.js"; - document.body.appendChild(epilogue); -} - -function finish() { - if (window.nonKhronosFrameworkNotifyDone) { - window.nonKhronosFrameworkNotifyDone(); - } + finishTest(); } diff --git a/content/canvas/test/webgl/conformance/uniform-location.html b/content/canvas/test/webgl/conformance/uniform-location.html index 99d9bd56d8e8..802249aadb6b 100644 --- a/content/canvas/test/webgl/conformance/uniform-location.html +++ b/content/canvas/test/webgl/conformance/uniform-location.html @@ -81,6 +81,18 @@ shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.linkProgram(program // After linking all boxes are bad. shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.uniformMatrix4fv(locationA, false, mat)"); +// after re-linking the same program, all uniform locations become invalid. +shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.useProgram(programS)"); +shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.linkProgram(programS)"); +shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.uniform1i(locationSx, 3)"); +shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.getUniform(programS, locationSx)"); + +// Retrieve the locations again, and they should be good. +locationSx = contextA.getUniformLocation(programS, "u_struct.x"); +locationArray0 = contextA.getUniformLocation(programS, "u_array[0]"); +shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.uniform1i(locationSx, 3)"); +shouldBe("contextA.getUniform(programS, locationSx)", "3"); + successfullyParsed = true; diff --git a/content/canvas/test/webgl/conformance/uninitialized-test.html b/content/canvas/test/webgl/conformance/uninitialized-test.html index 31855b3fb2ac..38accd463b42 100644 --- a/content/canvas/test/webgl/conformance/uninitialized-test.html +++ b/content/canvas/test/webgl/conformance/uninitialized-test.html @@ -21,52 +21,57 @@ if (!gl) else testPassed("Context created."); -debug("Reading an uninitialized texture should succeed with all bytes set to 0."); +function setupTexture(texWidth, texHeight) { + var texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, texture); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, texWidth, texHeight, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); -var width = 512; -var height = 512; -var bpp = 4; -var expectedDataLength = width*height*bpp; + // this can be quite undeterministic so to improve odds of seeing uninitialized data write bits + // into tex then delete texture then re-create one with same characteristics (driver will likely reuse mem) + // with this trick on r59046 WebKit/OSX I get FAIL 100% of the time instead of ~15% of the time. -var tex = gl.createTexture(); -gl.bindTexture(gl.TEXTURE_2D, tex); -gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + var badData = new Uint8Array(texWidth * texHeight * 4); + for (var i = 0; i < badData.length; ++i) + badData[i] = i % 255; -// this can be quite undeterministic so to improve odds of seeing uninitialized data write bits -// into tex then delete texture then re-create one with same characteristics (driver will likely reuse mem) -// with this trick on r59046 WebKit/OSX I get FAIL 100% of the time instead of ~15% of the time. + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, texWidth, texHeight, gl.RGBA, gl.UNSIGNED_BYTE, badData); + gl.finish(); // make sure it has been uploaded -var badData = new Uint8Array(expectedDataLength); -for (var i = 0; i < badData.length; ++i) - badData[i] = i % 255; + gl.deleteTexture(texture); + gl.finish(); // make sure it has been deleted -gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, badData); -gl.finish(); // make sure it has been uploaded + var texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, texture); + return texture; +} -gl.deleteTexture(tex); -gl.finish(); // make sure it has been deleted +function checkNonZeroPixels(texture, texWidth, texHeight, skipX, skipY, skipWidth, skipHeight, skipR, skipG, skipB, skipA) { + gl.bindTexture(gl.TEXTURE_2D, null); + var fb = gl.createFramebuffer(); + gl.bindFramebuffer(gl.FRAMEBUFFER, fb); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0); + shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE"); -var tex = gl.createTexture(); -gl.bindTexture(gl.TEXTURE_2D, tex); -gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + var data = new Uint8Array(texWidth * texHeight * 4); + gl.readPixels(0, 0, texWidth, texHeight, gl.RGBA, gl.UNSIGNED_BYTE, data); -var fb = gl.createFramebuffer(); -gl.bindFramebuffer(gl.FRAMEBUFFER, fb); -gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tex, 0); - -data = new Uint8Array(width * height * 4); -gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, data); - -if (data.length != expectedDataLength) { - testFailed("expected data length " + expectedDataLength + " but got " + data.length + " instead."); -} else { var k = 0; - for (var i = 0; i < data.length; ++i) { - if (data[i] != 0) { - k++; + for (var y = 0; y < texHeight; ++y) { + for (var x = 0; x < texWidth; ++x) { + var index = (y * texWidth + x) * 4; + if (x >= skipX && x < skipX + skipWidth && y >= skipY && y < skipY + skipHeight) { + if (data[index] != skipR || data[index + 1] != skipG || data[index + 2] != skipB || data[index + 3] != skipA) { + testFailed("non-zero pixel values are wrong"); + return; + } + } else { + for (var i = 0; i < 4; ++i) { + if (data[index + i] != 0) + k++; + } + } } } - if (k) { testFailed("Found " + k + " non-zero bytes"); } else { @@ -74,6 +79,77 @@ if (data.length != expectedDataLength) { } } +var width = 512; +var height = 512; + +debug(""); +debug("Reading an uninitialized texture (texImage2D) should succeed with all bytes set to 0."); + +var tex = setupTexture(width, height); +gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); +checkNonZeroPixels(tex, width, height, 0, 0, 0, 0, 0, 0, 0, 0); +gl.deleteTexture(tex); +gl.finish(); +glErrorShouldBe(gl, gl.NO_ERROR); + +debug(""); +debug("Reading an uninitialized portion of a texture (copyTexImage2D) should succeed with all bytes set to 0."); + +var tex = setupTexture(width, height); +var fbo = gl.createFramebuffer(); +gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); +var rbo = gl.createRenderbuffer(); +gl.bindRenderbuffer(gl.RENDERBUFFER, rbo); +var fboWidth = 16; +var fboHeight = 16; +gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, fboWidth, fboHeight); +gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, rbo); +shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE"); +gl.clearColor(1.0, 0.0, 0.0, 1.0); +gl.clear(gl.COLOR_BUFFER_BIT); +glErrorShouldBe(gl, gl.NO_ERROR); +gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 0, 0, width, height, 0); +checkNonZeroPixels(tex, width, height, 0, 0, fboWidth, fboHeight, 255, 0, 0, 255); +gl.deleteTexture(tex); +gl.finish(); +glErrorShouldBe(gl, gl.NO_ERROR); + +debug(""); +debug("Reading an uninitialized portion of a texture (copyTexImage2D with negative x and y) should succeed with all bytes set to 0."); + +var tex = setupTexture(width, height); +var fbo = gl.createFramebuffer(); +gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); +var rbo = gl.createRenderbuffer(); +gl.bindRenderbuffer(gl.RENDERBUFFER, rbo); +var fboWidth = 16; +var fboHeight = 16; +gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, fboWidth, fboHeight); +gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, rbo); +shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE"); +gl.clearColor(1.0, 0.0, 0.0, 1.0); +gl.clear(gl.COLOR_BUFFER_BIT); +glErrorShouldBe(gl, gl.NO_ERROR); +var x = -8; +var y = -8; +gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, x, y, width, height, 0); +checkNonZeroPixels(tex, width, height, -x, -y, fboWidth, fboHeight, 255, 0, 0, 255); +gl.deleteTexture(tex); +gl.finish(); +glErrorShouldBe(gl, gl.NO_ERROR); + +debug(""); +debug("Reading an uninitialized portion of a texture (copyTexImage2D from WebGL internal fbo) should succeed with all bytes set to 0."); + +var tex = setupTexture(width, height); +gl.bindFramebuffer(gl.FRAMEBUFFER, null); +gl.clearColor(0.0, 1.0, 0.0, 0.0); +gl.clear(gl.COLOR_BUFFER_BIT); +glErrorShouldBe(gl, gl.NO_ERROR); +gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 0, 0, width, height, 0); +checkNonZeroPixels(tex, width, height, 0, 0, canvas.width, canvas.height, 0, 255, 0, 0); +gl.deleteTexture(tex); +gl.finish(); glErrorShouldBe(gl, gl.NO_ERROR); //TODO: uninitialized vertex array buffer diff --git a/content/canvas/test/webgl/conformance/viewport-unchanged-upon-resize.html b/content/canvas/test/webgl/conformance/viewport-unchanged-upon-resize.html index 9b41b9f9cba2..a88ba9250f6e 100644 --- a/content/canvas/test/webgl/conformance/viewport-unchanged-upon-resize.html +++ b/content/canvas/test/webgl/conformance/viewport-unchanged-upon-resize.html @@ -32,6 +32,7 @@ void main() + diff --git a/content/canvas/test/webgl/conformance/webgl-specific.html b/content/canvas/test/webgl/conformance/webgl-specific.html index 29bc2c8c7f7a..61a1f846f44d 100644 --- a/content/canvas/test/webgl/conformance/webgl-specific.html +++ b/content/canvas/test/webgl/conformance/webgl-specific.html @@ -22,95 +22,75 @@ var wtu = WebGLTestUtils; description("Tests the a few differences between WebGL and GLES2"); var gl = wtu.create3DContext(); +var program = wtu.loadStandardProgram(gl); +gl.useProgram(program); +var vertexObject = gl.createBuffer(); +gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject); +gl.enableVertexAttribArray(0); +glErrorShouldBe(gl, gl.NO_ERROR, "Setup should succeed"); -gl.blendFunc(gl.CONSTANT_COLOR, gl.CONSTANT_ALPHA); -glErrorShouldBe(gl, gl.INVALID_OPERATION, - "constant color and constant alpha cannot be used together as source and destination factors in the blend function"); -gl.blendFunc(gl.ONE_MINUS_CONSTANT_COLOR, gl.CONSTANT_ALPHA); -glErrorShouldBe(gl, gl.INVALID_OPERATION, - "constant color and constant alpha cannot be used together as source and destination factors in the blend function"); -gl.blendFunc(gl.CONSTANT_COLOR, gl.ONE_MINUS_CONSTANT_ALPHA); -glErrorShouldBe(gl, gl.INVALID_OPERATION, - "constant color and constant alpha cannot be used together as source and destination factors in the blend function"); -gl.blendFunc(gl.ONE_MINUS_CONSTANT_COLOR, gl.ONE_MINUS_CONSTANT_ALPHA); -glErrorShouldBe(gl, gl.INVALID_OPERATION, - "constant color and constant alpha cannot be used together as source and destination factors in the blend function"); -gl.blendFunc(gl.CONSTANT_ALPHA, gl.CONSTANT_COLOR); -glErrorShouldBe(gl, gl.INVALID_OPERATION, - "constant color and constant alpha cannot be used together as source and destination factors in the blend function"); -gl.blendFunc(gl.CONSTANT_ALPHA, gl.ONE_MINUS_CONSTANT_COLOR); -glErrorShouldBe(gl, gl.INVALID_OPERATION, - "constant color and constant alpha cannot be used together as source and destination factors in the blend function"); -gl.blendFunc(gl.ONE_MINUS_CONSTANT_ALPHA, gl.CONSTANT_COLOR); -glErrorShouldBe(gl, gl.INVALID_OPERATION, - "constant color and constant alpha cannot be used together as source and destination factors in the blend function"); -gl.blendFunc(gl.ONE_MINUS_CONSTANT_ALPHA, gl.ONE_MINUS_CONSTANT_COLOR); -glErrorShouldBe(gl, gl.INVALID_OPERATION, - "constant color and constant alpha cannot be used together as source and destination factors in the blend function"); +debug(""); +debug("Verify that constant color and constant alpha cannot be used together as source and destination factors in the blend function"); +shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFunc(gl.CONSTANT_COLOR, gl.CONSTANT_ALPHA)"); +shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFunc(gl.ONE_MINUS_CONSTANT_COLOR, gl.CONSTANT_ALPHA)"); +shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFunc(gl.CONSTANT_COLOR, gl.ONE_MINUS_CONSTANT_ALPHA)"); +shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFunc(gl.ONE_MINUS_CONSTANT_COLOR, gl.ONE_MINUS_CONSTANT_ALPHA)"); +shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFunc(gl.CONSTANT_ALPHA, gl.CONSTANT_COLOR)"); +shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFunc(gl.CONSTANT_ALPHA, gl.ONE_MINUS_CONSTANT_COLOR)"); +shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFunc(gl.ONE_MINUS_CONSTANT_ALPHA, gl.CONSTANT_COLOR)"); +shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFunc(gl.ONE_MINUS_CONSTANT_ALPHA, gl.ONE_MINUS_CONSTANT_COLOR)"); -gl.blendFuncSeparate(gl.CONSTANT_COLOR, gl.CONSTANT_ALPHA, gl.ONE, gl.ZERO); -glErrorShouldBe(gl, gl.INVALID_OPERATION, - "constant color and constant alpha cannot be used together as source and destination factors in the blend function"); -gl.blendFuncSeparate(gl.ONE_MINUS_CONSTANT_COLOR, gl.CONSTANT_ALPHA, gl.ONE, gl.ZERO); -glErrorShouldBe(gl, gl.INVALID_OPERATION, - "constant color and constant alpha cannot be used together as source and destination factors in the blend function"); -gl.blendFuncSeparate(gl.CONSTANT_COLOR, gl.ONE_MINUS_CONSTANT_ALPHA, gl.ONE, gl.ZERO); -glErrorShouldBe(gl, gl.INVALID_OPERATION, - "constant color and constant alpha cannot be used together as source and destination factors in the blend function"); -gl.blendFuncSeparate(gl.ONE_MINUS_CONSTANT_COLOR, gl.ONE_MINUS_CONSTANT_ALPHA, gl.ONE, gl.ZERO); -glErrorShouldBe(gl, gl.INVALID_OPERATION, - "constant color and constant alpha cannot be used together as source and destination factors in the blend function"); -gl.blendFuncSeparate(gl.CONSTANT_ALPHA, gl.CONSTANT_COLOR, gl.ONE, gl.ZERO); -glErrorShouldBe(gl, gl.INVALID_OPERATION, - "constant color and constant alpha cannot be used together as source and destination factors in the blend function"); -gl.blendFuncSeparate(gl.CONSTANT_ALPHA, gl.ONE_MINUS_CONSTANT_COLOR, gl.ONE, gl.ZERO); -glErrorShouldBe(gl, gl.INVALID_OPERATION, - "constant color and constant alpha cannot be used together as source and destination factors in the blend function"); -gl.blendFuncSeparate(gl.ONE_MINUS_CONSTANT_ALPHA, gl.CONSTANT_COLOR, gl.ONE, gl.ZERO); -glErrorShouldBe(gl, gl.INVALID_OPERATION, - "constant color and constant alpha cannot be used together as source and destination factors in the blend function"); -gl.blendFuncSeparate(gl.ONE_MINUS_CONSTANT_ALPHA, gl.ONE_MINUS_CONSTANT_COLOR, gl.ONE, gl.ZERO); -glErrorShouldBe(gl, gl.INVALID_OPERATION, - "constant color and constant alpha cannot be used together as source and destination factors in the blend function"); +shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFuncSeparate(gl.CONSTANT_COLOR, gl.CONSTANT_ALPHA, gl.ONE, gl.ZERO)"); +shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFuncSeparate(gl.ONE_MINUS_CONSTANT_COLOR, gl.CONSTANT_ALPHA, gl.ONE, gl.ZERO)"); +shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFuncSeparate(gl.CONSTANT_COLOR, gl.ONE_MINUS_CONSTANT_ALPHA, gl.ONE, gl.ZERO)"); +shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFuncSeparate(gl.ONE_MINUS_CONSTANT_COLOR, gl.ONE_MINUS_CONSTANT_ALPHA, gl.ONE, gl.ZERO)"); +shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFuncSeparate(gl.CONSTANT_ALPHA, gl.CONSTANT_COLOR, gl.ONE, gl.ZERO)"); +shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFuncSeparate(gl.CONSTANT_ALPHA, gl.ONE_MINUS_CONSTANT_COLOR, gl.ONE, gl.ZERO)"); +shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFuncSeparate(gl.ONE_MINUS_CONSTANT_ALPHA, gl.CONSTANT_COLOR, gl.ONE, gl.ZERO)"); +shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFuncSeparate(gl.ONE_MINUS_CONSTANT_ALPHA, gl.ONE_MINUS_CONSTANT_COLOR, gl.ONE, gl.ZERO)"); -gl.depthRange(20, 10); -glErrorShouldBe(gl, gl.INVALID_OPERATION, - "depthRange should generate INVALID_OPERATION if zNear is greater than zFar"); +debug(""); +debug("Verify that in depthRange zNear <= zFar"); +shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.depthRange(20, 10)"); -gl.stencilMask(255); -glErrorShouldBe(gl, gl.NO_ERROR, - "stencilMask should generate no error"); -gl.stencilMaskSeparate(gl.FRONT, 1); -glErrorShouldBe(gl, gl.INVALID_OPERATION, - "a different mask value for front and back facing is illegal"); -gl.stencilMaskSeparate(gl.BACK, 1); -glErrorShouldBe(gl, gl.INVALID_OPERATION, - "a different mask value for front and back facing is illegal"); +debug(""); +debug("Verify that front/back settings should be the same for stenclMask and stencilFunc"); +shouldGenerateGLError(gl, gl.NO_ERROR, "gl.stencilMask(255)"); +shouldGenerateGLError(gl, gl.NO_ERROR, "gl.drawArrays(gl.TRIANGLES, 0, 0)"); +shouldGenerateGLError(gl, gl.NO_ERROR, "gl.stencilMaskSeparate(gl.FRONT, 1)"); +shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.drawArrays(gl.TRIANGLES, 0, 0)"); +shouldGenerateGLError(gl, gl.NO_ERROR, "gl.stencilMaskSeparate(gl.BACK, 1)"); +shouldGenerateGLError(gl, gl.NO_ERROR, "gl.drawArrays(gl.TRIANGLES, 0, 0)"); -gl.stencilFunc(gl.ALWAYS, 0, 255); -glErrorShouldBe(gl, gl.NO_ERROR, - "stencilFunc should generate no error"); -gl.stencilFuncSeparate(gl.FRONT, gl.ALWAYS, 1, 255); -glErrorShouldBe(gl, gl.INVALID_OPERATION, - "a different reference value for front and back facing is illegal"); -gl.stencilFuncSeparate(gl.BACK, gl.ALWAYS, 1, 255); -glErrorShouldBe(gl, gl.INVALID_OPERATION, - "a different reference value for front and back facing is illegal"); -gl.stencilFuncSeparate(gl.FRONT, gl.ALWAYS, 0, 1); -glErrorShouldBe(gl, gl.INVALID_OPERATION, - "a different mask value for front and back facing is illegal"); -gl.stencilFuncSeparate(gl.BACK, gl.ALWAYS, 0, 1); -glErrorShouldBe(gl, gl.INVALID_OPERATION, - "a different mask value for front and back facing is illegal"); +shouldGenerateGLError(gl, gl.NO_ERROR, "gl.stencilFunc(gl.ALWAYS, 0, 255)"); +shouldGenerateGLError(gl, gl.NO_ERROR, "gl.drawArrays(gl.TRIANGLES, 0, 0)"); +shouldGenerateGLError(gl, gl.NO_ERROR, "gl.stencilFuncSeparate(gl.BACK, gl.ALWAYS, 1, 255)"); +shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.drawArrays(gl.TRIANGLES, 0, 0)"); +shouldGenerateGLError(gl, gl.NO_ERROR, "gl.stencilFuncSeparate(gl.FRONT, gl.ALWAYS, 1, 255)"); +shouldGenerateGLError(gl, gl.NO_ERROR, "gl.drawArrays(gl.TRIANGLES, 0, 0)"); +shouldGenerateGLError(gl, gl.NO_ERROR, "gl.stencilFuncSeparate(gl.BACK, gl.ALWAYS, 1, 1)"); +shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.drawArrays(gl.TRIANGLES, 0, 0)"); +shouldGenerateGLError(gl, gl.NO_ERROR, "gl.stencilFuncSeparate(gl.FRONT, gl.ALWAYS, 1, 1)"); +shouldGenerateGLError(gl, gl.NO_ERROR, "gl.drawArrays(gl.TRIANGLES, 0, 0)"); +debug(""); +debug("Verify that IMPLEMENTATION_COLOR_READ_FORMAT and IMPLEMENTATION_COLOR_READ_TYPE are undefined"); shouldBeUndefined(gl.IMPLEMENTATION_COLOR_READ_FORMAT); shouldBeUndefined(gl.IMPLEMENTATION_COLOR_READ_TYPE); +debug(""); +debug("Verify that *LENGTH are undefined"); +shouldBeUndefined(gl.INFO_LOG_LENGTH); +shouldBeUndefined(gl.SHADER_SOURCE_LENGTH); +shouldBeUndefined(gl.ACTIVE_UNIFORM_MAX_LENGTH); +shouldBeUndefined(gl.ACTIVE_ATTRIB_MAX_LENGTH); + +debug(""); +debug("Verify that UNPACK_COLORSPACE_CONVERSION_WEBGL is supported"); shouldBe("gl.getParameter(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL)", "gl.BROWSER_DEFAULT_WEBGL"); gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.NONE); shouldBe("gl.getParameter(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL)", "gl.NONE"); -glErrorShouldBe(gl, gl.NO_ERROR, - "set/get UNPACK_COLORSPACE_CONVERSION_WEBGL should generate no error"); +glErrorShouldBe(gl, gl.NO_ERROR, "set/get UNPACK_COLORSPACE_CONVERSION_WEBGL should generate no error"); successfullyParsed = true; diff --git a/content/canvas/test/webgl/delete-quickCheckAPI.patch b/content/canvas/test/webgl/delete-quickCheckAPI.patch new file mode 100644 index 000000000000..11391ed25776 --- /dev/null +++ b/content/canvas/test/webgl/delete-quickCheckAPI.patch @@ -0,0 +1,19 @@ +# HG changeset patch +# Parent 0d4172be40b03cc4dbe704244623174363cec0bf +diff --git a/content/canvas/test/webgl/conformance/more/00_test_list.txt b/content/canvas/test/webgl/conformance/more/00_test_list.txt +--- a/content/canvas/test/webgl/conformance/more/00_test_list.txt ++++ b/content/canvas/test/webgl/conformance/more/00_test_list.txt +@@ -1,12 +1,12 @@ + conformance/constants.html + conformance/getContext.html + conformance/methods.html +-conformance/quickCheckAPI.html ++#conformance/quickCheckAPI.html + conformance/webGLArrays.html + functions/bindBuffer.html + functions/bindBufferBadArgs.html + functions/bindFramebufferLeaveNonZero.html + functions/bufferData.html + functions/bufferDataBadArgs.html + functions/bufferSubData.html + functions/bufferSubDataBadArgs.html diff --git a/content/canvas/test/webgl/disable-gl-min-textures.patch b/content/canvas/test/webgl/disable-gl-min-textures.patch new file mode 100644 index 000000000000..1246c579ef37 --- /dev/null +++ b/content/canvas/test/webgl/disable-gl-min-textures.patch @@ -0,0 +1,24 @@ +# HG changeset patch +# Parent 59a9fa08e7308ecc5942f76387340dd209bcc644 +diff --git a/content/canvas/test/webgl/conformance/00_test_list.txt b/content/canvas/test/webgl/conformance/00_test_list.txt +--- a/content/canvas/test/webgl/conformance/00_test_list.txt ++++ b/content/canvas/test/webgl/conformance/00_test_list.txt +@@ -25,17 +25,17 @@ gl-enable-enum-test.html + gl-enable-vertex-attrib.html + gl-enum-tests.html + gl-get-active-attribute.html + gl-get-active-uniform.html + gl-get-calls.html + gl-getshadersource.html + gl-getstring.html + gl-min-attribs.html +-gl-min-textures.html ++# gl-min-textures.html + gl-min-uniforms.html + gl-object-get-calls.html + gl-pixelstorei.html + gl-scissor-test.html + gl-shader-test.html + gl-teximage.html + gl-uniform-arrays.html + gl-uniform-bool.html diff --git a/content/canvas/test/webgl/dont-load-image-from-internet.patch b/content/canvas/test/webgl/dont-load-image-from-internet.patch new file mode 100644 index 000000000000..1e1ac29fcf43 --- /dev/null +++ b/content/canvas/test/webgl/dont-load-image-from-internet.patch @@ -0,0 +1,148 @@ +diff --git a/conformance/more/functions/readPixelsBadArgs.html b/conformance/more/functions/readPixelsBadArgs.html +--- a/conformance/more/functions/readPixelsBadArgs.html ++++ b/conformance/more/functions/readPixelsBadArgs.html +@@ -108,10 +108,10 @@ Tests.testReadPixelsSOPCanvas = function + + Tests.endUnit = function(gl) { + } + + + + + +- ++ + +diff --git a/conformance/origin-clean-conformance.html b/conformance/origin-clean-conformance.html +--- a/conformance/origin-clean-conformance.html ++++ b/conformance/origin-clean-conformance.html +@@ -122,11 +122,11 @@ window.onload = function() { + + + +
+
+ + + +- ++ + + +diff --git a/resources/opengl_logo.jpg b/resources/opengl_logo.jpg +new file mode 100644 +index 0000000000000000000000000000000000000000..e3b70bef3f2c78736c72e263b63acea8d9a9467a +GIT binary patch +literal 5827 +zc$}42XH*kRmrm#)5UJ8zC@LtuNmY>EL7D-jm(UTU_uh*L1R-=n3!TtWS_DKy2pyzX +zgLLUE?|1g>etUNR>@#=%+Q_SDSW14x`%J}%jQ%jy +zX&-pRt1(P4m(X1DXLRb~{04acOr`6{4>oD8wm8SQwzs$G>2*Be`!0D<&-81}$=A)B +zoxS!qnCHPZ>SxNIuPG0`;@d6@o=hBcc1(Z}2Eo#VJCYX$0=BwljSI^UC3j>E7=Fy1o=|7rc`TwpK1Fe4?Em|{G&Rjln2Z^e@? +zqE^mUHmUG-I-dod?bHjTSForm|F +zPs=T!s_s+~bmJ(~P4s8=7ND67{Tsb7vbttTd%d%{dkY|3xdmtmc^~iR6PfX43H6 +z3zZS~^wf&Xm}@&z&Sf_r9|GJE4F)oGD$a?zkg?lLp2mxiW=dYAF< +z9sMSL9}O8&x}=n|ksMo?hDo1KZ+yKRLC01;d#Df;R8B6}+g~hA%eA82;x2~h09QWQ +z_a1NV+L$b6RzG{lw6F7Q9lTRv=V!*SI}yxz>FTXdji1f|GL+}vu@0u`va+da=xi|a +z8w-8Az0ff(_`@%}GGi*TYBo%E?tcaK^s-JOzLUdMX$ +zg|CkFmspSh89CE0LR#%6N_bkx%T$!eU}S>4uG@P~BU3EP{KP#8^vjG^wPq7J2WNeK +z8&9MV_I{#zvsBs3^r +zU`K!Ts&7Ey>kst7MVBGDk7~*v&ad{x+lm{>f1YPiG&FE{2JxMeHxJ>Lx2gyk`RDfP +zFu;K6UM|vs_cWa{8`S366V71u2!EkUXPuW+RgUL=dDht`TIR~)xJSwN7z4+_3;lP~{#m%VT;3Kxa1rW{!OUJin%RW`k>zbNDSPTV#7hg(b} +zlsxyIkFgo#5-9;II^r3B`dY}WaA~%ES7BadfZjXk8gupqk$d0?{3k-*b%+g)v3?0kMKbxeP$88>K4+~dxXE8sf{mAR4ALQFmo=XKsD1sX1}8K*WyR)K +z!Rv;v-n6qj=Y2|$5^s~pNj8{p(-K5qQAB_ts5cdKa1ePM7UL)UVQw#5dZ&e;{HgFi +zjch+K)eUkTR}|8f`s+4Wv9kx1i;hTTIAeW$>=;F{{zm$1^zajN9nLg;D}^Gbly%3p +zJlWI)Ed2+sb+wM4G)-Sm>%?fx8cveb5tWOY4}!j8y>k=8>F-xj%!TOMT5O=RYsB=N +zj#sHu*)jfRs3uY?>e@s}FrpG_w)bFOhEK#oPb +zr3N~QnjYQ)%5p5dhQp3#8KcNtmC)ZK_A_WcACmIBrgi*fV#)KfTJKlff*1+mocv%` +zxRDGvCh+TToedc^I@hsA>#PTf5Ik#fKZhnRZRpIkoFLu>g2A%d*EBM0XE|==J+j{t +zHh1cMjof$rzOPQD(G_=j`=iuRG;tKCuwPI7$PmheIe6G~o_4#sHg9vG;dG{K@?q~h +zUu!lD_v;R6xbS(2+67H5>HL$so4%F2C+g$Ue{)UcOk{X)g(3FlZWLv>TpPLt +z6kiC2x3qQ@y+G}Xoh~#Ys{~pqeKaZl=&vFi=~3kNSt^=;MU>w3 +z;aUqjNHsl{Ey!8PKy+A&ET*|u@~`g?>^JjpuM_I{fF>F9q0@Ain?aovQ!^Az?vyEQPw4W?rZl@tw?szJ@gdky8t@T3*)3sZ(!4sL32XKk +z+iu|mkw~nNgd2n8w=wdsa{tatTm*$=^;d%z4FR)5Ma$itm4@}3+)rBF!%)erJepXe +z($zv=3N!R}-Bac7m{}Ivnc+#cREgi-v60;K<960~L=@+N8!LU6BX)Htunm;Lm@Dw- +zPl3`|&%teky@?qSZEaJ`dBup`-^Vk(v1-4o71+hJTH_LW1T#4hEWixEu8*Q6y<+tG +z!C$o-{wlU9F_dN(S+Doi@K){8+t}KkCG+F1s>=vReV>w|T&9#!ZiStClTN2&2j?bU +zgw8U4;PiY=?nR{3)MH)thii!bbnWiB{4yn2zm!QYM*&{#f4J=u#hyIq;cTY8r=;tM +zRJD8CSOrP!j^&J<+FyuhCMGCAE6P;*F7uGS!T2~ajrmp0U6%)zek(T6oVg- +zXmm|%?*T26shO3((uK61zkC$zEk+CFxa55zQoS3WE{Mx2NFap@>(;Tp@OjlPy02Sl +z%N0KEOLyS-%pj|OhKd`^C~a5r;o0mClw^7B7&i1pZ+QAz7$n)iH9QQVQ&$&Omow_g +z&lAVZeZx4nH2TEeiVx}1{ns$c>Jt3uLR!Ml)f5@5&s~4H)FhSth*4V$?+E&9!N3uz +zDHV7>=tt+@s4}d?Rm+(`>G;|Pd~ll@obSG071bM5fy*4E9Gwen0+v$~=Cz}mIp;3R +zn|xBci=nOHCz@Wxr +z#(5*pJo3#?A4@0pijAjZV=GK%1*kQe@j^EU6D{*lH=6si7aIyut&7;o(iM@I5zfgr +zUK7Kcqk;UUH)+}q{9%Q{0dblney)|E2+%H9mf7EP; +zmn8DqT7vh5gtJ|L-_yllbLY3;CZ1-tW=Z*hK5yVYC6@8oBQkmw95)Fy3#jn^S$ve% +zR^w)Dh4ySmmpS?w9Xr!A1bi!`VSoLA^N<;Q__OVUq-&af(@c+&7(w5NSxIV?(|J<0 +z$fpbQ_b#P60bN)FPsp<9%mXPMCubqKdp +zGdbk;?mpn!an&T2{@{lEdBm4G9UkdG3CAvlHw#=nPy8KtC{T4OS65hb5f|K2UZ~l` +z&|c9{8KLK-{nV(MVYESPcFSazk160fH90mV*Uj3ZC#m?1Zfd83sdY$nSz-zKzWK-Z +zIg`Uu15L3{SRc<9X`QlquYcE8V<5$~qhdo$EIOMgsT#z#ab@yZ#@A57o;0C4+@TFD +zBttOeHDw%yOWxk@Wfn5IM2S;KfU@|_u!lhH%PZJKE)Q;%`1y*urfZBAQdV8uGl9lCw%zR*GFb0+ +zXsHn!chV~D1h?C*-1yKgG$pBAthW5e1&N=duRTk{x@saC7*-AHfbDr>$K5%GOb!mg9(;Ovyk+X>VYdoP$HDg +zC?E+5VAF0>W{O%_%_jjCc{pR`-0aU83=4=dAFw<1_G>TL$m03N?fCdALOf?SuxON* +zSx)(#-ofxc#Y<2kD1&mwFV(ZCvejr+8f5b1c##uI^wjPUB3LPgs?HvME}?lz{&tdC +zSiwPMI7GtATUz1G^m7{Gs*h9FMr2gZb#v7@2%*u4w?e<-y8AicY@AR0zStcn+ZCzT +zw0!iAZfwMg@FI3oUa#yg56xH9SSi<^v31W&@n6>^khNq32&2Q!kE)+lHjvLQC42v} +zu+Pb{b12dsP|bF?+Om5SW8zCdqfvYmuE_RD-+Ea2_hM|xFeZ^y=M9!_YL)FKbye5H +znJU3DPgiFAU568?JLzKp(`c^ZHsgX>(_BtuLaR@zba$T7N_SH9dxJ_;i;RFBH*5jBsX?7g +zP#&3vMuA3}9%?!<68tH7?L>Y%^n=X?0>$<+#JW4 +z=|KyH;w(_jH{6jimN6Ad_#Z%#FGAnS#&LdMr!X6te*yv<#k*|lJgv#H(cVcYy9LxF +zCI=_3XZ}8!`&}b!i10f+<28JmHaHM8=KMr&=20a6r(X$bvLX0}rGppBpErw6+f~Nn +zVpbD5^xaY`5X&2YRaG%n&S<`o=pya3hALvl@>ZKyc<|t7{<2}}lIIULovY=Hkiixg +z$3?4%-MpB54%uMW4jl8W;NP-i1I5KZ9E9Q)n9Jw=9gT*5ggZVn8@!^*8DY2yKXj96 +z7On40k`y$lT#8?X8vm?|(wRPg)T3gfS5-D!Y~I*kc4*~*{86%|#7f*E3xO7EC}d_N +zv!xL;i0iu<%xzOIpSp|12E{H^qeEz=KhmcrpE#jULkYL54yW`)dL7LPbD{5lJFiBv +zJZ&$#(uE9|WM`;*qMpBbTn!z3H*DBvGt1dd(cGLF)6ybY$EQ}nk#x;&a1S_uQQS?l +zMQBNU5!2{UUP%XEW-(OvpK%u_brqh+ZO{z~PIU2Xmw_LS9lEDuhvNUd +zS3p0=k;P|4f+jRoUzn5o_Xi|oUw@lz$)Dqyl&;E<7~?2+`Vx?G?cZ%o=Z;!lBJl;Q +z_`p5l;e|-kL2unBW&1H&hOP5v2M?8D&OEB#YxzjU@WBUrAgKGP0i>{vFTzIdl2&N| +z+x#>qnh8o2hA(3y*?@}wdNq^W+@RX*m|)`4EPhyy*vR{=I+1Fn;8} +zG%-HFG-PAHIR57joi77{0?G*5Jh^0E^~vA_J)IRG#J|%v)8(nB4=p4oG0QMV&6tgp +zv<5OtO~ts=oy%WS@~~csmNFU(YwHG3kbW~8FR5ernEEV#$u`0d5p26rlXzfj0v#bP +zoM*5~tKli_%}RL(&%(s1US(LE(SFH} +z_pRG5v*O}Z;O*j4=?2el0g%;yGS=kt%h${;#1`YD+7jxiMw;-l>I +zM6Zj2>`xpMCxOqaL&GyNg1dUhlQ)B4@l70R*(zS+r%(S(%mn%xk@I&_-`kPHqIzT< +z3tzL435*|VpQ3CI1dBDYt#&^#Hf#Lq%UrWvKQuHkc@zLEGO!x6-F|JPIX<jvD5MrS%&?9`sve=%3h5LG%H{&w5jflfN%Hg8 +zibmH<_QhiZ>1Q10oe{J3X;yuS#J2$La=CYL4VUVJgc{OhRJQ=vS^FE^Y?*Pnv&Hu7 +z8P-t{j@2|#0MDHY`E?6;oVk@5CI=%pI3;}WM`ZL*_9(`2wM#LtL#Lgw){k!G41q>h +z=iUN*6P526MKx5(vuDYuK<94#%&o^t6+xl8o=z}hPU9RN<*>do6PDn#f)9kB0;Q;! +zfYcVwLp^QywE1HHD8c{Rm?Wo&8P70Va(zMpZ`|| +I?(NKf0MJeN7XSbN + diff --git a/content/canvas/test/webgl/extra/webgl-info.html b/content/canvas/test/webgl/extra/webgl-info.html new file mode 100644 index 000000000000..5f93f1b29146 --- /dev/null +++ b/content/canvas/test/webgl/extra/webgl-info.html @@ -0,0 +1,79 @@ + + + + +WebGL Information + + + + +

WebGL Info

+
+ + + + diff --git a/content/canvas/test/webgl/failing_tests_linux.txt b/content/canvas/test/webgl/failing_tests_linux.txt index c9b45f9dfb21..81f64b05474e 100644 --- a/content/canvas/test/webgl/failing_tests_linux.txt +++ b/content/canvas/test/webgl/failing_tests_linux.txt @@ -1,7 +1,22 @@ +conformance/buffer-preserve-test.html conformance/context-attributes.html -conformance/gl-enum-tests.html +conformance/gl-getshadersource.html conformance/gl-get-active-attribute.html conformance/gl-uniform-bool.html -conformance/gl-vertexattribpointer.html conformance/glsl-2types-of-textures-on-same-unit.html +conformance/glsl-conformance.html +conformance/invalid-passed-params.html +conformance/more/conformance/quickCheckAPI.html +conformance/more/functions/copyTexImage2D.html +conformance/more/functions/copyTexSubImage2DBadArgs.html +conformance/more/functions/copyTexSubImage2D.html +conformance/more/functions/deleteBufferBadArgs.html +conformance/more/functions/texImage2DBadArgs.html +conformance/more/functions/texSubImage2DBadArgs.html +conformance/more/functions/texSubImage2DHTMLBadArgs.html +conformance/more/functions/uniformfArrayLen1.html +conformance/object-deletion-behaviour.html +conformance/read-pixels-test.html +conformance/tex-sub-image-2d-bad-args.html conformance/uninitialized-test.html +conformance/webgl-specific.html diff --git a/content/canvas/test/webgl/failing_tests_mac.txt b/content/canvas/test/webgl/failing_tests_mac.txt index 960d0846db16..c0491f2495d1 100644 --- a/content/canvas/test/webgl/failing_tests_mac.txt +++ b/content/canvas/test/webgl/failing_tests_mac.txt @@ -1,7 +1,24 @@ +conformance/buffer-preserve-test.html conformance/canvas-test.html conformance/canvas-test.html conformance/context-attributes.html -conformance/gl-enum-tests.html +conformance/gl-getshadersource.html conformance/gl-object-get-calls.html -conformance/gl-vertexattribpointer.html conformance/texture-npot.html +conformance/glsl-conformance.html +conformance/invalid-passed-params.html +conformance/object-deletion-behaviour.html +conformance/read-pixels-test.html +conformance/tex-input-validation.html +conformance/tex-sub-image-2d-bad-args.html +conformance/uninitialized-test.html +conformance/webgl-specific.html +conformance/more/functions/copyTexImage2D.html +conformance/more/functions/copyTexSubImage2D.html +conformance/more/functions/copyTexSubImage2DBadArgs.html +conformance/more/functions/deleteBufferBadArgs.html +conformance/more/functions/texImage2DBadArgs.html +conformance/more/functions/texSubImage2DBadArgs.html +conformance/more/functions/texSubImage2DHTMLBadArgs.html +conformance/more/functions/uniformfBadArgs.html +conformance/more/functions/uniformiBadArgs.html \ No newline at end of file diff --git a/content/canvas/test/webgl/failing_tests_windows.txt b/content/canvas/test/webgl/failing_tests_windows.txt index a59094a39ba8..db5a5af9240e 100644 --- a/content/canvas/test/webgl/failing_tests_windows.txt +++ b/content/canvas/test/webgl/failing_tests_windows.txt @@ -1,4 +1,19 @@ +conformance/buffer-preserve-test.html conformance/context-attributes.html -conformance/gl-enum-tests.html -conformance/gl-vertexattribpointer.html -conformance/texture-active-bind-2.html +conformance/gl-getshadersource.html +conformance/glsl-conformance.html +conformance/invalid-passed-params.html +conformance/object-deletion-behaviour.html +conformance/read-pixels-test.html +conformance/tex-sub-image-2d-bad-args.html +conformance/uninitialized-test.html +conformance/webgl-specific.html +conformance/more/conformance/quickCheckAPI.html +conformance/more/functions/copyTexImage2D.html +conformance/more/functions/copyTexSubImage2D.html +conformance/more/functions/copyTexSubImage2DBadArgs.html +conformance/more/functions/deleteBufferBadArgs.html +conformance/more/functions/texImage2DBadArgs.html +conformance/more/functions/texSubImage2DBadArgs.html +conformance/more/functions/texSubImage2DHTMLBadArgs.html +conformance/more/functions/uniformfArrayLen1.html diff --git a/content/canvas/test/webgl/increase-timeout-delays.patch b/content/canvas/test/webgl/increase-timeout-delays.patch new file mode 100644 index 000000000000..7584c7751a30 --- /dev/null +++ b/content/canvas/test/webgl/increase-timeout-delays.patch @@ -0,0 +1,38 @@ +# HG changeset patch +# Parent cabbf6f041cd51f04c31b5f4467a49ecea0f052a +diff --git a/content/canvas/test/webgl/test_webgl_conformance_test_suite.html b/content/canvas/test/webgl/test_webgl_conformance_test_suite.html +--- a/content/canvas/test/webgl/test_webgl_conformance_test_suite.html ++++ b/content/canvas/test/webgl/test_webgl_conformance_test_suite.html +@@ -270,30 +270,30 @@ function start() { + if (ctx) { + var iframe = document.getElementById("testframe"); + var testHarness = new WebGLTestHarnessModule.TestHarness( + iframe, + '00_test_list.txt', + function(type, msg, success) { + return reporter.reportFunc(type, msg, success); + }); +- testHarness.setTimeoutDelay(10000); // and make it much higher when running under valgrind. ++ testHarness.setTimeoutDelay(20000); // and make it much higher when running under valgrind. + window.webglTestHarness = testHarness; + testHarness.runTests(); + } else { + var errmsg = "Can't create a WebGL context"; + reporter.fullResultsNode.textContent = errmsg; + ok(false, errmsg); + dump("WebGL mochitest failed: " + errmsg + "\n"); + reporter.finishedTestSuite(); + } + }; + + SimpleTest.waitForExplicitFinish(); +- SimpleTest.requestLongerTimeout(2); ++ SimpleTest.requestLongerTimeout(3); + + var kIsWindows = false; + var kIsMac = false; + var kIsLinux = false; + if (navigator.platform.indexOf("Win") == 0) + kIsWindows = true; + else if (navigator.platform.indexOf("Linux") == 0) + kIsLinux = true; diff --git a/content/canvas/test/webgl/more/00_testFIXME_list.txt b/content/canvas/test/webgl/more/00_testFIXME_list.txt deleted file mode 100644 index 529e70287b37..000000000000 --- a/content/canvas/test/webgl/more/00_testFIXME_list.txt +++ /dev/null @@ -1,52 +0,0 @@ -conformance/badArgsArityLessThanArgc.html -conformance/constants.html -# conformance/fuzzTheAPI.html // No interactive tests. -conformance/getContext.html -conformance/methods.html -conformance/quickCheckAPI.html -conformance/quickCheckAPIBadArgs.html -conformance/webGLArrays.html -functions/bindBuffer.html -functions/bindBufferBadArgs.html -functions/bindFramebufferLeaveNonZero.html -functions/bufferData.html -functions/bufferDataBadArgs.html -functions/bufferSubData.html -functions/bufferSubDataBadArgs.html -functions/copyTexImage2D.html -functions/copyTexImage2DBadArgs.html -functions/copyTexSubImage2D.html -functions/copyTexSubImage2DBadArgs.html -functions/deleteBufferBadArgs.html -functions/drawArrays.html -functions/drawArraysOutOfBounds.html -functions/drawElements.html -functions/drawElementsBadArgs.html -functions/getImageData.html -functions/getImageDataBadArgs.html -functions/isTests.html -functions/readPixels.html -functions/readPixelsBadArgs.html -functions/texImage2D.html -functions/texImage2DBadArgs.html -functions/texImage2DHTML.html -functions/texImage2DHTMLBadArgs.html -functions/texSubImage2D.html -functions/texSubImage2DBadArgs.html -functions/texSubImage2DHTML.html -functions/texSubImage2DHTMLBadArgs.html -functions/uniformf.html -functions/uniformfBadArgs.html -functions/uniformi.html -functions/uniformiBadArgs.html -functions/uniformMatrix.html -functions/uniformMatrixBadArgs.html -functions/vertexAttrib.html -functions/vertexAttribBadArgs.html -functions/vertexAttribPointer.html -functions/vertexAttribPointerBadArgs.html -glsl/arrayOutOfBounds.html -#glsl/longLoops.html // No interactive tests. -glsl/uniformOutOfBounds.html -#glsl/unusedAttribsUniforms.html // No interactive tests. - diff --git a/content/canvas/test/webgl/more/functions/getImageData.html b/content/canvas/test/webgl/more/functions/getImageData.html deleted file mode 100644 index 0ceff83a20bf..000000000000 --- a/content/canvas/test/webgl/more/functions/getImageData.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/content/canvas/test/webgl/more/functions/getImageDataBadArgs.html b/content/canvas/test/webgl/more/functions/getImageDataBadArgs.html deleted file mode 100644 index 2768059c341b..000000000000 --- a/content/canvas/test/webgl/more/functions/getImageDataBadArgs.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - diff --git a/content/canvas/test/webgl/more/functions/linkProgramBadArgs.html b/content/canvas/test/webgl/more/functions/linkProgramBadArgs.html deleted file mode 100644 index 1a3b3e914cad..000000000000 --- a/content/canvas/test/webgl/more/functions/linkProgramBadArgs.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - diff --git a/content/canvas/test/webgl/resources/desktop-gl-constants.js b/content/canvas/test/webgl/resources/desktop-gl-constants.js old mode 100755 new mode 100644 diff --git a/content/canvas/test/webgl/resources/js-test-pre.js b/content/canvas/test/webgl/resources/js-test-pre.js index 5619b5e51066..76c89a5711b2 100644 --- a/content/canvas/test/webgl/resources/js-test-pre.js +++ b/content/canvas/test/webgl/resources/js-test-pre.js @@ -358,3 +358,18 @@ function gc() { gcRec(10) } } + +function finishTest() { + successfullyParsed = true; + var epilogue = document.createElement("script"); + epilogue.onload = function() { + if (window.nonKhronosFrameworkNotifyDone) { + window.nonKhronosFrameworkNotifyDone(); + } + }; + // TODO(gman): find the correct path by searching + // for the script with src="js-test-pre.js" + epilogue.src = "../resources/js-test-post.js"; + document.body.appendChild(epilogue); +} + diff --git a/content/canvas/test/webgl/resources/webgl-test-harness.js b/content/canvas/test/webgl/resources/webgl-test-harness.js old mode 100755 new mode 100644 index 3f2d9b9d5086..81401e81f7c5 --- a/content/canvas/test/webgl/resources/webgl-test-harness.js +++ b/content/canvas/test/webgl/resources/webgl-test-harness.js @@ -156,7 +156,7 @@ var TestHarness = function(iframe, filelistUrl, reportFunc) { this.reportFunc(TestHarness.reportType.ADD_PAGE, files[ii], undefined); } this.nextFileIndex = files.length; - this.timeoutDelay = 3000; + this.timeoutDelay = 20000; }; TestHarness.reportType = { diff --git a/content/canvas/test/webgl/test_webgl_conformance_test_suite.html b/content/canvas/test/webgl/test_webgl_conformance_test_suite.html index f70cfc80e8e4..9cfa8c806c02 100644 --- a/content/canvas/test/webgl/test_webgl_conformance_test_suite.html +++ b/content/canvas/test/webgl/test_webgl_conformance_test_suite.html @@ -275,7 +275,7 @@ function start() { function(type, msg, success) { return reporter.reportFunc(type, msg, success); }); - testHarness.setTimeoutDelay(10000); // and make it much higher when running under valgrind. + testHarness.setTimeoutDelay(20000); // and make it much higher when running under valgrind. window.webglTestHarness = testHarness; testHarness.runTests(); } else { @@ -288,7 +288,7 @@ function start() { }; SimpleTest.waitForExplicitFinish(); - SimpleTest.requestLongerTimeout(2); + SimpleTest.requestLongerTimeout(3); var kIsWindows = false; var kIsMac = false; diff --git a/content/canvas/test/webgl/webgl-conformance-tests.html b/content/canvas/test/webgl/webgl-conformance-tests.html index 5b199bc6fa40..a6f18f5dec4d 100755 --- a/content/canvas/test/webgl/webgl-conformance-tests.html +++ b/content/canvas/test/webgl/webgl-conformance-tests.html @@ -29,6 +29,8 @@ WebGL Conformance Test Runner. + + + + + +Mozilla Bug 638318 +

+ + +
+
+
+ + From 4d1d2ef369e241fd781749acd812e6a2cceeeade Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Thu, 3 Mar 2011 09:37:18 -0800 Subject: [PATCH 12/21] Bug 637859. Anchor a string for a bit. r=cdleary, a=bsmedberg --- js/src/jsregexp.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/js/src/jsregexp.cpp b/js/src/jsregexp.cpp index d9cbc059d477..cd2d1fa35158 100644 --- a/js/src/jsregexp.cpp +++ b/js/src/jsregexp.cpp @@ -640,6 +640,7 @@ EscapeNakedForwardSlashes(JSContext *cx, JSString *unescaped) const jschar *oldChars = unescaped->getChars(cx); if (!oldChars) return NULL; + JS::Anchor anchor(unescaped); js::Vector newChars(cx); for (const jschar *it = oldChars; it < oldChars + oldLen; ++it) { @@ -647,13 +648,14 @@ EscapeNakedForwardSlashes(JSContext *cx, JSString *unescaped) if (!newChars.length()) { if (!newChars.reserve(oldLen + 1)) return NULL; - newChars.append(oldChars, size_t(it - oldChars)); + JS_ALWAYS_TRUE(newChars.append(oldChars, size_t(it - oldChars))); } - newChars.append('\\'); + if (!newChars.append('\\')) + return NULL; } - if (newChars.length()) - newChars.append(*it); + if (!newChars.empty() && !newChars.append(*it)) + return NULL; } if (newChars.length()) { From 3ccdc55c731e500837c3a1a1729692920284c36e Mon Sep 17 00:00:00 2001 From: Ben Hearsum Date: Thu, 3 Mar 2011 14:09:19 -0500 Subject: [PATCH 13/21] No-op comment change to trigger Talos after talos.zip update. r=NPOTB a=NPOTB --- tools/update-packaging/make_incremental_updates.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/update-packaging/make_incremental_updates.py b/tools/update-packaging/make_incremental_updates.py index f000967b8718..a56395fafb61 100755 --- a/tools/update-packaging/make_incremental_updates.py +++ b/tools/update-packaging/make_incremental_updates.py @@ -37,7 +37,7 @@ class PatchInfo: mozilla/tools/update-packaging/common.sh/make_add_instruction """ if filename.startswith("extensions/"): - # Dir immediately following extensions is used for the test + # Directory immediately following extensions is used for the test testdir = "extensions/"+filename.split("/")[1] self.manifest.append('add-if "'+testdir+'" "'+filename+'"') elif filename.startswith("Contents/MacOS/extensions/"): From 81cc8b631f4dba01ba4ae75ac9d622b58dea64bd Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Fri, 4 Mar 2011 17:57:25 -0500 Subject: [PATCH 14/21] bug 637487 - Unable to install extensions when Fennec moved to SD Card r=dougt a=blocking-fennec --- xpcom/io/nsLocalFileUnix.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp index 88be319d1820..45112b5a0c95 100644 --- a/xpcom/io/nsLocalFileUnix.cpp +++ b/xpcom/io/nsLocalFileUnix.cpp @@ -119,6 +119,7 @@ static nsresult MacErrorMapper(OSErr inErr); #ifdef ANDROID #include "AndroidBridge.h" #include "nsIMIMEService.h" +#include #endif #include "nsNativeCharsetUtils.h" @@ -1103,9 +1104,20 @@ nsLocalFile::SetPermissions(PRUint32 aPermissions) * Race condition here: we should use fchmod instead, there's no way to * guarantee the name still refers to the same file. */ - if (chmod(mPath.get(), aPermissions) < 0) - return NSRESULT_FOR_ERRNO(); - return NS_OK; + if (chmod(mPath.get(), aPermissions) >= 0) + return NS_OK; +#if defined(ANDROID) && defined(STATFS) + // For the time being, this is restricted for use by Android, but we + // will figure out what to do for all platforms in bug 638503 + struct STATFS sfs; + if (STATFS(mPath.get(), &sfs) < 0) + return NSRESULT_FOR_ERRNO(); + + // if this is a FAT file system we can't set file permissions + if (sfs.f_type == MSDOS_SUPER_MAGIC ) + return NS_OK; +#endif + return NSRESULT_FOR_ERRNO(); } NS_IMETHODIMP From e63a22b642201b110f3b97b19317d2606db8b419 Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Fri, 4 Mar 2011 18:00:52 -0500 Subject: [PATCH 15/21] bug 636877 - Improve android restarts r=dougt a=blocking-fennec --- embedding/android/AndroidManifest.xml.in | 4 +-- embedding/android/GeckoApp.java | 33 +++++------------ embedding/android/GeckoAppShell.java | 45 +++++++++++++++++++++++- embedding/android/Restarter.java.in | 30 +++++++--------- 4 files changed, 67 insertions(+), 45 deletions(-) diff --git a/embedding/android/AndroidManifest.xml.in b/embedding/android/AndroidManifest.xml.in index 048e21b772c9..ab1552a2ff9b 100644 --- a/embedding/android/AndroidManifest.xml.in +++ b/embedding/android/AndroidManifest.xml.in @@ -85,10 +85,10 @@ - + #if MOZ_CRASHREPORTER diff --git a/embedding/android/GeckoApp.java b/embedding/android/GeckoApp.java index c2ca4b85a636..9c6274c4b0ca 100644 --- a/embedding/android/GeckoApp.java +++ b/embedding/android/GeckoApp.java @@ -455,6 +455,8 @@ abstract public class GeckoApp } } + boolean haveKilledZombies = false; + private void unpackFile(ZipFile zip, byte[] buf, ZipEntry fileEntry, String name) throws IOException, FileNotFoundException @@ -471,7 +473,10 @@ abstract public class GeckoApp outFile.length() == fileEntry.getSize()) return; - killAnyZombies(); + if (!haveKilledZombies) { + haveKilledZombies = true; + GeckoAppShell.killAnyZombies(); + } File dir = outFile.getParentFile(); if (!outFile.exists()) @@ -492,27 +497,6 @@ abstract public class GeckoApp outFile.setLastModified(fileEntry.getTime()); } - boolean haveKilledZombies = false; - - void killAnyZombies() { - if (haveKilledZombies) - return; - haveKilledZombies = true; - File proc = new File("/proc"); - File[] files = proc.listFiles(); - for (int i = 0; i < files.length; i++) { - File p = files[i]; - File pEnv = new File(p, "environ"); - if (pEnv.canRead() && !p.getName().equals("self")) { - int pid = Integer.parseInt(p.getName()); - if (pid != android.os.Process.myPid()) { - Log.i("GeckoProcs", "gonna kill pid: " + p.getName()); - android.os.Process.killProcess(pid); - } - } - } - } - public void addEnvToIntent(Intent intent) { Map envMap = System.getenv(); Set> envSet = envMap.entrySet(); @@ -537,15 +521,14 @@ abstract public class GeckoApp intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK); Log.i("GeckoAppJava", intent.toString()); + GeckoAppShell.killAnyZombies(); startActivity(intent); } catch (Exception e) { Log.i("GeckoAppJava", "error doing restart", e); } finish(); // Give the restart process time to start before we die - try { - Thread.currentThread().sleep(1000); - } catch (InterruptedException ie) {} + GeckoAppShell.waitForAnotherGeckoProc(); } public void handleNotification(String action, String alertName, String alertCookie) { diff --git a/embedding/android/GeckoAppShell.java b/embedding/android/GeckoAppShell.java index 4cf818c048e5..53508ecf5374 100644 --- a/embedding/android/GeckoAppShell.java +++ b/embedding/android/GeckoAppShell.java @@ -63,7 +63,7 @@ import android.net.Uri; import android.net.ConnectivityManager; import android.net.NetworkInfo; -class GeckoAppShell +public class GeckoAppShell { // static members only private GeckoAppShell() { } @@ -868,4 +868,47 @@ class GeckoAppShell config.locale = locale; res.updateConfiguration(config, res.getDisplayMetrics()); } + + public static void killAnyZombies() { + File proc = new File("/proc"); + File[] files = proc.listFiles(); + for (int i = 0; i < files.length; i++) { + File p = files[i]; + File pEnv = new File(p, "environ"); + if (pEnv.canRead() && !p.getName().equals("self")) { + int pid = Integer.parseInt(p.getName()); + if (pid != android.os.Process.myPid()) { + Log.i("GeckoProcs", "gonna kill pid: " + p.getName()); + android.os.Process.killProcess(pid); + } + } + } + } + + public static boolean checkForGeckoProcs() { + File proc = new File("/proc"); + File[] files = proc.listFiles(); + for (int i = 0; i < files.length; i++) { + File p = files[i]; + File pEnv = new File(p, "environ"); + if (pEnv.canRead() && !p.getName().equals("self")) { + int pid = Integer.parseInt(p.getName()); + if (pid != android.os.Process.myPid()) { + Log.i("GeckoProcs", "found pid: " + p.getName()); + return true; + } + } + } + Log.i("GeckoProcs", "didn't find any other procs"); + return false; + } + + public static void waitForAnotherGeckoProc(){ + int countdown = 40; + while (!checkForGeckoProcs() && --countdown > 0) { + try { + Thread.currentThread().sleep(100); + } catch (InterruptedException ie) {} + } + } } diff --git a/embedding/android/Restarter.java.in b/embedding/android/Restarter.java.in index 041ab0f9e3f9..2c09bb2356c2 100644 --- a/embedding/android/Restarter.java.in +++ b/embedding/android/Restarter.java.in @@ -43,30 +43,24 @@ import android.content.*; import android.util.*; import android.os.*; import java.io.*; +import org.mozilla.gecko.GeckoAppShell; public class Restarter extends Activity { - void killAnyZombies() { - File proc = new File("/proc"); - File[] files = proc.listFiles(); - for (int i = 0; i < files.length; i++) { - File p = files[i]; - File pEnv = new File(p, "environ"); - if (pEnv.canRead() && !p.getName().equals("self")) { - int pid = Integer.parseInt(p.getName()); - if (pid != android.os.Process.myPid()) { - Log.i("GeckoProcs", "gonna kill pid: " + p.getName()); - android.os.Process.killProcess(pid); - } - } - } - } - @Override public void onCreate(Bundle savedInstanceState) { Log.i("Restarter", "trying to restart @MOZ_APP_NAME@"); try { - killAnyZombies(); + int countdown = 40; + while (GeckoAppShell.checkForGeckoProcs() && --countdown > 0) { + // Wait for the old process to die before we continue + try { + Thread.currentThread().sleep(100); + } catch (InterruptedException ie) {} + } + + if (countdown <= 0) // if the countdown expired, something is hung + GeckoAppShell.killAnyZombies(); } catch (Exception e) { Log.i("Restarter", e.toString()); } @@ -84,6 +78,8 @@ public class Restarter extends Activity { } catch (Exception e) { Log.i("Restarter", e.toString()); } + // Give the new process time to start before we die + GeckoAppShell.waitForAnotherGeckoProc(); System.exit(0); } }; From 8c69c594ebdc99f40891abcf3df1d079d2ba3b11 Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Fri, 4 Mar 2011 18:08:24 -0500 Subject: [PATCH 16/21] bug 611163 - Fennec doesn't start due a problem with 'ashmem buffer' in DDMS r=taras a=blocking-fennec --- other-licenses/android/APKOpen.cpp | 41 ++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/other-licenses/android/APKOpen.cpp b/other-licenses/android/APKOpen.cpp index 381787c29751..96a2bff849c2 100644 --- a/other-licenses/android/APKOpen.cpp +++ b/other-licenses/android/APKOpen.cpp @@ -455,8 +455,8 @@ static void * mozload(const char * path, void *zip, #ifdef DEBUG_EXTRACT_LIBS if (extractLibs) { - char fullpath[256]; - snprintf(fullpath, 256, "%s/%s", getenv("CACHE_PATH"), path + 4); + char fullpath[PATH_MAX]; + snprintf(fullpath, PATH_MAX, "%s/%s", getenv("CACHE_PATH"), path + 4); __android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "resolved %s to %s", path, fullpath); extractFile(fullpath, entry, data); handle = __wrap_dlopen(fullpath, RTLD_LAZY); @@ -474,7 +474,7 @@ static void * mozload(const char * path, void *zip, } #endif size_t offset = letoh32(entry->offset) + sizeof(*file) + letoh16(file->filename_size) + letoh16(file->extra_field_size); - + bool skipLibCache = false; int fd = zip_fd; void * buf = NULL; uint32_t lib_size = letoh32(entry->uncompressed_size); @@ -483,8 +483,8 @@ static void * mozload(const char * path, void *zip, cache_fd = lookupLibCacheFd(path + 4); fd = cache_fd; if (fd < 0) { - char fullpath[256]; - snprintf(fullpath, 256, "%s/%s", getenv("CACHE_PATH"), path + 4); + char fullpath[PATH_MAX]; + snprintf(fullpath, PATH_MAX, "%s/%s", getenv("CACHE_PATH"), path + 4); fd = open(fullpath, O_RDWR); struct stat status; if (stat(fullpath, &status) || @@ -504,8 +504,25 @@ static void * mozload(const char * path, void *zip, __android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "Loading %s from cache", path + 4); #endif if (fd < 0) { - __android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "Couldn't open " ASHMEM_NAME_DEF ", Error %d, %s", errno, strerror(errno)); - return NULL; + __android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "Couldn't open " ASHMEM_NAME_DEF ", Error %d, %s, using a file", errno, strerror(errno)); + char fullpath[PATH_MAX]; + snprintf(fullpath, PATH_MAX, "%s/%s", getenv("CACHE_PATH"), path + 4); + fd = open(fullpath, O_RDWR | O_CREAT); + if (fd < 0) { + __android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "Couldn't create a file either, giving up"); + return NULL; + } + // we'd like to use fallocate here, but it doesn't exist currently? + if (lseek(fd, lib_size - 1, SEEK_SET) == (off_t) - 1) { + __android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "seeking file failed"); + return NULL; + } + if (write(fd, "", 1) != 1) { + __android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "writting one byte to the file failed"); + return NULL; + } + skipLibCache = true; + addLibCacheFd(path + 4, fd); } buf = mmap(NULL, lib_size, PROT_READ | PROT_WRITE, @@ -520,8 +537,10 @@ static void * mozload(const char * path, void *zip, if (cache_fd < 0) { extractLib(entry, data, buf); - addLibCacheFd(path + 4, fd, lib_size, buf); + if (!skipLibCache) + addLibCacheFd(path + 4, fd, lib_size, buf); } + // preload libxul, to avoid slowly demand-paging it if (!strcmp(path, "lib/libxul.so")) madvise(buf, entry->uncompressed_size, MADV_WILLNEED); @@ -719,9 +738,9 @@ Java_org_mozilla_gecko_GeckoAppShell_loadLibs(JNIEnv *jenv, jclass jGeckoAppShel if (!info->buffer) continue; - char fullpath[256]; - snprintf(fullpath, 256, "%s/%s", getenv("CACHE_PATH"), info->name); - char tmp_path[256]; + char fullpath[PATH_MAX]; + snprintf(fullpath, PATH_MAX, "%s/%s", getenv("CACHE_PATH"), info->name); + char tmp_path[PATH_MAX]; sprintf(tmp_path, "%s.tmp", fullpath); int file_fd = open(tmp_path, O_CREAT | O_WRONLY); // using sendfile would be preferable, but it doesn't seem to work From 39af02101295e42a199ede3fc3769ab1484d384f Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 4 Mar 2011 18:12:44 -0500 Subject: [PATCH 17/21] bg 624344 - File name not parsed correctly while trying to save page via 'Save link' r=enn a=blocking-fennec --- embedding/android/CrashReporter.java.in | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/embedding/android/CrashReporter.java.in b/embedding/android/CrashReporter.java.in index 4ff3b6cc07d0..6ba514a3902e 100644 --- a/embedding/android/CrashReporter.java.in +++ b/embedding/android/CrashReporter.java.in @@ -58,6 +58,7 @@ public class CrashReporter extends Activity static final String kMiniDumpPathKey = "upload_file_minidump"; static final String kPageURLKey = "URL"; static final String kNotesKey = "Notes"; + Handler mHandler = null; ProgressDialog mProgressDialog; File mPendingMinidumpFile; File mPendingExtrasFile; @@ -88,6 +89,15 @@ public class CrashReporter extends Activity return true; } + void doFinish() { + if (mHandler != null) { + mHandler.post(new Runnable(){ + public void run() { + finish(); + }}); + } + } + @Override public void finish() { @@ -99,6 +109,8 @@ public class CrashReporter extends Activity public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + // mHandler is created here so runnables can be run on the main thread + mHandler = new Handler(); setContentView(R.layout.crash_reporter); mProgressDialog = new ProgressDialog(CrashReporter.this); mProgressDialog.setMessage(getString(R.string.sending_crash_report)); @@ -125,7 +137,7 @@ public class CrashReporter extends Activity { final CheckBox sendReportCheckbox = (CheckBox) findViewById(R.id.send_report); if (!sendReportCheckbox.isChecked()) { - finish(); + doFinish(); return; } @@ -219,7 +231,7 @@ public class CrashReporter extends Activity String spec = extras.get("ServerURL"); if (spec == null) - finish(); + doFinish(); Log.i("GeckoCrashReport", "server url: " + spec); try { @@ -298,7 +310,7 @@ public class CrashReporter extends Activity Log.e("GeckoCrashReporter", "exception during send: ", e); } - finish(); + doFinish(); } void doRestart() From 3c7159de0d564382cc3c56cfaeef368981f1a90a Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 4 Mar 2011 18:29:01 -0500 Subject: [PATCH 18/21] bg 624344 - File name not parsed correctly while trying to save page via 'Save link' r=enn a=blocking-fennec --- toolkit/content/contentAreaUtils.js | 36 ++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/toolkit/content/contentAreaUtils.js b/toolkit/content/contentAreaUtils.js index fadbb5ef9ea0..99168e8b431d 100644 --- a/toolkit/content/contentAreaUtils.js +++ b/toolkit/content/contentAreaUtils.js @@ -929,7 +929,41 @@ function validateFileName(aFileName) } else if (navigator.appVersion.indexOf("Macintosh") != -1) re = /[\:\/]+/g; - + else if (navigator.appVersion.indexOf("Android") != -1 || + navigator.appVersion.indexOf("Maemo") != -1) { + // On mobile devices, the filesystem may be very limited in what + // it considers valid characters. To avoid errors, we sanitize + // conservatively. + const dangerousChars = "*?<>|\":/\\[];,+="; + var processed = ""; + for (var i = 0; i < aFileName.length; i++) + processed += aFileName.charCodeAt(i) >= 32 && + !(dangerousChars.indexOf(aFileName[i]) >= 0) ? aFileName[i] + : "_"; + + // Last character should not be a space + processed = processed.trim(); + + // If a large part of the filename has been sanitized, then we + // will use a default filename instead + if (processed.replace(/_/g, "").length <= processed.length/2) { + // We purposefully do not use a localized default filename, + // which we could have done using + // ContentAreaUtils.stringBundle.GetStringFromName("DefaultSaveFileName") + // since it may contain invalid characters. + var original = processed; + processed = "download"; + + // Preserve a suffix, if there is one + if (original.indexOf(".") >= 0) { + var suffix = original.split(".").slice(-1)[0]; + if (suffix && suffix.indexOf("_") < 0) + processed += "." + suffix; + } + } + return processed; + } + return aFileName.replace(re, "_"); } From 3b29197c26377dae5962de2f5f32d4b978147b98 Mon Sep 17 00:00:00 2001 From: Brian Crowder Date: Wed, 2 Mar 2011 12:23:02 -0500 Subject: [PATCH 19/21] Bug 634555: sync with the Gecko event queue at the end of onTextChanged, r=mwu,blassey, a=blocking-fennec:2.0,blassey --- embedding/android/GeckoAppShell.java | 37 +++++++++++++++++++++ embedding/android/GeckoEvent.java | 1 + embedding/android/GeckoInputConnection.java | 5 +-- widget/src/android/AndroidBridge.cpp | 9 +++++ widget/src/android/AndroidBridge.h | 3 ++ widget/src/android/AndroidJavaWrappers.h | 1 + widget/src/android/nsWindow.cpp | 16 +++++---- 7 files changed, 64 insertions(+), 8 deletions(-) diff --git a/embedding/android/GeckoAppShell.java b/embedding/android/GeckoAppShell.java index 53508ecf5374..637d579f35cf 100644 --- a/embedding/android/GeckoAppShell.java +++ b/embedding/android/GeckoAppShell.java @@ -44,6 +44,7 @@ import java.nio.channels.*; import java.text.*; import java.util.*; import java.util.zip.*; +import java.util.concurrent.locks.*; import android.os.*; import android.app.*; @@ -343,6 +344,11 @@ public class GeckoAppShell } } + public static void sendEventToGeckoSync(GeckoEvent e) { + sendEventToGecko(e); + geckoEventSync(); + } + // Tell the Gecko event loop that an event is available. public static native void notifyGeckoOfEvent(GeckoEvent event); @@ -471,6 +477,37 @@ public class GeckoAppShell imm, text, start, end, newEnd); } + private static final ReentrantLock mGeckoSyncLock = new ReentrantLock(); + private static final Condition mGeckoSyncCond = mGeckoSyncLock.newCondition(); + private static boolean mGeckoSyncAcked; + + // Block the current thread until the Gecko event loop is caught up + public static void geckoEventSync() { + GeckoAppShell.sendEventToGecko( + new GeckoEvent(GeckoEvent.GECKO_EVENT_SYNC)); + mGeckoSyncLock.lock(); + mGeckoSyncAcked = false; + while (!mGeckoSyncAcked) { + try { + mGeckoSyncCond.await(); + } catch (InterruptedException e) { + break; + } + } + mGeckoSyncLock.unlock(); + } + + // Signal the Java thread that it's time to wake up + public static void acknowledgeEventSync() { + mGeckoSyncLock.lock(); + mGeckoSyncAcked = true; + try { + mGeckoSyncCond.signal(); + } finally { + mGeckoSyncLock.unlock(); + } + } + public static void enableAccelerometer(boolean enable) { SensorManager sm = (SensorManager) GeckoApp.surfaceView.getContext().getSystemService(Context.SENSOR_SERVICE); diff --git a/embedding/android/GeckoEvent.java b/embedding/android/GeckoEvent.java index 57a6d453e638..5606e6762b7c 100644 --- a/embedding/android/GeckoEvent.java +++ b/embedding/android/GeckoEvent.java @@ -70,6 +70,7 @@ public class GeckoEvent { public static final int SURFACE_CREATED = 12; public static final int SURFACE_DESTROYED = 13; + public static final int GECKO_EVENT_SYNC = 14; public static final int IME_COMPOSITION_END = 0; public static final int IME_COMPOSITION_BEGIN = 1; diff --git a/embedding/android/GeckoInputConnection.java b/embedding/android/GeckoInputConnection.java index 91bb2df3c706..b4665d2f791f 100644 --- a/embedding/android/GeckoInputConnection.java +++ b/embedding/android/GeckoInputConnection.java @@ -561,9 +561,10 @@ public class GeckoInputConnection GeckoAppShell.sendEventToGecko( new GeckoEvent(GeckoEvent.IME_SET_SELECTION, start + count, 0)); - - } + + // Block this thread until all pending events are processed + GeckoAppShell.geckoEventSync(); } public void afterTextChanged(Editable s) diff --git a/widget/src/android/AndroidBridge.cpp b/widget/src/android/AndroidBridge.cpp index 3b56c80a421c..fef60429331f 100644 --- a/widget/src/android/AndroidBridge.cpp +++ b/widget/src/android/AndroidBridge.cpp @@ -107,6 +107,8 @@ AndroidBridge::Init(JNIEnv *jEnv, jNotifyIME = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIME", "(II)V"); jNotifyIMEEnabled = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIMEEnabled", "(ILjava/lang/String;Ljava/lang/String;)V"); jNotifyIMEChange = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIMEChange", "(Ljava/lang/String;III)V"); + jAcknowledgeEventSync = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "acknowledgeEventSync", "()V"); + jEnableAccelerometer = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "enableAccelerometer", "(Z)V"); jEnableLocation = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "enableLocation", "(Z)V"); jReturnIMEQueryResult = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "returnIMEQueryResult", "(Ljava/lang/String;II)V"); @@ -263,6 +265,13 @@ AndroidBridge::NotifyIMEChange(const PRUnichar *aText, PRUint32 aTextLen, sBridge->jNotifyIMEChange, args); } +void +AndroidBridge::AcknowledgeEventSync() +{ + ALOG_BRIDGE("AndroidBridge::AcknowledgeEventSync"); + mJNIEnv->CallStaticVoidMethod(mGeckoAppShellClass, jAcknowledgeEventSync); +} + void AndroidBridge::EnableAccelerometer(bool aEnable) { diff --git a/widget/src/android/AndroidBridge.h b/widget/src/android/AndroidBridge.h index 2e7d9e3245f7..1af266363ce9 100644 --- a/widget/src/android/AndroidBridge.h +++ b/widget/src/android/AndroidBridge.h @@ -111,6 +111,8 @@ public: static void NotifyIMEChange(const PRUnichar *aText, PRUint32 aTextLen, int aStart, int aEnd, int aNewEnd); + void AcknowledgeEventSync(); + void EnableAccelerometer(bool aEnable); void EnableLocation(bool aEnable); @@ -246,6 +248,7 @@ protected: jmethodID jNotifyIME; jmethodID jNotifyIMEEnabled; jmethodID jNotifyIMEChange; + jmethodID jAcknowledgeEventSync; jmethodID jEnableAccelerometer; jmethodID jEnableLocation; jmethodID jReturnIMEQueryResult; diff --git a/widget/src/android/AndroidJavaWrappers.h b/widget/src/android/AndroidJavaWrappers.h index 4acfddad0ce8..b91942780007 100644 --- a/widget/src/android/AndroidJavaWrappers.h +++ b/widget/src/android/AndroidJavaWrappers.h @@ -451,6 +451,7 @@ public: LOAD_URI = 11, SURFACE_CREATED = 12, SURFACE_DESTROYED = 13, + GECKO_EVENT_SYNC = 14, dummy_java_enum_list_end }; diff --git a/widget/src/android/nsWindow.cpp b/widget/src/android/nsWindow.cpp index 3f014f6d0028..453fcf8e726b 100644 --- a/widget/src/android/nsWindow.cpp +++ b/widget/src/android/nsWindow.cpp @@ -363,7 +363,7 @@ nsWindow::Show(PRBool aState) BringToFront(); } else if (TopWindow() == this) { // find the next visible window to show - int i; + unsigned int i; for (i = 1; i < gTopLevelWindows.Length(); i++) { nsWindow *win = gTopLevelWindows[i]; if (!win->mIsVisible) @@ -846,12 +846,16 @@ nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae) } break; - case AndroidGeckoEvent::SURFACE_CREATED: - break; + case AndroidGeckoEvent::SURFACE_CREATED: + break; - case AndroidGeckoEvent::SURFACE_DESTROYED: - sValidSurface = false; - break; + case AndroidGeckoEvent::SURFACE_DESTROYED: + sValidSurface = false; + break; + + case AndroidGeckoEvent::GECKO_EVENT_SYNC: + AndroidBridge::Bridge()->AcknowledgeEventSync(); + break; default: break; From b651929fb35e3e22258b7017115459e363b10167 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 4 Mar 2011 16:36:56 -0800 Subject: [PATCH 20/21] Bug 634666 - DEFER_OPEN option for file streams. r=bz,sdwilsh sr=bz a=blocking-fennec --- .../sessionstore/src/nsSessionStore.js | 2 +- netwerk/base/public/nsIFileStreams.idl | 38 +++ netwerk/base/src/nsFileStreams.cpp | 147 ++++++++--- netwerk/base/src/nsFileStreams.h | 61 ++++- netwerk/test/unit/test_NetUtil.js | 67 +++-- netwerk/test/unit/test_filestreams.js | 231 ++++++++++++++++++ toolkit/components/search/nsSearchService.js | 2 +- 7 files changed, 464 insertions(+), 84 deletions(-) create mode 100644 netwerk/test/unit/test_filestreams.js diff --git a/browser/components/sessionstore/src/nsSessionStore.js b/browser/components/sessionstore/src/nsSessionStore.js index af6d513326ec..3c4c4e08c84e 100644 --- a/browser/components/sessionstore/src/nsSessionStore.js +++ b/browser/components/sessionstore/src/nsSessionStore.js @@ -4026,7 +4026,7 @@ SessionStoreService.prototype = { // Initialize the file output stream. var ostream = Cc["@mozilla.org/network/safe-file-output-stream;1"]. createInstance(Ci.nsIFileOutputStream); - ostream.init(aFile, 0x02 | 0x08 | 0x20, 0600, 0); + ostream.init(aFile, 0x02 | 0x08 | 0x20, 0600, ostream.DEFER_OPEN); // Obtain a converter to convert our data to a UTF-8 encoded input stream. var converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]. diff --git a/netwerk/base/public/nsIFileStreams.idl b/netwerk/base/public/nsIFileStreams.idl index c2ee44a723ff..95956b7e4b03 100644 --- a/netwerk/base/public/nsIFileStreams.idl +++ b/netwerk/base/public/nsIFileStreams.idl @@ -81,6 +81,28 @@ interface nsIFileInputStream : nsIInputStream * (The file will only be reopened if it is closed for some reason.) */ const long REOPEN_ON_REWIND = 1<<3; + + /** + * If this is set, the file will be opened (i.e., a call to + * PR_Open done) only when we do an actual operation on the stream, + * or more specifically, when one of the following is called: + * - Seek + * - Tell + * - Available + * - Read + * - ReadLine + * + * DEFER_OPEN is useful if we use the stream on a background + * thread, so that the opening and possible |stat|ing of the file + * happens there as well. + * + * @note Using this flag results in the file not being opened + * during the call to Init. This means that any errors that might + * happen when this flag is not set would happen during the + * first read. Also, the file is not locked when Init is called, + * so it might be deleted before we try to read from it. + */ + const long DEFER_OPEN = 1<<4; }; /** @@ -102,6 +124,22 @@ interface nsIFileOutputStream : nsIOutputStream */ void init(in nsIFile file, in long ioFlags, in long perm, in long behaviorFlags); + + /** + * See the same constant in nsIFileInputStream. The deferred open will + * be performed when one of the following is called: + * - Seek + * - Tell + * - Write + * - Flush + * + * @note Using this flag results in the file not being opened + * during the call to Init. This means that any errors that might + * happen when this flag is not set would happen during the + * first write, and if the file is to be created, then it will not + * appear on the disk until the first write. + */ + const long DEFER_OPEN = 1<<0; }; /** diff --git a/netwerk/base/src/nsFileStreams.cpp b/netwerk/base/src/nsFileStreams.cpp index 4b9deb2acae9..a386c76a8bdb 100644 --- a/netwerk/base/src/nsFileStreams.cpp +++ b/netwerk/base/src/nsFileStreams.cpp @@ -72,41 +72,27 @@ nsFileStream::nsFileStream() : mFD(nsnull) - , mCloseFD(PR_TRUE) + , mBehaviorFlags(0) + , mDeferredOpen(false) { } nsFileStream::~nsFileStream() { - if (mCloseFD) - Close(); + Close(); } NS_IMPL_THREADSAFE_ISUPPORTS1(nsFileStream, nsISeekableStream) -nsresult -nsFileStream::InitWithFileDescriptor(PRFileDesc* fd, nsISupports* parent) -{ - NS_ENSURE_TRUE(mFD == nsnull, NS_ERROR_ALREADY_INITIALIZED); - // - // this file stream is dependent on its parent to keep the - // file descriptor valid. an owning reference to the parent - // prevents the file descriptor from going away prematurely. - // - mFD = fd; - mCloseFD = PR_FALSE; - mParent = parent; - return NS_OK; -} - nsresult nsFileStream::Close() { + CleanUpOpen(); + nsresult rv = NS_OK; if (mFD) { - if (mCloseFD) - if (PR_Close(mFD) == PR_FAILURE) - rv = NS_BASE_STREAM_OSERROR; + if (PR_Close(mFD) == PR_FAILURE) + rv = NS_BASE_STREAM_OSERROR; mFD = nsnull; } return rv; @@ -115,6 +101,9 @@ nsFileStream::Close() NS_IMETHODIMP nsFileStream::Seek(PRInt32 whence, PRInt64 offset) { + nsresult rv = DoPendingOpen(); + NS_ENSURE_SUCCESS(rv, rv); + if (mFD == nsnull) return NS_BASE_STREAM_CLOSED; @@ -128,6 +117,9 @@ nsFileStream::Seek(PRInt32 whence, PRInt64 offset) NS_IMETHODIMP nsFileStream::Tell(PRInt64 *result) { + nsresult rv = DoPendingOpen(); + NS_ENSURE_SUCCESS(rv, rv); + if (mFD == nsnull) return NS_BASE_STREAM_CLOSED; @@ -174,6 +166,62 @@ nsFileStream::SetEOF() return NS_OK; } +nsresult +nsFileStream::MaybeOpen(nsILocalFile* aFile, PRInt32 aIoFlags, PRInt32 aPerm, + bool aDeferred) +{ + mOpenParams.ioFlags = aIoFlags; + mOpenParams.perm = aPerm; + + if (aDeferred) { + // Clone the file, as it may change between now and the deferred open + nsCOMPtr file; + nsresult rv = aFile->Clone(getter_AddRefs(file)); + NS_ENSURE_SUCCESS(rv, rv); + + mOpenParams.localFile = do_QueryInterface(file); + NS_ENSURE_TRUE(mOpenParams.localFile, NS_ERROR_UNEXPECTED); + + mDeferredOpen = true; + return NS_OK; + } + + mOpenParams.localFile = aFile; + + return DoOpen(); +} + +void +nsFileStream::CleanUpOpen() +{ + mOpenParams.localFile = nsnull; + mDeferredOpen = false; +} + +nsresult +nsFileStream::DoOpen() +{ + NS_PRECONDITION(mOpenParams.localFile, "Must have a file to open"); + + PRFileDesc* fd; + nsresult rv = mOpenParams.localFile->OpenNSPRFileDesc(mOpenParams.ioFlags, mOpenParams.perm, &fd); + CleanUpOpen(); + NS_ENSURE_SUCCESS(rv, rv); + mFD = fd; + + return NS_OK; +} + +nsresult +nsFileStream::DoPendingOpen() +{ + if (!mDeferredOpen) { + return NS_OK; + } + + return DoOpen(); +} + //////////////////////////////////////////////////////////////////////////////// // nsFileInputStream @@ -232,12 +280,10 @@ nsFileInputStream::Open(nsIFile* aFile, PRInt32 aIOFlags, PRInt32 aPerm) if (aPerm == -1) aPerm = 0; - PRFileDesc* fd; - rv = localFile->OpenNSPRFileDesc(aIOFlags, aPerm, &fd); + rv = MaybeOpen(localFile, aIOFlags, aPerm, + mBehaviorFlags & nsIFileInputStream::DEFER_OPEN); if (NS_FAILED(rv)) return rv; - mFD = fd; - if (mBehaviorFlags & DELETE_ON_CLOSE) { // POSIX compatible filesystems allow a file to be unlinked while a // file descriptor is still referencing the file. since we've already @@ -259,7 +305,7 @@ nsFileInputStream::Init(nsIFile* aFile, PRInt32 aIOFlags, PRInt32 aPerm, PRInt32 aBehaviorFlags) { NS_ENSURE_TRUE(!mFD, NS_ERROR_ALREADY_INITIALIZED); - NS_ENSURE_TRUE(!mParent, NS_ERROR_ALREADY_INITIALIZED); + NS_ENSURE_TRUE(!mDeferredOpen, NS_ERROR_ALREADY_INITIALIZED); mBehaviorFlags = aBehaviorFlags; @@ -291,6 +337,9 @@ nsFileInputStream::Close() NS_IMETHODIMP nsFileInputStream::Available(PRUint32* aResult) { + nsresult rv = DoPendingOpen(); + NS_ENSURE_SUCCESS(rv, rv); + if (!mFD) { return NS_BASE_STREAM_CLOSED; } @@ -310,6 +359,9 @@ nsFileInputStream::Available(PRUint32* aResult) NS_IMETHODIMP nsFileInputStream::Read(char* aBuf, PRUint32 aCount, PRUint32* aResult) { + nsresult rv = DoPendingOpen(); + NS_ENSURE_SUCCESS(rv, rv); + if (!mFD) { *aResult = 0; return NS_OK; @@ -333,6 +385,9 @@ nsFileInputStream::Read(char* aBuf, PRUint32 aCount, PRUint32* aResult) NS_IMETHODIMP nsFileInputStream::ReadLine(nsACString& aLine, PRBool* aResult) { + nsresult rv = DoPendingOpen(); + NS_ENSURE_SUCCESS(rv, rv); + if (!mLineBuffer) { nsresult rv = NS_InitLineBuffer(&mLineBuffer); if (NS_FAILED(rv)) return rv; @@ -365,6 +420,9 @@ nsFileInputStream::IsNonBlocking(PRBool *aNonBlocking) NS_IMETHODIMP nsFileInputStream::Seek(PRInt32 aWhence, PRInt64 aOffset) { + nsresult rv = DoPendingOpen(); + NS_ENSURE_SUCCESS(rv, rv); + PR_FREEIF(mLineBuffer); // this invalidates the line buffer if (!mFD) { if (mBehaviorFlags & REOPEN_ON_REWIND) { @@ -564,6 +622,9 @@ nsFileOutputStream::Init(nsIFile* file, PRInt32 ioFlags, PRInt32 perm, PRInt32 behaviorFlags) { NS_ENSURE_TRUE(mFD == nsnull, NS_ERROR_ALREADY_INITIALIZED); + NS_ENSURE_TRUE(!mDeferredOpen, NS_ERROR_ALREADY_INITIALIZED); + + mBehaviorFlags = behaviorFlags; nsresult rv; nsCOMPtr localFile = do_QueryInterface(file, &rv); @@ -573,12 +634,8 @@ nsFileOutputStream::Init(nsIFile* file, PRInt32 ioFlags, PRInt32 perm, if (perm <= 0) perm = 0664; - PRFileDesc* fd; - rv = localFile->OpenNSPRFileDesc(ioFlags, perm, &fd); - if (NS_FAILED(rv)) return rv; - - mFD = fd; - return NS_OK; + return MaybeOpen(localFile, ioFlags, perm, + mBehaviorFlags & nsIFileOutputStream::DEFER_OPEN); } NS_IMETHODIMP @@ -590,6 +647,9 @@ nsFileOutputStream::Close() NS_IMETHODIMP nsFileOutputStream::Write(const char *buf, PRUint32 count, PRUint32 *result) { + nsresult rv = DoPendingOpen(); + NS_ENSURE_SUCCESS(rv, rv); + if (mFD == nsnull) return NS_BASE_STREAM_CLOSED; @@ -604,6 +664,9 @@ nsFileOutputStream::Write(const char *buf, PRUint32 count, PRUint32 *result) NS_IMETHODIMP nsFileOutputStream::Flush(void) { + nsresult rv = DoPendingOpen(); + NS_ENSURE_SUCCESS(rv, rv); + if (mFD == nsnull) return NS_BASE_STREAM_CLOSED; @@ -653,7 +716,16 @@ NS_IMETHODIMP nsSafeFileOutputStream::Init(nsIFile* file, PRInt32 ioFlags, PRInt32 perm, PRInt32 behaviorFlags) { - NS_ENSURE_ARG(file); + return nsFileOutputStream::Init(file, ioFlags, perm, behaviorFlags); +} + +nsresult +nsSafeFileOutputStream::DoOpen() +{ + // Make sure mOpenParams.localFile will be empty if we bail somewhere in + // this function + nsCOMPtr file; + file.swap(mOpenParams.localFile); nsresult rv = file->Exists(&mTargetFileExists); if (NS_FAILED(rv)) { @@ -680,16 +752,21 @@ nsSafeFileOutputStream::Init(nsIFile* file, PRInt32 ioFlags, PRInt32 perm, PRUint32 origPerm; if (NS_FAILED(file->GetPermissions(&origPerm))) { NS_ERROR("Can't get permissions of target file"); - origPerm = perm; + origPerm = mOpenParams.perm; } // XXX What if |perm| is more restrictive then |origPerm|? // This leaves the user supplied permissions as they were. rv = tempResult->CreateUnique(nsIFile::NORMAL_FILE_TYPE, origPerm); } if (NS_SUCCEEDED(rv)) { + // nsFileOutputStream::DoOpen will work on the temporary file, so we + // prepare it and place it in mOpenParams.localFile. + nsCOMPtr localFile = do_QueryInterface(tempResult, &rv); + NS_ENSURE_SUCCESS(rv, rv); + mOpenParams.localFile = localFile; mTempFile = tempResult; mTargetFile = file; - rv = nsFileOutputStream::Init(mTempFile, ioFlags, perm, behaviorFlags); + rv = nsFileOutputStream::DoOpen(); } return rv; } diff --git a/netwerk/base/src/nsFileStreams.h b/netwerk/base/src/nsFileStreams.h index ef799f9b9bcf..3206eae7fe42 100644 --- a/netwerk/base/src/nsFileStreams.h +++ b/netwerk/base/src/nsFileStreams.h @@ -64,13 +64,57 @@ public: virtual ~nsFileStream(); nsresult Close(); - nsresult InitWithFileDescriptor(PRFileDesc* fd, nsISupports* parent); protected: - PRFileDesc* mFD; - nsCOMPtr mParent; // strong reference to parent nsFileIO, - // which ensures mFD remains valid. - PRBool mCloseFD; + PRFileDesc* mFD; + + /** + * Flags describing our behavior. See the IDL file for possible values. + */ + PRInt32 mBehaviorFlags; + + /** + * Whether we have a pending open (see DEFER_OPEN in the IDL file). + */ + bool mDeferredOpen; + + struct OpenParams { + nsCOMPtr localFile; + PRInt32 ioFlags; + PRInt32 perm; + }; + + /** + * Data we need to do an open. + */ + OpenParams mOpenParams; + + /** + * Prepares the data we need to open the file, and either does the open now + * by calling DoOpen(), or leaves it to be opened later by a call to + * DoPendingOpen(). + */ + nsresult MaybeOpen(nsILocalFile* aFile, PRInt32 aIoFlags, PRInt32 aPerm, + bool aDeferred); + + /** + * Cleans up data prepared in MaybeOpen. + */ + void CleanUpOpen(); + + /** + * Open the file. This is called either from MaybeOpen (during Init) + * or from DoPendingOpen (if DEFER_OPEN is used when initializing this + * stream). The default behavior of DoOpen is to open the file and save the + * file descriptor. + */ + virtual nsresult DoOpen(); + + /** + * If there is a pending open, do it now. It's important for this to be + * inline since we do it in almost every stream API call. + */ + inline nsresult DoPendingOpen(); }; //////////////////////////////////////////////////////////////////////////////// @@ -93,7 +137,6 @@ public: nsFileInputStream() : nsFileStream() { mLineBuffer = nsnull; - mBehaviorFlags = 0; } virtual ~nsFileInputStream() { @@ -118,10 +161,6 @@ protected: * The permissions passed to Init() for the file open. */ PRInt32 mPerm; - /** - * Flags describing our behavior. See the IDL file for possible values. - */ - PRInt32 mBehaviorFlags; protected: /** @@ -194,6 +233,8 @@ public: virtual ~nsSafeFileOutputStream() { nsSafeFileOutputStream::Close(); } + virtual nsresult DoOpen(); + NS_IMETHODIMP Close(); NS_IMETHODIMP Write(const char *buf, PRUint32 count, PRUint32 *result); NS_IMETHODIMP Init(nsIFile* file, PRInt32 ioFlags, PRInt32 perm, PRInt32 behaviorFlags); diff --git a/netwerk/test/unit/test_NetUtil.js b/netwerk/test/unit/test_NetUtil.js index e807a41cb987..83468a330297 100644 --- a/netwerk/test/unit/test_NetUtil.js +++ b/netwerk/test/unit/test_NetUtil.js @@ -49,6 +49,9 @@ Components.utils.import("resource://gre/modules/NetUtil.jsm"); // files. do_get_profile(); +const OUTPUT_STREAM_CONTRACT_ID = "@mozilla.org/network/file-output-stream;1"; +const SAFE_OUTPUT_STREAM_CONTRACT_ID = "@mozilla.org/network/safe-file-output-stream;1"; + //////////////////////////////////////////////////////////////////////////////// //// Helper Methods @@ -75,10 +78,15 @@ function getFileContents(aFile) return string.value; } -//////////////////////////////////////////////////////////////////////////////// -//// Tests - -function test_async_write_file() +/** + * Tests asynchronously writing a file using NetUtil.asyncCopy. + * + * @param aContractId + * The contract ID to use for the output stream + * @param aDeferOpen + * Whether to use DEFER_OPEN in the output stream. + */ +function async_write_file(aContractId, aDeferOpen) { do_test_pending(); @@ -90,9 +98,8 @@ function test_async_write_file() file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666); // Then, we need an output stream to our output file. - let ostream = Cc["@mozilla.org/network/file-output-stream;1"]. - createInstance(Ci.nsIFileOutputStream); - ostream.init(file, -1, -1, 0); + let ostream = Cc[aContractId].createInstance(Ci.nsIFileOutputStream); + ostream.init(file, -1, -1, aDeferOpen ? Ci.nsIFileOutputStream.DEFER_OPEN : 0); // Finally, we need an input stream to take data from. const TEST_DATA = "this is a test string"; @@ -113,39 +120,23 @@ function test_async_write_file() }); } -function test_async_write_file_nsISafeOutputStream() -{ - do_test_pending(); +//////////////////////////////////////////////////////////////////////////////// +//// Tests - // First, we need an output file to write to. - let file = Cc["@mozilla.org/file/directory_service;1"]. - getService(Ci.nsIProperties). - get("ProfD", Ci.nsIFile); - file.append("NetUtil-async-test-file.tmp"); - file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666); +function test_async_write_file() { + async_write_file(OUTPUT_STREAM_CONTRACT_ID); +} - // Then, we need an output stream to our output file. - let ostream = Cc["@mozilla.org/network/safe-file-output-stream;1"]. - createInstance(Ci.nsIFileOutputStream); - ostream.init(file, -1, -1, 0); +function test_async_write_file_deferred() { + async_write_file(OUTPUT_STREAM_CONTRACT_ID, true); +} - // Finally, we need an input stream to take data from. - const TEST_DATA = "this is a test string"; - let istream = Cc["@mozilla.org/io/string-input-stream;1"]. - createInstance(Ci.nsIStringInputStream); - istream.setData(TEST_DATA, TEST_DATA.length); +function test_async_write_file_safe() { + async_write_file(SAFE_OUTPUT_STREAM_CONTRACT_ID); +} - NetUtil.asyncCopy(istream, ostream, function(aResult) { - // Make sure the copy was successful! - do_check_true(Components.isSuccessCode(aResult)); - - // Check the file contents. - do_check_eq(TEST_DATA, getFileContents(file)); - - // Finish the test. - do_test_finished(); - run_next_test(); - }); +function test_async_write_file_safe_deferred() { + async_write_file(SAFE_OUTPUT_STREAM_CONTRACT_ID, true); } function test_newURI_no_spec_throws() @@ -529,7 +520,9 @@ function test_readInputStreamToString_too_many_bytes() let tests = [ test_async_write_file, - test_async_write_file_nsISafeOutputStream, + test_async_write_file_deferred, + test_async_write_file_safe, + test_async_write_file_safe_deferred, test_newURI_no_spec_throws, test_newURI, test_newURI_takes_nsIFile, diff --git a/netwerk/test/unit/test_filestreams.js b/netwerk/test/unit/test_filestreams.js new file mode 100644 index 000000000000..bb3ad1b97876 --- /dev/null +++ b/netwerk/test/unit/test_filestreams.js @@ -0,0 +1,231 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +let Cc = Components.classes; +let Ci = Components.interfaces; + +// We need the profile directory so the test harness will clean up our test +// files. +do_get_profile(); + +const OUTPUT_STREAM_CONTRACT_ID = "@mozilla.org/network/file-output-stream;1"; +const SAFE_OUTPUT_STREAM_CONTRACT_ID = "@mozilla.org/network/safe-file-output-stream;1"; + +//////////////////////////////////////////////////////////////////////////////// +//// Helper Methods + +/** + * Generates a leafName for a file that does not exist, but does *not* + * create the file. Similar to createUnique except for the fact that createUnique + * does create the file. + * + * @param aFile + * The file to modify in order for it to have a unique leafname. + */ +function ensure_unique(aFile) +{ + ensure_unique.fileIndex = ensure_unique.fileIndex || 0; + + var leafName = aFile.leafName; + while (aFile.clone().exists()) { + aFile.leafName = leafName + "_" + (ensure_unique.fileIndex++); + } +} + +/** + * Tests for files being accessed at the right time. Streams that use + * DEFER_OPEN should only open or create the file when an operation is + * done, and not during Init(). + * + * Note that for writing, we check for actual writing in test_NetUtil (async) + * and in sync_operations in this file (sync), whereas in this function we + * just check that the file is *not* created during init. + * + * @param aContractId + * The contract ID to use for the output stream + * @param aDeferOpen + * Whether to check with DEFER_OPEN or not + * @param aTrickDeferredOpen + * Whether we try to 'trick' deferred opens by changing the file object before + * the actual open. The stream should have a clone, so changes to the file + * object after Init and before Open should not affect it. + */ +function check_access(aContractId, aDeferOpen, aTrickDeferredOpen) +{ + const LEAF_NAME = "filestreams-test-file.tmp"; + const TRICKY_LEAF_NAME = "BetYouDidNotExpectThat.tmp"; + let file = Cc["@mozilla.org/file/directory_service;1"]. + getService(Ci.nsIProperties). + get("ProfD", Ci.nsIFile); + file.append(LEAF_NAME); + + // Writing + + ensure_unique(file); + let ostream = Cc[aContractId].createInstance(Ci.nsIFileOutputStream); + ostream.init(file, -1, -1, aDeferOpen ? Ci.nsIFileOutputStream.DEFER_OPEN : 0); + do_check_eq(aDeferOpen, !file.clone().exists()); // If defer, should not exist and vice versa + if (aDeferOpen) { + // File should appear when we do write to it. + if (aTrickDeferredOpen) { + // See |@param aDeferOpen| in the JavaDoc comment for this function + file.leafName = TRICKY_LEAF_NAME; + } + ostream.write("data", 4); + if (aTrickDeferredOpen) { + file.leafName = LEAF_NAME; + } + // We did a write, so the file should now exist + do_check_true(file.clone().exists()); + } + ostream.close(); + + // Reading + + ensure_unique(file); + let istream = Cc["@mozilla.org/network/file-input-stream;1"]. + createInstance(Ci.nsIFileInputStream); + var initOk, getOk; + try { + istream.init(file, -1, 0, aDeferOpen ? Ci.nsIFileInputStream.DEFER_OPEN : 0); + initOk = true; + } + catch(e) { + initOk = false; + } + try { + let fstream = Cc["@mozilla.org/network/file-input-stream;1"]. + createInstance(Ci.nsIFileInputStream); + fstream.init(aFile, -1, 0, 0); + getOk = true; + } + catch(e) { + getOk = false; + } + + // If the open is deferred, then Init should succeed even though the file we + // intend to read does not exist, and then trying to read from it should + // fail. The other case is where the open is not deferred, and there we should + // get an error when we Init (and also when we try to read). + do_check_true( (aDeferOpen && initOk && !getOk) || + (!aDeferOpen && !initOk && !getOk) ); + istream.close(); +} + +/** + * We test async operations in test_NetUtil.js, and here test for simple sync + * operations on input streams. + * + * @param aDeferOpen + * Whether to use DEFER_OPEN in the streams. + */ +function sync_operations(aDeferOpen) +{ + const TEST_DATA = "this is a test string"; + const LEAF_NAME = "filestreams-test-file.tmp"; + + let file = Cc["@mozilla.org/file/directory_service;1"]. + getService(Ci.nsIProperties). + get("ProfD", Ci.nsIFile); + file.append(LEAF_NAME); + file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666); + + let ostream = Cc[OUTPUT_STREAM_CONTRACT_ID]. + createInstance(Ci.nsIFileOutputStream); + ostream.init(file, -1, -1, aDeferOpen ? Ci.nsIFileOutputStream.DEFER_OPEN : 0); + + ostream.write(TEST_DATA, TEST_DATA.length); + ostream.close(); + + let fstream = Cc["@mozilla.org/network/file-input-stream;1"]. + createInstance(Ci.nsIFileInputStream); + fstream.init(file, -1, 0, aDeferOpen ? Ci.nsIFileInputStream.DEFER_OPEN : 0); + + let cstream = Cc["@mozilla.org/intl/converter-input-stream;1"]. + createInstance(Ci.nsIConverterInputStream); + cstream.init(fstream, "UTF-8", 0, 0); + + let string = {}; + cstream.readString(-1, string); + cstream.close(); + fstream.close(); + + do_check_eq(string.value, TEST_DATA); +} + +//////////////////////////////////////////////////////////////////////////////// +//// Tests + +function test_access() +{ + check_access(OUTPUT_STREAM_CONTRACT_ID, false, false); +} + +function test_access_trick() +{ + check_access(OUTPUT_STREAM_CONTRACT_ID, false, true); +} + +function test_access_defer() +{ + check_access(OUTPUT_STREAM_CONTRACT_ID, true, false); +} + +function test_access_defer_trick() +{ + check_access(OUTPUT_STREAM_CONTRACT_ID, true, true); +} + +function test_access_safe() +{ + check_access(SAFE_OUTPUT_STREAM_CONTRACT_ID, false, false); +} + +function test_access_safe_trick() +{ + check_access(SAFE_OUTPUT_STREAM_CONTRACT_ID, false, true); +} + +function test_access_safe_defer() +{ + check_access(SAFE_OUTPUT_STREAM_CONTRACT_ID, true, false); +} + +function test_access_safe_defer_trick() +{ + check_access(SAFE_OUTPUT_STREAM_CONTRACT_ID, true, true); +} + +function test_sync_operations() +{ + sync_operations(); +} + +function test_sync_operations_deferred() +{ + sync_operations(true); +} + +//////////////////////////////////////////////////////////////////////////////// +//// Test Runner + +let tests = [ + test_access, + test_access_trick, + test_access_defer, + test_access_defer_trick, + test_access_safe, + test_access_safe_trick, + test_access_safe_defer, + test_access_safe_defer_trick, + test_sync_operations, + test_sync_operations_deferred, +]; + +function run_test() +{ + tests.forEach(function(test) { + test(); + }); +} + diff --git a/toolkit/components/search/nsSearchService.js b/toolkit/components/search/nsSearchService.js index e08e68d99eb4..36e438457b16 100644 --- a/toolkit/components/search/nsSearchService.js +++ b/toolkit/components/search/nsSearchService.js @@ -2560,7 +2560,7 @@ SearchService.prototype = { try { LOG("_buildCache: Writing to cache file."); - ostream.init(cacheFile, (MODE_WRONLY | MODE_CREATE | MODE_TRUNCATE), PERMS_FILE, 0); + ostream.init(cacheFile, (MODE_WRONLY | MODE_CREATE | MODE_TRUNCATE), PERMS_FILE, ostream.DEFER_OPEN); converter.charset = "UTF-8"; let data = converter.convertToInputStream(JSON.stringify(cache)); From 06bcc0b719a34ebe09d699cffad96836fe774c15 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Fri, 4 Mar 2011 17:35:23 -0800 Subject: [PATCH 21/21] Bug 638963: Blacklist JIT on the Samsung Continuum. r+a=dvander DONTBUILD (Android-only) --- js/src/jscntxt.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/js/src/jscntxt.cpp b/js/src/jscntxt.cpp index e5309444673b..9ee277874a57 100644 --- a/js/src/jscntxt.cpp +++ b/js/src/jscntxt.cpp @@ -2237,6 +2237,7 @@ ComputeIsJITBroken() do { if (0 == line.find("Hardware")) { const char* blacklist[] = { + "SCH-I400", // Samsung Continuum "SGH-T959", // Samsung i9000, Vibrant device "SGH-I897", // Samsung i9000, Captivate device "SCH-I500", // Samsung i9000, Fascinate device