The default bug view has changed. See this FAQ.

implement EXSLT - Regular Expressions module

RESOLVED FIXED

Status

()

Core
XSLT
--
enhancement
RESOLVED FIXED
11 years ago
10 years ago

People

(Reporter: myk, Assigned: peterv)

Tracking

Trunk
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 3 obsolete attachments)

(Reporter)

Description

11 years ago
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.
Depends on: 348642
(Assignee)

Comment 1

11 years ago
Created attachment 240731 [details] [diff] [review]
v1
(Assignee)

Comment 2

11 years ago
Created attachment 240856 [details] [diff] [review]
v1.1
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.
(Assignee)

Comment 4

11 years ago
Created attachment 246116 [details] [diff] [review]
v2
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)
(Assignee)

Comment 5

11 years ago
Created attachment 246360 [details] [diff] [review]
v2.1

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+
(Assignee)

Comment 8

11 years ago
Created attachment 247414 [details] [diff] [review]
Add JS component to package files v1
(Assignee)

Comment 9

11 years ago
(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
Last Resolved: 11 years ago
Resolution: --- → FIXED
Depends on: 363656
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.