Closed Bug 354886 Opened 18 years ago Closed 18 years ago

implement EXSLT - Regular Expressions module

Categories

(Core :: XSLT, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: myk, Assigned: peterv)

References

Details

Attachments

(2 files, 3 obsolete files)

For some microsummary generators, it would be useful to be able to extract content from plaintext using regular expressions.

XPath 2 includes support for regexps, but implementing it would be a lot of work, so in the meantime the EXSLT - Regular Expressions module seems like the simplest way of adding regexp capabilities to XSLT.  We should implement it and include it with our XSLT processor.
Attached patch v1 (obsolete) — Splinter Review
Attached patch v1.1 (obsolete) — Splinter Review
Assignee: xslt → peterv
Attachment #240731 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #240856 - Flags: superreview?(bugmail)
Attachment #240856 - Flags: review?(bugmail)
btw, i was holding off reviewing this until bug 193678 is in since there was some overlap.
Attached patch v2 (obsolete) — Splinter Review
Attachment #240856 - Attachment is obsolete: true
Attachment #246116 - Flags: superreview?(bugmail)
Attachment #246116 - Flags: review?(bugmail)
Attachment #240856 - Flags: superreview?(bugmail)
Attachment #240856 - Flags: review?(bugmail)
Attached patch v2.1Splinter Review
This one compiles and works (tested using exslt.org testcases).
Attachment #246116 - Attachment is obsolete: true
Attachment #246360 - Flags: superreview?(bugmail)
Attachment #246360 - Flags: review?(bugmail)
Attachment #246116 - Flags: superreview?(bugmail)
Attachment #246116 - Flags: review?(bugmail)
Is there a risk that anything can be put in the expression or flags to make it possible to break out of regexp and execute script? I can't see anything though.
Comment on attachment 246360 [details] [diff] [review]
v2.1

>Index: content/xslt/src/xslt/txStylesheetCompiler.cpp
>@@ -1062,7 +1078,49 @@ findFunction(nsIAtom* aName, PRInt32 aNa
>         }
>     }
> 
>-    return NS_ERROR_XPATH_UNKNOWN_FUNCTION;
>+    if (!sXPCOMFunctionMappings) {
>+        sXPCOMFunctionMappings = new nsTArray<txXPCOMFunctionMapping>;
>+    }

Check for OOM.

>+    txXPCOMFunctionMapping *map;

Please init this to nsnull. That way if we screw up somewhere it'll be a nullpointer deref rather than a security problem.

with that, r/sr=sicking
Attachment #246360 - Flags: superreview?(bugmail)
Attachment #246360 - Flags: superreview+
Attachment #246360 - Flags: review?(bugmail)
Attachment #246360 - Flags: review+
(In reply to comment #6)
> Is there a risk that anything can be put in the expression or flags to make it
> possible to break out of regexp and execute script? I can't see anything
> though.

Me neither.

Checked in with the additional patch to add the JS component to the package files.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
The regexp:match function is broken, see bug 363656
You need to log in before you can comment on or make changes to this bug.