From 15efd8db2fa7da0ada4dd3ef965c44a935147e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Mon, 2 Mar 2009 11:13:22 +0000 Subject: [PATCH] add abort method to wfs protocol, r=tschaub (closes #1943) git-svn-id: http://svn.openlayers.org/trunk/openlayers@8933 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Protocol/WFS/v1.js | 17 ++++++++++++++++- tests/Protocol/WFS.html | 23 +++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Protocol/WFS/v1.js b/lib/OpenLayers/Protocol/WFS/v1.js index a861162e64..71998da854 100644 --- a/lib/OpenLayers/Protocol/WFS/v1.js +++ b/lib/OpenLayers/Protocol/WFS/v1.js @@ -323,6 +323,21 @@ OpenLayers.Protocol.WFS.v1 = OpenLayers.Class(OpenLayers.Protocol, { }); }, - + + /** + * Method: abort + * Abort an ongoing request, the response object passed to + * this method must come from this protocol (as a result + * of a read, or commit operation). + * + * Parameters: + * response - {} + */ + abort: function(response) { + if (response) { + response.priv.abort(); + } + }, + CLASS_NAME: "OpenLayers.Protocol.WFS.v1" }); diff --git a/tests/Protocol/WFS.html b/tests/Protocol/WFS.html index aa3dc5b9f8..5da70c4b36 100644 --- a/tests/Protocol/WFS.html +++ b/tests/Protocol/WFS.html @@ -164,6 +164,29 @@ OpenLayers.Request.POST = _POST; } + + function test_abort(t) { + t.plan(1); + var protocol = new OpenLayers.Protocol.WFS({ + url: "http://example.com", + featureNS: "http://example.com#namespace", + featureType: "type" + }); + + var response = { + priv: { + abort: function() { + aborted = true; + } + } + }; + + // call abort with mocked response + var aborted = false; + protocol.abort(response); + t.eq(aborted, true, "abort called on response.priv"); + + } function readXML(id) { var xml = document.getElementById(id).firstChild.nodeValue;