Last Comment Bug 354886 - implement EXSLT - Regular Expressions module
: implement EXSLT - Regular Expressions module
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: XSLT (show other bugs)
: Trunk
: All All
: -- enhancement (vote)
: ---
Assigned To: Peter Van der Beken [:peterv]
: Keith Visco
: Andrew Overholt [:overholt]
Mentors:
Depends on: 348642 363656
Blocks:
  Show dependency treegraph
 
Reported: 2006-09-29 14:22 PDT by Myk Melez [:myk] [@mykmelez]
Modified: 2006-12-12 16:57 PST (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
v1 (29.36 KB, patch)
2006-09-30 09:35 PDT, Peter Van der Beken [:peterv]
no flags Details | Diff | Splinter Review
v1.1 (31.07 KB, patch)
2006-10-01 15:17 PDT, Peter Van der Beken [:peterv]
no flags Details | Diff | Splinter Review
v2 (16.39 KB, patch)
2006-11-20 21:25 PST, Peter Van der Beken [:peterv]
no flags Details | Diff | Splinter Review
v2.1 (15.94 KB, patch)
2006-11-22 17:59 PST, Peter Van der Beken [:peterv]
jonas: review+
jonas: superreview+
Details | Diff | Splinter Review
Add JS component to package files v1 (15.94 KB, patch)
2006-12-04 07:32 PST, Peter Van der Beken [:peterv]
no flags Details | Diff | Splinter Review

Description Myk Melez [:myk] [@mykmelez] 2006-09-29 14:22:41 PDT
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.
Comment 1 Peter Van der Beken [:peterv] 2006-09-30 09:35:26 PDT
Created attachment 240731 [details] [diff] [review]
v1
Comment 2 Peter Van der Beken [:peterv] 2006-10-01 15:17:38 PDT
Created attachment 240856 [details] [diff] [review]
v1.1
Comment 3 Jonas Sicking (:sicking) No longer reading bugmail consistently 2006-11-01 15:20:31 PST
btw, i was holding off reviewing this until bug 193678 is in since there was some overlap.
Comment 4 Peter Van der Beken [:peterv] 2006-11-20 21:25:24 PST
Created attachment 246116 [details] [diff] [review]
v2
Comment 5 Peter Van der Beken [:peterv] 2006-11-22 17:59:17 PST
Created attachment 246360 [details] [diff] [review]
v2.1

This one compiles and works (tested using exslt.org testcases).
Comment 6 Jonas Sicking (:sicking) No longer reading bugmail consistently 2006-11-29 21:54:07 PST
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 7 Jonas Sicking (:sicking) No longer reading bugmail consistently 2006-11-29 22:26:54 PST
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
Comment 8 Peter Van der Beken [:peterv] 2006-12-04 07:32:51 PST
Created attachment 247414 [details] [diff] [review]
Add JS component to package files v1
Comment 9 Peter Van der Beken [:peterv] 2006-12-04 07:37:18 PST
(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.
Comment 10 Jonas Sicking (:sicking) No longer reading bugmail consistently 2006-12-12 16:57:09 PST
The regexp:match function is broken, see bug 363656

Note You need to log in before you can comment on or make changes to this bug.